File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,10 @@ export async function createTemplateUri(
5858 // lower cadence). We have to assume the user is running against the latest nightly by pointing to the tag.
5959 return `${ TEMPLATE_PACKAGE_COMMUNITY } @nightly` ;
6060 }
61- const templateVersion = await getTemplateVersion ( version ) ;
61+ const templateVersion = await getTemplateVersion (
62+ version ,
63+ options . authToken ,
64+ ) ;
6265 return `${ TEMPLATE_PACKAGE_COMMUNITY } @${ templateVersion } ` ;
6366 }
6467
Original file line number Diff line number Diff line change @@ -130,10 +130,16 @@ const minorVersion = (version: string) => {
130130
131131export async function getTemplateVersion (
132132 reactNativeVersion : string ,
133+ authToken ?: string ,
133134) : Promise < TemplateVersion | undefined > {
134- const json = await fetch (
135- new URL ( '@react-native-community/template' , getNpmRegistryUrl ( ) ) ,
136- ) . then ( ( resp ) => resp . json ( ) as Promise < NpmTemplateResponse > ) ;
135+ const url = new URL ( getNpmRegistryUrl ( ) ) ;
136+ url . pathname = `${ url . pathname } @react-native-community/template` ;
137+ const headers = authToken
138+ ? { Authorization : `Bearer ${ authToken } ` }
139+ : undefined ;
140+ const json = await fetch ( url , { headers} ) . then (
141+ ( resp ) => resp . json ( ) as Promise < NpmTemplateResponse > ,
142+ ) ;
137143
138144 // We are abusing which npm metadata is publicly available through the registry. Scripts
139145 // is always captured, and we use this in the Github Action that manages our releases to
You can’t perform that action at this time.
0 commit comments