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(
58
58
// lower cadence). We have to assume the user is running against the latest nightly by pointing to the tag.
59
59
return `${ TEMPLATE_PACKAGE_COMMUNITY } @nightly` ;
60
60
}
61
- const templateVersion = await getTemplateVersion ( version ) ;
61
+ const templateVersion = await getTemplateVersion (
62
+ version ,
63
+ options . authToken ,
64
+ ) ;
62
65
return `${ TEMPLATE_PACKAGE_COMMUNITY } @${ templateVersion } ` ;
63
66
}
64
67
Original file line number Diff line number Diff line change @@ -130,10 +130,16 @@ const minorVersion = (version: string) => {
130
130
131
131
export async function getTemplateVersion (
132
132
reactNativeVersion : string ,
133
+ authToken ?: string ,
133
134
) : 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
+ ) ;
137
143
138
144
// We are abusing which npm metadata is publicly available through the registry. Scripts
139
145
// 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