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

Use npm registry from npm config for fetching templates. #2573

Open
LvChengbin opened this issue Jan 4, 2025 · 1 comment
Open

Use npm registry from npm config for fetching templates. #2573

LvChengbin opened this issue Jan 4, 2025 · 1 comment

Comments

@LvChengbin
Copy link

The registry from npm config should be used while fetching templates.

image

const TEMPLATE_VERSIONS_URL =

@szymonrybczak
Copy link
Collaborator

szymonrybczak commented Jan 7, 2025

hey, @LvChengbin. good call, do you mind contributing this change? We should have some helpers for getting the npm registry:

export const getNpmRegistryUrl = (() => {
// Lazily resolve npm registry url since it is only needed when initializing a
// new project.
let registryUrl = '';
return () => {
if (!registryUrl) {
try {
registryUrl = execSync(
'npm config get registry --workspaces=false --include-workspace-root',
)
.toString()
.trim();
} catch {
registryUrl = 'https://registry.npmjs.org/';
}
}
return registryUrl;
};
})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants