-
Notifications
You must be signed in to change notification settings - Fork 17
@W-20406426 feat: prompt to enable local dev #595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@W-20406426 feat: prompt to enable local dev #595
Conversation
abdulsattar
left a comment
There was a problem hiding this 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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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".
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
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.
|
In the future, just create a branch off this repository rather than using a fork. CI processes don't run on forks |
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@