@jackie_qian/create-vue-app 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils/util.js +14 -4
- package/package.json +1 -1
package/dist/utils/util.js
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
2
|
import { promises as fs } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
function quoteCmdArg(arg) {
|
|
5
|
+
if (!arg) return '""';
|
|
6
|
+
if (!/[ \t\n\v"]/g.test(arg)) return arg;
|
|
7
|
+
return `"${arg.replaceAll('"', '\\"')}"`;
|
|
8
|
+
}
|
|
9
|
+
function toCmdCommandLine(cmd, args) {
|
|
10
|
+
return [cmd, ...args].map(quoteCmdArg).join(" ");
|
|
11
|
+
}
|
|
4
12
|
function spawnSyncCrossPlatform(cmd, args, options) {
|
|
5
13
|
if (process.platform === "win32") {
|
|
6
|
-
const
|
|
7
|
-
|
|
14
|
+
const comspec = process.env.comspec || "cmd.exe";
|
|
15
|
+
const commandLine = toCmdCommandLine(cmd, args);
|
|
16
|
+
const winOptions = { ...options, windowsHide: true };
|
|
17
|
+
return spawnSync(comspec, ["/d", "/s", "/c", commandLine], winOptions);
|
|
8
18
|
}
|
|
9
19
|
return spawnSync(cmd, args, options);
|
|
10
20
|
}
|
|
@@ -187,8 +197,8 @@ export function runCreateVue(flags, cwd) {
|
|
|
187
197
|
return;
|
|
188
198
|
} catch {}
|
|
189
199
|
try {
|
|
190
|
-
run("npm", ["create", "vue@latest", ...flags], cwd);
|
|
200
|
+
run("npm", ["create", "vue@latest", "--", ...flags], cwd);
|
|
191
201
|
return;
|
|
192
202
|
} catch {}
|
|
193
|
-
run("npx", ["--yes", "create-vue@latest", ...flags], cwd);
|
|
203
|
+
run("npx", ["--yes", "create-vue@latest", "--", ...flags], cwd);
|
|
194
204
|
}
|