diff --git a/src/index.ts b/src/index.ts index bd2103d..7263fcf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -324,7 +324,7 @@ const QUESTIONS: Array = [ 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."; }, @@ -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) { @@ -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;