@astrojs/upgrade 0.2.1 → 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.
- package/dist/index.js +13 -5
- 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
|
-
|
|
255
|
+
_registry = stdout2?.trim()?.replace(/\/$/, "") || fallback;
|
|
256
|
+
if (!new URL(_registry).host)
|
|
257
|
+
_registry = fallback;
|
|
252
258
|
} catch (e) {
|
|
253
|
-
|
|
259
|
+
_registry = fallback;
|
|
254
260
|
}
|
|
261
|
+
return _registry;
|
|
255
262
|
}
|
|
256
263
|
var stdout = process.stdout;
|
|
257
264
|
function setStdout(writable) {
|
|
@@ -513,6 +520,7 @@ async function runInstallCommand(ctx, dependencies, devDependencies) {
|
|
|
513
520
|
const cwd = fileURLToPath(ctx.cwd);
|
|
514
521
|
if (ctx.packageManager === "yarn")
|
|
515
522
|
await ensureYarnLock({ cwd });
|
|
523
|
+
const installCmd = ctx.packageManager === "yarn" || ctx.packageManager === "pnpm" ? "add" : "install";
|
|
516
524
|
await spinner({
|
|
517
525
|
start: `Installing dependencies with ${ctx.packageManager}...`,
|
|
518
526
|
end: `Installed dependencies!`,
|
|
@@ -522,7 +530,7 @@ async function runInstallCommand(ctx, dependencies, devDependencies) {
|
|
|
522
530
|
await shell(
|
|
523
531
|
ctx.packageManager,
|
|
524
532
|
[
|
|
525
|
-
|
|
533
|
+
installCmd,
|
|
526
534
|
...dependencies.map(
|
|
527
535
|
({ name, targetVersion }) => `${name}@${targetVersion.replace(/^\^/, "")}`
|
|
528
536
|
)
|
|
@@ -534,7 +542,7 @@ async function runInstallCommand(ctx, dependencies, devDependencies) {
|
|
|
534
542
|
await shell(
|
|
535
543
|
ctx.packageManager,
|
|
536
544
|
[
|
|
537
|
-
|
|
545
|
+
installCmd,
|
|
538
546
|
"--save-dev",
|
|
539
547
|
...devDependencies.map(
|
|
540
548
|
({ name, targetVersion }) => `${name}@${targetVersion.replace(/^\^/, "")}`
|
|
@@ -550,7 +558,7 @@ async function runInstallCommand(ctx, dependencies, devDependencies) {
|
|
|
550
558
|
"error",
|
|
551
559
|
`Dependencies failed to install, please run the following command manually:
|
|
552
560
|
${color2.bold(
|
|
553
|
-
`${ctx.packageManager}
|
|
561
|
+
`${ctx.packageManager} ${installCmd} ${packages}`
|
|
554
562
|
)}`
|
|
555
563
|
);
|
|
556
564
|
return ctx.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/upgrade",
|
|
3
|
-
"version": "0.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": "
|
|
45
|
+
"test": "astro-scripts test \"test/**/*.test.js\""
|
|
48
46
|
}
|
|
49
47
|
}
|