cli: pass npm_token for private repos (#2987)
This commit is contained in:
1 parent
26cc87a2ac
commit
5482de08bc
2 files changed
+18
-2
No files matched your search
@@ -110,8 +110,13 @@ function validate(packageName, version, keyword) {
|
||||
|
||||
// Gets the registry of the package. Scoped packages may not be using the global default.
|
||||
const registryUrlOfPackage = registryUrl(scope);
|
||||
|
||||
const response = await fetch(`${registryUrlOfPackage}${packageName}`);
|
||||
let options = {}
|
||||
if (process.env.NPM_TOKEN){
|
||||
options['headers'] = {
|
||||
'Authorization': `Bearer ${process.env.NPM_TOKEN}`,
|
||||
}
|
||||
}
|
||||
const response = await fetch(`${registryUrlOfPackage}${packageName}`, options);
|
||||
const json = await response.json();
|
||||
|
||||
if (json.error && json.error === NOT_FOUND) {
|
||||
|
||||
Reference in new issue
Block a user