create-astro 4.0.1 → 4.0.2

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.
Files changed (2) hide show
  1. package/dist/index.js +17 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -388,7 +388,7 @@ function printHelp({
388
388
  if (headline) {
389
389
  message.push(
390
390
  linebreak(),
391
- `${title(commandName)} ${color.green(`v${"4.0.1"}`)} ${headline}`
391
+ `${title(commandName)} ${color.green(`v${"4.0.2"}`)} ${headline}`
392
392
  );
393
393
  }
394
394
  if (usage) {
@@ -434,7 +434,7 @@ async function getContext(argv) {
434
434
  },
435
435
  { argv, permissive: true }
436
436
  );
437
- const pkgManager = detectPackageManager2()?.name ?? "npm";
437
+ const packageManager = detectPackageManager2()?.name ?? "npm";
438
438
  const [username, version] = await Promise.all([getName(), getVersion()]);
439
439
  let cwd = flags["_"][0];
440
440
  let {
@@ -466,7 +466,7 @@ async function getContext(argv) {
466
466
  const context = {
467
467
  help: help2,
468
468
  prompt,
469
- pkgManager,
469
+ packageManager,
470
470
  username,
471
471
  version,
472
472
  skipHouston,
@@ -508,15 +508,15 @@ async function dependencies(ctx) {
508
508
  await info("--dry-run", `Skipping dependency installation`);
509
509
  } else if (deps) {
510
510
  await spinner({
511
- start: `Installing dependencies with ${ctx.pkgManager}...`,
511
+ start: `Installing dependencies with ${ctx.packageManager}...`,
512
512
  end: "Dependencies installed",
513
513
  while: () => {
514
- return install({ pkgManager: ctx.pkgManager, cwd: ctx.cwd }).catch((e) => {
514
+ return install({ packageManager: ctx.packageManager, cwd: ctx.cwd }).catch((e) => {
515
515
  error("error", e);
516
516
  error(
517
517
  "error",
518
518
  `Dependencies failed to install, please run ${color2.bold(
519
- ctx.pkgManager + " install"
519
+ ctx.packageManager + " install"
520
520
  )} to install them manually after setup.`
521
521
  );
522
522
  });
@@ -529,10 +529,10 @@ async function dependencies(ctx) {
529
529
  );
530
530
  }
531
531
  }
532
- async function install({ pkgManager, cwd }) {
533
- if (pkgManager === "yarn")
532
+ async function install({ packageManager, cwd }) {
533
+ if (packageManager === "yarn")
534
534
  await ensureYarnLock({ cwd });
535
- return shell(pkgManager, ["install"], { cwd, timeout: 9e4, stdio: "ignore" });
535
+ return shell(packageManager, ["install"], { cwd, timeout: 9e4, stdio: "ignore" });
536
536
  }
537
537
  async function ensureYarnLock({ cwd }) {
538
538
  const yarnLock = path.join(cwd, "yarn.lock");
@@ -650,7 +650,13 @@ async function intro(ctx) {
650
650
  import path3 from "node:path";
651
651
  async function next(ctx) {
652
652
  let projectDir = path3.relative(process.cwd(), ctx.cwd);
653
- const devCmd = ctx.pkgManager === "npm" ? "npm run dev" : ctx.pkgManager === "bun" ? "bun run dev" : `${ctx.pkgManager} dev`;
653
+ const commandMap = {
654
+ npm: "npm run dev",
655
+ bun: "bun run dev",
656
+ yarn: "yarn dev",
657
+ pnpm: "pnpm dev"
658
+ };
659
+ const devCmd = commandMap[ctx.packageManager] || "npm run dev";
654
660
  await nextSteps({ projectDir, devCmd });
655
661
  if (!ctx.skipHouston) {
656
662
  await say(["Good luck out there, astronaut! \u{1F680}"]);
@@ -730,7 +736,7 @@ async function projectName(ctx) {
730
736
  return true;
731
737
  }
732
738
  });
733
- ctx.cwd = name;
739
+ ctx.cwd = name.trim();
734
740
  ctx.projectName = toValidName(name);
735
741
  } else {
736
742
  let name = ctx.cwd;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-astro",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",