Skip to content

Commit 5eebd0d

Browse files
committed
add project type support
1 parent d894d58 commit 5eebd0d

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "superplate-cli",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "The frontend boilerplate with superpowers",
55
"license": "MIT",
66
"repository": {

src/cli.ts

+16-6
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const cli = async (): Promise<void> => {
2323
"-s, --source <source-path>",
2424
"specify a custom source of plugins",
2525
)
26+
.option("-p, --project <project-name>", "specify a project type to use")
2627
.option("-d, --debug", "print additional logs and skip install script")
2728
.on("--help", () => {
2829
console.log();
@@ -119,12 +120,21 @@ const cli = async (): Promise<void> => {
119120
}
120121
}
121122

122-
const { projectType } = await prompts({
123-
type: "select",
124-
name: "projectType",
125-
message: "Select your project type",
126-
choices: projectTypes,
127-
});
123+
const projectTypeFromArgs = program.project;
124+
125+
let projectType = "";
126+
if (projectTypes.find((p) => p.title === projectTypeFromArgs)) {
127+
projectType = projectTypeFromArgs;
128+
} else {
129+
const { projectType: projectTypeFromPrompts } = await prompts({
130+
type: "select",
131+
name: "projectType",
132+
message: "Select your project type",
133+
choices: projectTypes,
134+
});
135+
136+
projectType = projectTypeFromPrompts;
137+
}
128138

129139
sourcePath = `${sourcePath}/${projectType}`;
130140
}

0 commit comments

Comments
 (0)