summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ben Holmes <hey@bholmes.dev> 2023-06-21 16:02:20 -0400
committerGravatar GitHub <noreply@github.com> 2023-06-21 16:02:20 -0400
commit3f9f5c117e4e9e4a0c0a648cb6db9a3073cd5727 (patch)
tree3d81494762cf6a80cf9d5f1cc96b59c9f5b1bf06
parent30bb363713e3d2c50d0d4816d970aa93b836a3b0 (diff)
downloadastro-3f9f5c117e4e9e4a0c0a648cb6db9a3073cd5727.tar.gz
astro-3f9f5c117e4e9e4a0c0a648cb6db9a3073cd5727.tar.zst
astro-3f9f5c117e4e9e4a0c0a648cb6db9a3073cd5727.zip
fix: `pnpm` failure on `create-astro` (#7435)
* fix: use which-pm-runs instead of preferred-pm * deps: remove preferred-pm * chore: move which-pm-runs to regular deps * chore: changeset
-rw-r--r--.changeset/clever-rings-draw.md5
-rw-r--r--packages/create-astro/package.json5
-rw-r--r--packages/create-astro/src/messages.ts4
-rw-r--r--pnpm-lock.yaml9
4 files changed, 12 insertions, 11 deletions
diff --git a/.changeset/clever-rings-draw.md b/.changeset/clever-rings-draw.md
new file mode 100644
index 000000000..e6a474f91
--- /dev/null
+++ b/.changeset/clever-rings-draw.md
@@ -0,0 +1,5 @@
+---
+'create-astro': patch
+---
+
+Fix registry failures using unexpected package managers when running create-astro
diff --git a/packages/create-astro/package.json b/packages/create-astro/package.json
index fd975ef49..8737baeec 100644
--- a/packages/create-astro/package.json
+++ b/packages/create-astro/package.json
@@ -36,15 +36,14 @@
"execa": "^6.1.0",
"giget": "1.0.0",
"mocha": "^9.2.2",
- "preferred-pm": "^3.0.3"
+ "which-pm-runs": "^1.1.0"
},
"devDependencies": {
"@types/which-pm-runs": "^1.0.0",
"arg": "^5.0.2",
"astro-scripts": "workspace:*",
"strip-ansi": "^7.1.0",
- "strip-json-comments": "^5.0.0",
- "which-pm-runs": "^1.1.0"
+ "strip-json-comments": "^5.0.0"
},
"engines": {
"node": ">=16.12.0"
diff --git a/packages/create-astro/src/messages.ts b/packages/create-astro/src/messages.ts
index cea1f0bdc..2f8ca960b 100644
--- a/packages/create-astro/src/messages.ts
+++ b/packages/create-astro/src/messages.ts
@@ -4,15 +4,15 @@ import { align, sleep } from '@astrojs/cli-kit/utils';
import { execa } from 'execa';
import { exec } from 'node:child_process';
import { get } from 'node:https';
-import preferredPM from 'preferred-pm';
import stripAnsi from 'strip-ansi';
+import detectPackageManager from 'which-pm-runs';
// Users might lack access to the global npm registry, this function
// checks the user's project type and will return the proper npm registry
//
// A copy of this function also exists in the astro package
async function getRegistry(): Promise<string> {
- const packageManager = (await preferredPM(process.cwd()))?.name || 'npm';
+ const packageManager = detectPackageManager()?.name || 'npm';
const { stdout } = await execa(packageManager, ['config', 'get', 'registry']);
return stdout || 'https://registry.npmjs.org';
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 739cf8997..3e3539ef7 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -3577,9 +3577,9 @@ importers:
mocha:
specifier: ^9.2.2
version: 9.2.2
- preferred-pm:
- specifier: ^3.0.3
- version: 3.0.3
+ which-pm-runs:
+ specifier: ^1.1.0
+ version: 1.1.0
devDependencies:
'@types/which-pm-runs':
specifier: ^1.0.0
@@ -3596,9 +3596,6 @@ importers:
strip-json-comments:
specifier: ^5.0.0
version: 5.0.0
- which-pm-runs:
- specifier: ^1.1.0
- version: 1.1.0
packages/create-astro/test/fixtures/not-empty: {}