create-astro 4.0.0 → 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.
- package/dist/index.js +18 -12
- 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.
|
|
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
|
|
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
|
-
|
|
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.
|
|
511
|
+
start: `Installing dependencies with ${ctx.packageManager}...`,
|
|
512
512
|
end: "Dependencies installed",
|
|
513
513
|
while: () => {
|
|
514
|
-
return install({
|
|
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.
|
|
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({
|
|
533
|
-
if (
|
|
532
|
+
async function install({ packageManager, cwd }) {
|
|
533
|
+
if (packageManager === "yarn")
|
|
534
534
|
await ensureYarnLock({ cwd });
|
|
535
|
-
return shell(
|
|
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
|
|
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;
|
|
@@ -799,7 +805,7 @@ async function template(ctx) {
|
|
|
799
805
|
ctx.exit(1);
|
|
800
806
|
}
|
|
801
807
|
}
|
|
802
|
-
var FILES_TO_REMOVE = ["
|
|
808
|
+
var FILES_TO_REMOVE = ["CHANGELOG.md", ".codesandbox"];
|
|
803
809
|
var FILES_TO_UPDATE = {
|
|
804
810
|
"package.json": (file, overrides) => fs4.promises.readFile(file, "utf-8").then((value) => {
|
|
805
811
|
const indent = /(^\s+)/m.exec(value)?.[1] ?? " ";
|