Skip to content

Conversation

@jhefferman-sfdc
Copy link
Collaborator

@jhefferman-sfdc jhefferman-sfdc commented Jan 13, 2026

What does this PR do?

Adds a prompt to enable Local Dev for the authenticated org if the user chooses to do so. Removed reliance on environment variable for this.

@W-20406426@

@jhefferman-sfdc jhefferman-sfdc requested review from a team as code owners January 13, 2026 17:35
@jhefferman-sfdc jhefferman-sfdc changed the title feat: prompt to enable local dev @W-20406426 feat: prompt to enable local dev Jan 13, 2026
Copy link
Collaborator

@abdulsattar abdulsattar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests.

const isLightningPreviewEnabled = await MetaUtils.isLightningPreviewEnabled(setupConnection);
if (!isLightningPreviewEnabled) {
const enableLocalDev = await PromptUtils.promptUserToEnableLocalDev();
if (enableLocalDev) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (enableLocalDev) {
if (process.env.AUTO_ENABLE_LOCAL_DEV === 'true' || enableLocalDev) {

We want this process.env as well because from VS Code, it would be easier to set the environment variable when invoking this command when users prompt "Preview this component".

Copy link
Collaborator Author

@jhefferman-sfdc jhefferman-sfdc Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. But is it OK for the prompt to execute when users use the "Preview this component" VSCode command as they will be prompted there, too? Or do we need some different logic to only prompt if, for example the environment variable is completely absent (neither true, nor false)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I made an update

  • VSCode command will set AUTO_ENABLE_LOCAL_DEV to 'true' or 'false' which will skip the command prompt.
  • If AUTO_ENABLE_LOCAL_DEV is undefined then the command prompt is used.


if (enableLocalDev) {
await this.setLightningPreviewEnabled(connection, true);
await this.ensureFirstPartyCookiesNotRequired(connection);
Copy link
Collaborator

@nrkruk nrkruk Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first party cookie setting is only needed to render live preview in VSCode. I'm not sure if we should be explicit about what we are doing here as this won't get turned off when you disable Local Dev.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nrkruk by explicit you mean only set it if the AUTO_ENABLE_LOCAL_DEV is set to true (aka VSCode initiated)?

Copy link
Collaborator

@nrkruk nrkruk Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats what I was doing today (which is hacky), but I want us to think about what the right solution is here.

At a minimum, we need to let the user know that we are changing this setting on their behalf (in addition to enabling local dev). And I don't think we should be changing the cookie setting if the user is just running the command directly from the CLI.

Might be possible to just put the logic for this in the VSCode extension directly (rather than the VSCode telling the CLI to change the cookie setting), but I haven't looked at it.

@nrkruk
Copy link
Collaborator

nrkruk commented Jan 14, 2026

In the future, just create a branch off this repository rather than using a fork. CI processes don't run on forks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants