Skip to content

Commit fd73ff2

Browse files
authored
[Infrastructure] Update the dependency management script to automatically install vsts-npm-auth and provision a PAT (#56187)
* Automatically provision a token when running the script * Install vsts-auth if not present
1 parent 0991dc1 commit fd73ff2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

eng/scripts/update-npm-dependencies.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,24 @@ if (-not $WhatIf) {
1717
Remove-Item .\package-lock.json
1818
}
1919

20+
try {
21+
Get-Command vsts-npm-auth -CommandType ExternalScript
22+
Write-Host "vsts-npm-auth is already installed"
23+
}
24+
catch {
25+
Write-Host "Installing vsts-npm-auth"
26+
if (-not $WhatIf) {
27+
npm install -g vsts-npm-auth
28+
}
29+
}
30+
31+
Write-Host "Provisioning a token for the NPM registry. You might be prompted to authenticate."
32+
if (-not $WhatIf) {
33+
# This command provisions a PAT token for the VSTS NPM registry that lasts for 15 minutes, which is more than enough time to run npm install
34+
# and ensure any missing package is mirrored.
35+
vsts-npm-auth -E 15 -F -C .\.npmrc
36+
}
37+
2038
Write-Host "Running npm install"
2139
if (-not $WhatIf) {
2240
npm install --prefer-online --include optional

0 commit comments

Comments
 (0)