create-astro 3.0.5 → 3.1.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.
Files changed (2) hide show
  1. package/dist/index.js +23 -16
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -16,6 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
19
23
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
20
24
  mod
21
25
  ));
@@ -134,7 +138,8 @@ var require_arg = __commonJS({
134
138
  if (isFlag) {
135
139
  result[argName] = type(true, argName, result[argName]);
136
140
  } else if (argStr === void 0) {
137
- if (argv.length < i + 2 || argv[i + 1].length > 1 && argv[i + 1][0] === "-" && !(argv[i + 1].match(/^-?\d*(\.(?=\d))?\d*$/) && (type === Number || typeof BigInt !== "undefined" && type === BigInt))) {
141
+ if (argv.length < i + 2 || argv[i + 1].length > 1 && argv[i + 1][0] === "-" && !(argv[i + 1].match(/^-?\d*(\.(?=\d))?\d*$/) && (type === Number || // eslint-disable-next-line no-undef
142
+ typeof BigInt !== "undefined" && type === BigInt))) {
138
143
  const extended = originalArgName === argName ? "" : ` (alias for ${argName})`;
139
144
  throw new ArgError(
140
145
  `option requires argument: ${originalArgName}${extended}`,
@@ -189,13 +194,13 @@ var require_which_pm_runs = __commonJS({
189
194
  var import_arg = __toESM(require_arg(), 1);
190
195
  var import_which_pm_runs = __toESM(require_which_pm_runs(), 1);
191
196
  import { prompt } from "@astrojs/cli-kit";
192
- import os from "os";
197
+ import os from "node:os";
193
198
 
194
199
  // src/messages.ts
195
200
  import { color, label, say as houston, spinner as load } from "@astrojs/cli-kit";
196
201
  import { align, sleep } from "@astrojs/cli-kit/utils";
197
- import { exec } from "child_process";
198
- import { get } from "https";
202
+ import { exec } from "node:child_process";
203
+ import { get } from "node:https";
199
204
 
200
205
  // ../../node_modules/.pnpm/ansi-regex@6.0.1/node_modules/ansi-regex/index.js
201
206
  function ansiRegex({ onlyFirst = false } = {}) {
@@ -314,10 +319,11 @@ var nextSteps = async ({ projectDir, devCmd }) => {
314
319
  );
315
320
  await sleep(100);
316
321
  if (projectDir !== "") {
322
+ projectDir = projectDir.includes(" ") ? `"./${projectDir}"` : `./${projectDir}`;
317
323
  const enter = [
318
324
  `
319
325
  ${prefix}Enter your project directory using`,
320
- color.cyan(`cd ./${projectDir}`, "")
326
+ color.cyan(`cd ${projectDir}`, "")
321
327
  ];
322
328
  const len = enter[0].length + stripAnsi(enter[1]).length;
323
329
  log(enter.join(len > max ? "\n" + prefix : " "));
@@ -362,7 +368,7 @@ function printHelp({
362
368
  if (headline) {
363
369
  message.push(
364
370
  linebreak(),
365
- `${title(commandName)} ${color.green(`v${"3.0.5"}`)} ${headline}`
371
+ `${title(commandName)} ${color.green(`v${"3.1.1"}`)} ${headline}`
366
372
  );
367
373
  }
368
374
  if (usage) {
@@ -504,8 +510,8 @@ async function install({ pkgManager, cwd }) {
504
510
  }
505
511
 
506
512
  // src/actions/git.ts
507
- import fs from "fs";
508
- import path from "path";
513
+ import fs from "node:fs";
514
+ import path from "node:path";
509
515
  import { color as color2 } from "@astrojs/cli-kit";
510
516
  import { execa as execa2 } from "execa";
511
517
  async function git(ctx) {
@@ -606,7 +612,7 @@ async function intro(ctx) {
606
612
  }
607
613
 
608
614
  // src/actions/next-steps.ts
609
- import path2 from "path";
615
+ import path2 from "node:path";
610
616
  async function next(ctx) {
611
617
  let projectDir = path2.relative(process.cwd(), ctx.cwd);
612
618
  const devCmd = ctx.pkgManager === "npm" ? "npm run dev" : `${ctx.pkgManager} dev`;
@@ -619,10 +625,10 @@ async function next(ctx) {
619
625
 
620
626
  // src/actions/project-name.ts
621
627
  import { color as color4, generateProjectName } from "@astrojs/cli-kit";
622
- import path3 from "path";
628
+ import path3 from "node:path";
623
629
 
624
630
  // src/actions/shared.ts
625
- import fs2 from "fs";
631
+ import fs2 from "node:fs";
626
632
  var VALID_PROJECT_DIRECTORY_SAFE_LIST = [
627
633
  ".DS_Store",
628
634
  ".git",
@@ -716,8 +722,8 @@ async function checkCwd(cwd) {
716
722
  // src/actions/template.ts
717
723
  import { color as color5 } from "@astrojs/cli-kit";
718
724
  import { downloadTemplate } from "giget";
719
- import fs3 from "fs";
720
- import path4 from "path";
725
+ import fs3 from "node:fs";
726
+ import path4 from "node:path";
721
727
  async function template(ctx) {
722
728
  if (!ctx.template) {
723
729
  const { template: tmpl } = await ctx.prompt({
@@ -806,9 +812,9 @@ async function copyTemplate(tmpl, ctx) {
806
812
 
807
813
  // src/actions/typescript.ts
808
814
  import { color as color6 } from "@astrojs/cli-kit";
809
- import fs4 from "fs";
810
- import { readFile } from "fs/promises";
811
- import path5 from "path";
815
+ import fs4 from "node:fs";
816
+ import { readFile } from "node:fs/promises";
817
+ import path5 from "node:path";
812
818
 
813
819
  // ../../node_modules/.pnpm/strip-json-comments@5.0.0/node_modules/strip-json-comments/index.js
814
820
  var singleComment = Symbol("singleComment");
@@ -999,6 +1005,7 @@ async function main() {
999
1005
  template,
1000
1006
  dependencies,
1001
1007
  typescript,
1008
+ // Steps which write to files need to go above git
1002
1009
  git,
1003
1010
  next
1004
1011
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-astro",
3
- "version": "3.0.5",
3
+ "version": "3.1.1",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -34,7 +34,7 @@
34
34
  "devDependencies": {
35
35
  "@types/which-pm-runs": "^1.0.0",
36
36
  "arg": "^5.0.2",
37
- "astro-scripts": "0.0.12",
37
+ "astro-scripts": "0.0.14",
38
38
  "strip-ansi": "^7.0.1",
39
39
  "strip-json-comments": "^5.0.0",
40
40
  "which-pm-runs": "^1.1.0"