Skip to content

@W-18182827 fix: added changes for preview without specifying component name #390

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions src/commands/lightning/dev/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
import { Messages, SfProject } from '@salesforce/core';
import { cmpDev } from '@lwrjs/api';
import { ComponentUtils } from '../../../shared/componentUtils.js';
import { PromptUtils } from '../../../shared/promptUtils.js';

Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@salesforce/plugin-lightning-dev', 'lightning.dev.component');
Expand Down Expand Up @@ -79,12 +78,6 @@ export default class LightningDevComponent extends SfCommand<void> {
}

name = match.name;
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should not be removed.... In the previous release we added the ability to use prompts and ask the user for values to different option flags. This applied to app, site, and component commands and was part of the user experience.

Basically the user should be able to just run sf lightning dev and interactively be asked a series of questions to determine what the user wants to do. Of course the user has the option of running sf lightning dev blah blah and provide the flag values but if they choose not to provide anything and just run sf lightning dev then the interactive experience should take over.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are we saying that we will continue to have the interactive behavior for all other commands/parameters and only for this one we decide not to ask for its value b/c the user can instead just pick it from the menu after single component preview interface loads up?

// prompt the user for a name if one was not provided
name = await PromptUtils.promptUserToSelectComponent(components);
if (!name) {
throw new Error(messages.getMessage('error.component'));
}
}

const dirname = path.dirname(url.fileURLToPath(import.meta.url));
Expand All @@ -95,7 +88,7 @@ export default class LightningDevComponent extends SfCommand<void> {
rootDir,
mode: 'dev',
port,
name: `c/${name}`,
name: `c/${name ?? ''}`,
namespacePaths,
});
}
Expand Down
Loading