create-astro 3.2.2 → 4.0.0-beta.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 +8 -12
  2. package/package.json +6 -5
package/dist/index.js CHANGED
@@ -28,12 +28,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var require_arg = __commonJS({
29
29
  "../../node_modules/.pnpm/arg@5.0.2/node_modules/arg/index.js"(exports, module) {
30
30
  var flagSymbol = Symbol("arg flag");
31
- var ArgError = class extends Error {
31
+ var ArgError = class _ArgError extends Error {
32
32
  constructor(msg, code) {
33
33
  super(msg);
34
34
  this.name = "ArgError";
35
35
  this.code = code;
36
- Object.setPrototypeOf(this, ArgError.prototype);
36
+ Object.setPrototypeOf(this, _ArgError.prototype);
37
37
  }
38
38
  };
39
39
  function arg2(opts, {
@@ -234,11 +234,10 @@ async function shell(command, flags, opts = {}) {
234
234
 
235
235
  // src/messages.ts
236
236
  async function getRegistry() {
237
- var _a, _b;
238
- const packageManager = ((_a = detectPackageManager()) == null ? void 0 : _a.name) || "npm";
237
+ const packageManager = detectPackageManager()?.name || "npm";
239
238
  try {
240
239
  const { stdout: stdout2 } = await shell(packageManager, ["config", "get", "registry"]);
241
- return ((_b = stdout2 == null ? void 0 : stdout2.trim()) == null ? void 0 : _b.replace(/\/$/, "")) || "https://registry.npmjs.org";
240
+ return stdout2?.trim()?.replace(/\/$/, "") || "https://registry.npmjs.org";
242
241
  } catch (e) {
243
242
  return "https://registry.npmjs.org";
244
243
  }
@@ -389,7 +388,7 @@ function printHelp({
389
388
  if (headline) {
390
389
  message.push(
391
390
  linebreak(),
392
- `${title(commandName)} ${color.green(`v${"3.2.2"}`)} ${headline}`
391
+ `${title(commandName)} ${color.green(`v${"4.0.0-beta.1"}`)} ${headline}`
393
392
  );
394
393
  }
395
394
  if (usage) {
@@ -414,7 +413,6 @@ function printHelp({
414
413
 
415
414
  // src/actions/context.ts
416
415
  async function getContext(argv) {
417
- var _a;
418
416
  const flags = (0, import_arg.default)(
419
417
  {
420
418
  "--template": String,
@@ -436,7 +434,7 @@ async function getContext(argv) {
436
434
  },
437
435
  { argv, permissive: true }
438
436
  );
439
- const pkgManager = ((_a = detectPackageManager2()) == null ? void 0 : _a.name) ?? "npm";
437
+ const pkgManager = detectPackageManager2()?.name ?? "npm";
440
438
  const [username, version] = await Promise.all([getName(), getVersion()]);
441
439
  let cwd = flags["_"][0];
442
440
  let {
@@ -799,8 +797,7 @@ async function template(ctx) {
799
797
  var FILES_TO_REMOVE = ["sandbox.config.json", "CHANGELOG.md"];
800
798
  var FILES_TO_UPDATE = {
801
799
  "package.json": (file, overrides) => fs4.promises.readFile(file, "utf-8").then((value) => {
802
- var _a;
803
- const indent = ((_a = /(^\s+)/m.exec(value)) == null ? void 0 : _a[1]) ?? " ";
800
+ const indent = /(^\s+)/m.exec(value)?.[1] ?? " ";
804
801
  fs4.promises.writeFile(
805
802
  file,
806
803
  JSON.stringify(
@@ -1085,8 +1082,7 @@ async function verifyTemplate(tmpl, ref) {
1085
1082
  }
1086
1083
  var GIT_RE = /^(?<repo>[\w.-]+\/[\w.-]+)(?<subdir>[^#]+)?(?<ref>#[\w.-]+)?/;
1087
1084
  function parseGitURI(input) {
1088
- var _a;
1089
- const m = (_a = input.match(GIT_RE)) == null ? void 0 : _a.groups;
1085
+ const m = input.match(GIT_RE)?.groups;
1090
1086
  if (!m)
1091
1087
  throw new Error(`Unable to parse "${input}"`);
1092
1088
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-astro",
3
- "version": "3.2.2",
3
+ "version": "4.0.0-beta.1",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -26,21 +26,22 @@
26
26
  "//b": "DEPENDENCIES IS FOR UNBUNDLED PACKAGES",
27
27
  "dependencies": {
28
28
  "@astrojs/cli-kit": "^0.2.3",
29
- "giget": "^1.1.2",
29
+ "chai": "^4.3.7",
30
+ "execa": "^6.1.0",
31
+ "giget": "1.0.0",
32
+ "mocha": "^9.2.2",
30
33
  "node-fetch-native": "^1.2.0",
31
34
  "which-pm-runs": "^1.1.0"
32
35
  },
33
36
  "devDependencies": {
34
37
  "@types/which-pm-runs": "^1.0.0",
35
- "chai": "^4.3.7",
36
- "mocha": "^9.2.2",
37
38
  "arg": "^5.0.2",
38
39
  "strip-ansi": "^7.1.0",
39
40
  "strip-json-comments": "^5.0.0",
40
41
  "astro-scripts": "0.0.14"
41
42
  },
42
43
  "engines": {
43
- "node": ">=16.12.0"
44
+ "node": ">=18.14.1"
44
45
  },
45
46
  "scripts": {
46
47
  "build": "astro-scripts build \"src/index.ts\" --bundle && tsc",