Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pnpm failure on create-astro #7435

Merged
merged 4 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/clever-rings-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-astro': patch
---

Fix registry failures using unexpected package managers when running create-astro
5 changes: 2 additions & 3 deletions packages/create-astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this was a dev dep... it's definitely shipped with create-astro 🤷

"strip-json-comments": "^5.0.0"
},
"engines": {
"node": ">=16.12.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/create-astro/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down
9 changes: 3 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.