Skip to content

Commit

Permalink
fix: optional project scaffold param
Browse files Browse the repository at this point in the history
  • Loading branch information
idea404 committed Oct 3, 2023
1 parent b59a762 commit 5d63b7c
Show file tree
Hide file tree
Showing 2 changed files with 7,318 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/commands/create-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ const frameworkOption = new Option("--f, --framework <name>", "Framework to use"
[...new Set(templates.map((template) => template.framework))]
);

const projectOption = new Option("--p, --project <name>", "Project template to use").choices(
[...new Set(templates.map((template) => template.project))]
);
const projectOption = new Option("--p, --project <name>", "Project template to use")
.choices([...new Set(templates.map((template) => template.project))])
.default("hello_world");

type CreateOptions = DefaultOptions & {
folderName?: string;
Expand All @@ -73,6 +73,11 @@ export const handler = async (folderName: string, options: CreateOptions) => {
};
Logger.debug(`Initial create-project options: ${JSON.stringify(options, null, 2)}`);

// If the project option is not provided, set it to the default value
if (!options.project) {
options.project = "hello_world";
}

// First, ask the user for the framework
const frameworkAnswers: CreateOptions = await prompt(
[
Expand Down
Loading

0 comments on commit 5d63b7c

Please sign in to comment.