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: Remove hardcoded npm registry url #2520

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 3 additions & 5 deletions packages/cli/src/tools/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ class Template {
}
}

const TEMPLATE_VERSIONS_URL =
'https://registry.npmjs.org/@react-native-community/template';
const minorVersion = (version: string) => {
const v = semver.parse(version)!;
return `${v.major}.${v.minor}`;
Expand All @@ -129,9 +127,9 @@ const minorVersion = (version: string) => {
export async function getTemplateVersion(
reactNativeVersion: string,
): Promise<TemplateVersion | undefined> {
const json = await fetch(TEMPLATE_VERSIONS_URL).then(
(resp) => resp.json() as Promise<NpmTemplateResponse>,
);
const json = await fetch(
new URL('@react-native-community/template', getNpmRegistryUrl()),
).then((resp) => resp.json() as Promise<NpmTemplateResponse>);

// We are abusing which npm metadata is publicly available through the registry. Scripts
// is always captured, and we use this in the Github Action that manages our releases to
Expand Down
Loading