create-astro 5.0.0-beta.4 → 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/create-astro.mjs CHANGED
@@ -3,13 +3,13 @@
3
3
  'use strict';
4
4
 
5
5
  const currentVersion = process.versions.node;
6
- const requiredMajorVersion = parseInt(currentVersion.split('.')[0], 10);
6
+ const requiredMajorVersion = Number.parseInt(currentVersion.split('.')[0], 10);
7
7
  // TODO: remove once Stackblitz supports Node 22
8
8
  const IS_STACKBLITZ = !!process.versions.webcontainer;
9
9
  const minimumMajorVersion = IS_STACKBLITZ ? 20 : 22;
10
10
 
11
11
  if (requiredMajorVersion < minimumMajorVersion) {
12
- console.error(`Node.js v${currentVersion} is out of date and unsupported!`);
12
+ console.error(`Node.js v${currentVersion} is out-of-date and unsupported!`);
13
13
  console.error(`Please use Node.js v${minimumMajorVersion} or higher.`);
14
14
  process.exit(1);
15
15
  }
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  // ../../node_modules/.pnpm/arg@5.0.2/node_modules/arg/index.js
28
28
  var require_arg = __commonJS({
29
29
  "../../node_modules/.pnpm/arg@5.0.2/node_modules/arg/index.js"(exports, module) {
30
- var flagSymbol = Symbol("arg flag");
30
+ var flagSymbol = /* @__PURE__ */ Symbol("arg flag");
31
31
  var ArgError = class _ArgError extends Error {
32
32
  constructor(msg, code) {
33
33
  super(msg);
@@ -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) => child.on("close", resolve));
305
- [stdout2, stderr] = await Promise.all([text(child.stdout), text(child.stderr)]);
306
- await done;
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.0-beta.4"}`)} ${headline}`
462
+ `${title(commandName)} ${color.green(`v${"5.0.1"}`)} ${headline}`
456
463
  );
457
464
  }
458
465
  if (usage) {
@@ -482,7 +489,7 @@ function getPackageTag(packageSpecifier) {
482
489
  case "beta":
483
490
  case "rc":
484
491
  return packageSpecifier;
485
- // Will fallback to latest
492
+ // Will fall back to latest
486
493
  case void 0:
487
494
  default:
488
495
  return void 0;
@@ -537,8 +544,8 @@ async function getContext(argv) {
537
544
  let projectName2 = cwd;
538
545
  if (no) {
539
546
  yes = false;
540
- if (install2 == void 0) install2 = false;
541
- if (git2 == void 0) git2 = false;
547
+ if (install2 === void 0) install2 = false;
548
+ if (git2 === void 0) git2 = false;
542
549
  }
543
550
  skipHouston = (os.platform() === "win32" && !fancy || skipHouston) ?? [yes, no, install2, git2].some((v) => v !== void 0);
544
551
  const { messages, hats, ties } = getSeasonalHouston({ fancy });
@@ -551,7 +558,7 @@ async function getContext(argv) {
551
558
  packageManager,
552
559
  "astro",
553
560
  getPackageTag(packageSpecifier),
554
- "6.0.0-beta.10"
561
+ "6.0.5"
555
562
  ),
556
563
  skipHouston,
557
564
  fancy,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-astro",
3
- "version": "5.0.0-beta.4",
3
+ "version": "5.0.1",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "arg": "^5.0.2",
33
- "@astrojs/internal-helpers": "0.8.0-beta.1",
33
+ "@astrojs/internal-helpers": "0.8.0",
34
34
  "astro-scripts": "0.0.14"
35
35
  },
36
36
  "engines": {