Skip to content

Commit

Permalink
add project type support
Browse files Browse the repository at this point in the history
  • Loading branch information
omeraplak committed Feb 4, 2022
1 parent d894d58 commit 5eebd0d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "superplate-cli",
"version": "1.3.0",
"version": "1.3.1",
"description": "The frontend boilerplate with superpowers",
"license": "MIT",
"repository": {
Expand Down
22 changes: 16 additions & 6 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const cli = async (): Promise<void> => {
"-s, --source <source-path>",
"specify a custom source of plugins",
)
.option("-p, --project <project-name>", "specify a project type to use")
.option("-d, --debug", "print additional logs and skip install script")
.on("--help", () => {
console.log();
Expand Down Expand Up @@ -119,12 +120,21 @@ const cli = async (): Promise<void> => {
}
}

const { projectType } = await prompts({
type: "select",
name: "projectType",
message: "Select your project type",
choices: projectTypes,
});
const projectTypeFromArgs = program.project;

let projectType = "";
if (projectTypes.find((p) => p.title === projectTypeFromArgs)) {
projectType = projectTypeFromArgs;
} else {
const { projectType: projectTypeFromPrompts } = await prompts({
type: "select",
name: "projectType",
message: "Select your project type",
choices: projectTypes,
});

projectType = projectTypeFromPrompts;
}

sourcePath = `${sourcePath}/${projectType}`;
}
Expand Down

0 comments on commit 5eebd0d

Please sign in to comment.