create-astro 5.0.0 → 5.0.1
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/index.js +14 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -289,21 +289,28 @@ import { align, sleep } from "@astrojs/cli-kit/utils";
|
|
|
289
289
|
// src/shell.ts
|
|
290
290
|
import { spawn } from "node:child_process";
|
|
291
291
|
import { text as textFromStream } from "node:stream/consumers";
|
|
292
|
+
var WINDOWS_CMD_SHIMS = /* @__PURE__ */ new Set(["npm", "npx", "pnpm", "pnpx", "yarn", "yarnpkg", "bun", "bunx"]);
|
|
292
293
|
var text = (stream) => stream ? textFromStream(stream).then((t) => t.trimEnd()) : "";
|
|
294
|
+
function resolveCommand(command) {
|
|
295
|
+
if (process.platform !== "win32") return command;
|
|
296
|
+
if (command.includes("/") || command.includes("\\") || command.includes(".")) return command;
|
|
297
|
+
return WINDOWS_CMD_SHIMS.has(command.toLowerCase()) ? `${command}.cmd` : command;
|
|
298
|
+
}
|
|
293
299
|
async function shell(command, flags, opts = {}) {
|
|
294
300
|
let child;
|
|
295
301
|
let stdout2 = "";
|
|
296
302
|
let stderr = "";
|
|
297
303
|
try {
|
|
298
|
-
child = spawn(command, flags, {
|
|
304
|
+
child = spawn(resolveCommand(command), flags, {
|
|
299
305
|
cwd: opts.cwd,
|
|
300
|
-
shell: true,
|
|
301
306
|
stdio: opts.stdio,
|
|
302
307
|
timeout: opts.timeout
|
|
303
308
|
});
|
|
304
|
-
const done = new Promise((resolve) =>
|
|
305
|
-
|
|
306
|
-
|
|
309
|
+
const done = new Promise((resolve, reject) => {
|
|
310
|
+
child.once("error", reject);
|
|
311
|
+
child.once("close", () => resolve());
|
|
312
|
+
});
|
|
313
|
+
[stdout2, stderr] = await Promise.all([text(child.stdout), text(child.stderr), done]);
|
|
307
314
|
} catch {
|
|
308
315
|
throw { stdout: stdout2, stderr, exitCode: 1 };
|
|
309
316
|
}
|
|
@@ -452,7 +459,7 @@ function printHelp({
|
|
|
452
459
|
if (headline) {
|
|
453
460
|
message.push(
|
|
454
461
|
linebreak(),
|
|
455
|
-
`${title(commandName)} ${color.green(`v${"5.0.
|
|
462
|
+
`${title(commandName)} ${color.green(`v${"5.0.1"}`)} ${headline}`
|
|
456
463
|
);
|
|
457
464
|
}
|
|
458
465
|
if (usage) {
|
|
@@ -551,7 +558,7 @@ async function getContext(argv) {
|
|
|
551
558
|
packageManager,
|
|
552
559
|
"astro",
|
|
553
560
|
getPackageTag(packageSpecifier),
|
|
554
|
-
"6.0.
|
|
561
|
+
"6.0.5"
|
|
555
562
|
),
|
|
556
563
|
skipHouston,
|
|
557
564
|
fancy,
|