Skip to content
Closed
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions apps/spfx-cli/src/cli/actions/CreateAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const ScaffoldProfileSchema: z.ZodType<IScaffoldProfile> = z.object({
export class CreateAction extends SPFxActionBase {
private readonly _targetDirParameter: CommandLineStringParameter;
private readonly _templateParameter: IRequiredCommandLineStringParameter;
private readonly _libraryNameParameter: IRequiredCommandLineStringParameter;
private readonly _libraryNameParameter: CommandLineStringParameter;
private readonly _componentNameParameter: IRequiredCommandLineStringParameter;
private readonly _componentAliasParameter: CommandLineStringParameter;
private readonly _componentDescriptionParameter: CommandLineStringParameter;
Expand Down Expand Up @@ -83,8 +83,8 @@ export class CreateAction extends SPFxActionBase {
this._libraryNameParameter = this.defineStringParameter({
parameterLongName: '--library-name',
argumentName: 'LIBRARY_NAME',
description: 'The library name for the component',
required: true
description: 'The library name for the component. Defaults to the solution name if not specified.',
required: false
});

this._componentNameParameter = this.defineStringParameter({
Expand Down Expand Up @@ -204,7 +204,7 @@ export class CreateAction extends SPFxActionBase {
const builtInContext: ISPFxBuiltInContext = buildBuiltInContext(
{
componentName,
libraryName: this._libraryNameParameter.value,
libraryName: this._libraryNameParameter.value || solutionName,
spfxVersion: template.spfxVersion,
solutionName: rawSolutionName || undefined,
componentAlias: this._componentAliasParameter.value?.trim() || undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ exports[`CommandLineHelp prints the help: create 1`] = `
"usage: spfx create [-h] [--template-url URL] [--spfx-version VERSION]
[--local-source TEMPLATE_PATH] [--remote-source URL]
[--github-token TOKEN] [--target-dir TARGET_DIR] --template
TEMPLATE_NAME --library-name LIBRARY_NAME --component-name
COMPONENT_NAME [--component-alias COMPONENT_ALIAS]
TEMPLATE_NAME [--library-name LIBRARY_NAME]
--component-name COMPONENT_NAME
[--component-alias COMPONENT_ALIAS]
[--component-description COMPONENT_DESCRIPTION]
[--solution-name SOLUTION_NAME]
[--package-manager {npm,pnpm,yarn,none}]
Expand Down Expand Up @@ -40,7 +41,8 @@ Optional arguments:
--template TEMPLATE_NAME
The template to use for scaffolding
--library-name LIBRARY_NAME
The library name for the component
The library name for the component. Defaults to the
solution name if not specified.
--component-name COMPONENT_NAME
The component name (e.g., \\"Hello World\\")
--component-alias COMPONENT_ALIAS
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/spfx-cli",
"comment": "",
"type": "none"
}
],
"packageName": "@microsoft/spfx-cli"
}