@astrojs/upgrade 0.2.2 → 0.2.3

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 +9 -2
  2. package/package.json +2 -4
package/dist/index.js CHANGED
@@ -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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/upgrade",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -32,8 +32,6 @@
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
  },
@@ -44,6 +42,6 @@
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
  }