Skip to content
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
12 changes: 8 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ const QUESTIONS: Array<Object> = [
message: "Last but not the least, tell me you project name:",
when: () => !yargs.argv["name"],
validate: (input: string) => {
if (/^([A-Za-z\-\_\d])+$/.test(input)) return true;
if (/^([A-Za-z\-\_\d#])+$/.test(input)) return true;
else
return "Project name may only include letters, numbers, underscores and hashes.";
},
Expand Down Expand Up @@ -513,10 +513,14 @@ function postProcessNode(options: CliOptions) {

let cmd = "";

if (shell.which("yarn")) {
if (fs.existsSync("yarn.lock") && shell.which("yarn")) {
cmd = "yarn";
} else if (fs.existsSync("package-lock.json") && shell.which("npm")) {
cmd = "npm install";
} else if (shell.which("pnpm") && fs.existsSync("pnpm-lock.yaml")) {
cmd = "pnpm install";
} else if (shell.which("npm")) {
cmd = "npm install && npm update";
cmd = "npm install";
}

if (cmd) {
Expand All @@ -526,7 +530,7 @@ function postProcessNode(options: CliOptions) {
return false;
}
} else {
console.log(chalk.red("No yarn or npm found. Cannot run installation."));
console.log(chalk.red("No yarn, npm, or pnpm found. Cannot run installation."));
}

return true;
Expand Down