create-astro 3.1.6 → 3.1.7

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 +18 -9
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -199,8 +199,10 @@ import os from "node:os";
199
199
  // src/messages.ts
200
200
  import { color, label, say as houston, spinner as load } from "@astrojs/cli-kit";
201
201
  import { align, sleep } from "@astrojs/cli-kit/utils";
202
+ import { execa } from "execa";
202
203
  import { exec } from "node:child_process";
203
204
  import { get } from "node:https";
205
+ import preferredPM from "preferred-pm";
204
206
 
205
207
  // ../../node_modules/.pnpm/ansi-regex@6.0.1/node_modules/ansi-regex/index.js
206
208
  function ansiRegex({ onlyFirst = false } = {}) {
@@ -220,6 +222,12 @@ function stripAnsi(string) {
220
222
  }
221
223
 
222
224
  // src/messages.ts
225
+ async function getRegistry() {
226
+ var _a;
227
+ const packageManager = ((_a = await preferredPM(process.cwd())) == null ? void 0 : _a.name) || "npm";
228
+ const { stdout: stdout2 } = await execa(packageManager, ["config", "get", "registry"]);
229
+ return stdout2 || "https://registry.npmjs.org";
230
+ }
223
231
  var stdout = process.stdout;
224
232
  function setStdout(writable) {
225
233
  stdout = writable;
@@ -265,10 +273,11 @@ var getName = () => new Promise((resolve) => {
265
273
  });
266
274
  });
267
275
  var v;
268
- var getVersion = () => new Promise((resolve) => {
276
+ var getVersion = () => new Promise(async (resolve) => {
269
277
  if (v)
270
278
  return resolve(v);
271
- get("https://registry.npmjs.org/astro/latest", (res) => {
279
+ const registry = await getRegistry();
280
+ get(`${registry}/astro/latest`, (res) => {
272
281
  let body = "";
273
282
  res.on("data", (chunk) => body += chunk);
274
283
  res.on("end", () => {
@@ -368,7 +377,7 @@ function printHelp({
368
377
  if (headline) {
369
378
  message.push(
370
379
  linebreak(),
371
- `${title(commandName)} ${color.green(`v${"3.1.6"}`)} ${headline}`
380
+ `${title(commandName)} ${color.green(`v${"3.1.7"}`)} ${headline}`
372
381
  );
373
382
  }
374
383
  if (usage) {
@@ -469,7 +478,7 @@ async function getContext(argv) {
469
478
 
470
479
  // src/actions/dependencies.ts
471
480
  import { color as color2 } from "@astrojs/cli-kit";
472
- import { execa } from "execa";
481
+ import { execa as execa2 } from "execa";
473
482
  async function dependencies(ctx) {
474
483
  let deps = ctx.install ?? ctx.yes;
475
484
  if (deps === void 0) {
@@ -509,7 +518,7 @@ async function dependencies(ctx) {
509
518
  }
510
519
  }
511
520
  async function install({ pkgManager, cwd }) {
512
- const installExec = execa(pkgManager, ["install"], { cwd });
521
+ const installExec = execa2(pkgManager, ["install"], { cwd });
513
522
  return new Promise((resolve, reject) => {
514
523
  setTimeout(() => reject(`Request timed out after one minute`), 6e4);
515
524
  installExec.on("error", (e) => reject(e));
@@ -521,7 +530,7 @@ async function install({ pkgManager, cwd }) {
521
530
  import fs from "node:fs";
522
531
  import path from "node:path";
523
532
  import { color as color3 } from "@astrojs/cli-kit";
524
- import { execa as execa2 } from "execa";
533
+ import { execa as execa3 } from "execa";
525
534
  async function git(ctx) {
526
535
  if (fs.existsSync(path.join(ctx.cwd, ".git"))) {
527
536
  await info("Nice!", `Git has already been initialized`);
@@ -558,9 +567,9 @@ async function git(ctx) {
558
567
  }
559
568
  async function init({ cwd }) {
560
569
  try {
561
- await execa2("git", ["init"], { cwd, stdio: "ignore" });
562
- await execa2("git", ["add", "-A"], { cwd, stdio: "ignore" });
563
- await execa2(
570
+ await execa3("git", ["init"], { cwd, stdio: "ignore" });
571
+ await execa3("git", ["add", "-A"], { cwd, stdio: "ignore" });
572
+ await execa3(
564
573
  "git",
565
574
  [
566
575
  "commit",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-astro",
3
- "version": "3.1.6",
3
+ "version": "3.1.7",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -29,7 +29,8 @@
29
29
  "chai": "^4.3.6",
30
30
  "execa": "^6.1.0",
31
31
  "giget": "1.0.0",
32
- "mocha": "^9.2.2"
32
+ "mocha": "^9.2.2",
33
+ "preferred-pm": "^3.0.3"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@types/which-pm-runs": "^1.0.0",