From 208346f37bb3b9dad654a116dffeedaa89641ac0 Mon Sep 17 00:00:00 2001 From: David Herman Date: Tue, 9 Mar 2021 21:13:06 -0800 Subject: [PATCH] Call npm.cmd on Windows --- create-neon/src/package.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/create-neon/src/package.ts b/create-neon/src/package.ts index 9ddea6f5f..0afcac845 100644 --- a/create-neon/src/package.ts +++ b/create-neon/src/package.ts @@ -23,6 +23,8 @@ function sort(json: any): any { return Object.assign(next, json); } +const NPM = /^win/.test(process.platform) ? 'npm.cmd' : 'npm'; + export default class Package { name: string; version: string; @@ -53,7 +55,7 @@ export default class Package { await fs.writeFile(filename, JSON.stringify(seed)); // 2. Call `npm init` to ask the user remaining questions. - await shell('npm', ['init'], name); + await shell(NPM, ['init'], name); // 3. Sort the values in idiomatic `npm init` order. let sorted = sort(JSON.parse(await fs.readFile(filename, 'utf8')));