@astrojs/upgrade 0.2.2 → 0.3.0

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 +13 -6
  2. package/package.json +3 -5
package/dist/index.js CHANGED
@@ -170,8 +170,8 @@ var require_arg = __commonJS({
170
170
 
171
171
  // src/actions/context.ts
172
172
  var import_arg = __toESM(require_arg(), 1);
173
- import { prompt } from "@astrojs/cli-kit";
174
173
  import { pathToFileURL } from "node:url";
174
+ import { prompt } from "@astrojs/cli-kit";
175
175
  import detectPackageManager from "which-pm-runs";
176
176
  async function getContext(argv) {
177
177
  const flags = (0, import_arg.default)(
@@ -244,14 +244,21 @@ async function shell(command, flags, opts = {}) {
244
244
  }
245
245
 
246
246
  // src/messages.ts
247
+ var _registry;
247
248
  async function getRegistry() {
249
+ if (_registry)
250
+ return _registry;
251
+ const fallback = "https://registry.npmjs.org";
248
252
  const packageManager = detectPackageManager2()?.name || "npm";
249
253
  try {
250
254
  const { stdout: stdout2 } = await shell(packageManager, ["config", "get", "registry"]);
251
- return stdout2?.trim()?.replace(/\/$/, "") || "https://registry.npmjs.org";
255
+ _registry = stdout2?.trim()?.replace(/\/$/, "") || fallback;
256
+ if (!new URL(_registry).host)
257
+ _registry = fallback;
252
258
  } catch (e) {
253
- return "https://registry.npmjs.org";
259
+ _registry = fallback;
254
260
  }
261
+ return _registry;
255
262
  }
256
263
  var stdout = process.stdout;
257
264
  function setStdout(writable) {
@@ -424,11 +431,11 @@ function help() {
424
431
  }
425
432
 
426
433
  // src/actions/install.ts
427
- import { color as color2, say } from "@astrojs/cli-kit";
428
- import { random, sleep } from "@astrojs/cli-kit/utils";
429
434
  import fs from "node:fs";
430
435
  import path from "node:path";
431
436
  import { fileURLToPath } from "node:url";
437
+ import { color as color2, say } from "@astrojs/cli-kit";
438
+ import { random, sleep } from "@astrojs/cli-kit/utils";
432
439
  async function install(ctx) {
433
440
  await banner();
434
441
  newline();
@@ -568,10 +575,10 @@ async function ensureYarnLock({ cwd }) {
568
575
  }
569
576
 
570
577
  // src/actions/verify.ts
571
- import { color as color3 } from "@astrojs/cli-kit";
572
578
  import dns from "node:dns/promises";
573
579
  import { existsSync } from "node:fs";
574
580
  import { readFile } from "node:fs/promises";
581
+ import { color as color3 } from "@astrojs/cli-kit";
575
582
  import semverCoerce from "semver/functions/coerce.js";
576
583
  import semverDiff from "semver/functions/diff.js";
577
584
  import semverParse from "semver/functions/parse.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/upgrade",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -32,18 +32,16 @@
32
32
  "@types/semver": "^7.5.2",
33
33
  "@types/which-pm-runs": "^1.0.0",
34
34
  "arg": "^5.0.2",
35
- "chai": "^4.3.7",
36
- "mocha": "^10.2.0",
37
35
  "strip-ansi": "^7.1.0",
38
36
  "astro-scripts": "0.0.14"
39
37
  },
40
38
  "engines": {
41
- "node": ">=18.14.1"
39
+ "node": "^18.17.1 || ^20.3.0 || >=21.0.0"
42
40
  },
43
41
  "scripts": {
44
42
  "build": "astro-scripts build \"src/index.ts\" --bundle && tsc",
45
43
  "build:ci": "astro-scripts build \"src/index.ts\" --bundle",
46
44
  "dev": "astro-scripts dev \"src/**/*.ts\"",
47
- "test": "mocha --exit --timeout 20000 --parallel"
45
+ "test": "astro-scripts test \"test/**/*.test.js\""
48
46
  }
49
47
  }