diff --git a/packages/cli/src/tools/npm.ts b/packages/cli/src/tools/npm.ts index c090571f1..3ad234a80 100644 --- a/packages/cli/src/tools/npm.ts +++ b/packages/cli/src/tools/npm.ts @@ -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}`; @@ -129,9 +127,9 @@ const minorVersion = (version: string) => { export async function getTemplateVersion( reactNativeVersion: string, ): Promise { - const json = await fetch(TEMPLATE_VERSIONS_URL).then( - (resp) => resp.json() as Promise, - ); + const json = await fetch( + new URL('@react-native-community/template', getNpmRegistryUrl()), + ).then((resp) => resp.json() as Promise); // 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