create-astro 5.0.3 → 5.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/index.js +16 -10
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -291,17 +291,22 @@ import { spawn } from "node:child_process";
|
|
|
291
291
|
import { text as textFromStream } from "node:stream/consumers";
|
|
292
292
|
var WINDOWS_CMD_SHIMS = /* @__PURE__ */ new Set(["npm", "npx", "pnpm", "pnpx", "yarn", "yarnpkg", "bun", "bunx"]);
|
|
293
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("."))
|
|
297
|
-
|
|
294
|
+
function resolveCommand(command, flags) {
|
|
295
|
+
if (process.platform !== "win32") return [command, flags];
|
|
296
|
+
if (command.includes("/") || command.includes("\\") || command.includes("."))
|
|
297
|
+
return [command, flags];
|
|
298
|
+
if (WINDOWS_CMD_SHIMS.has(command.toLowerCase())) {
|
|
299
|
+
return ["cmd.exe", ["/d", "/s", "/c", `${command}.cmd`, ...flags]];
|
|
300
|
+
}
|
|
301
|
+
return [command, flags];
|
|
298
302
|
}
|
|
299
303
|
async function shell(command, flags, opts = {}) {
|
|
300
304
|
let child;
|
|
301
305
|
let stdout2 = "";
|
|
302
306
|
let stderr = "";
|
|
303
307
|
try {
|
|
304
|
-
|
|
308
|
+
const [resolvedCommand, resolvedFlags] = resolveCommand(command, flags);
|
|
309
|
+
child = spawn(resolvedCommand, resolvedFlags, {
|
|
305
310
|
cwd: opts.cwd,
|
|
306
311
|
stdio: opts.stdio,
|
|
307
312
|
timeout: opts.timeout
|
|
@@ -311,15 +316,16 @@ async function shell(command, flags, opts = {}) {
|
|
|
311
316
|
child.once("close", () => resolve());
|
|
312
317
|
});
|
|
313
318
|
[stdout2, stderr] = await Promise.all([text(child.stdout), text(child.stderr), done]);
|
|
314
|
-
} catch {
|
|
315
|
-
|
|
319
|
+
} catch (e) {
|
|
320
|
+
const message = e instanceof Error ? e.message : stderr || "Unknown error";
|
|
321
|
+
throw new Error(message);
|
|
316
322
|
}
|
|
317
323
|
const { exitCode } = child;
|
|
318
324
|
if (exitCode === null) {
|
|
319
325
|
throw new Error("Timeout");
|
|
320
326
|
}
|
|
321
327
|
if (exitCode !== 0) {
|
|
322
|
-
throw new Error(stderr);
|
|
328
|
+
throw new Error(stderr || `Process exited with code ${exitCode}`);
|
|
323
329
|
}
|
|
324
330
|
return { stdout: stdout2, stderr, exitCode };
|
|
325
331
|
}
|
|
@@ -459,7 +465,7 @@ function printHelp({
|
|
|
459
465
|
if (headline) {
|
|
460
466
|
message.push(
|
|
461
467
|
linebreak(),
|
|
462
|
-
`${title(commandName)} ${color.green(`v${"5.0.
|
|
468
|
+
`${title(commandName)} ${color.green(`v${"5.0.4"}`)} ${headline}`
|
|
463
469
|
);
|
|
464
470
|
}
|
|
465
471
|
if (usage) {
|
|
@@ -558,7 +564,7 @@ async function getContext(argv) {
|
|
|
558
564
|
packageManager,
|
|
559
565
|
"astro",
|
|
560
566
|
getPackageTag(packageSpecifier),
|
|
561
|
-
"6.
|
|
567
|
+
"6.1.1"
|
|
562
568
|
),
|
|
563
569
|
skipHouston,
|
|
564
570
|
fancy,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-astro",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "withastro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"arg": "^5.0.2",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
33
|
+
"astro-scripts": "0.0.14",
|
|
34
|
+
"@astrojs/internal-helpers": "0.8.0"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=22.12.0"
|