Skip to content

Commit 21891ab

Browse files
committed
add switch to tree-sitter build to update packages with authn
1 parent 15ddbf8 commit 21891ab

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

tree-sitter-dscexpression/.npmrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
; We generally want to save install/update commands
2+
save=true
3+
; We use a public Azure Artifacts mirror
14
registry=https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/npm/registry/
2-
35
always-auth=true
6+
; But we don't want references to it in the lockfile
7+
omit-lockfile-registry-resolved=true

tree-sitter-dscexpression/build.ps1

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT License.
33

4-
# check if tools are installed
4+
param(
5+
[switch]$UpdatePackages
6+
)
57

68
function Invoke-NativeCommand($cmd) {
79
Invoke-Expression $cmd
@@ -32,5 +34,18 @@ if ($LASTEXITCODE -ne 0) {
3234
npm ci tree-sitter-cli --omit=optional
3335
}
3436

37+
if ($UpdatePackages) {
38+
if (!$IsWindows) {
39+
throw "This switch only works on Windows"
40+
}
41+
42+
rm ./package-lock.json
43+
rm -r ./node_modules
44+
npm cache clean --force
45+
npm logout
46+
vsts-npm-auth -config .npmrc -F -V
47+
npm install --force --verbose
48+
}
49+
3550
Invoke-NativeCommand 'npx tree-sitter generate --build'
3651
Invoke-NativeCommand 'npx tree-sitter test'

0 commit comments

Comments
 (0)