Skip to content

Commit 32c074b

Browse files
committed
Explicitly setting $env:NPM_CONFIG_REGISTRY in the “📦 Setup NPM Registry” step.
Making the generated JS do const registry = process.env.NPM_CONFIG_REGISTRY; (and error if it’s missing), instead of trying to inline/concatenate a JSON-escaped registry string.
1 parent 83a3269 commit 32c074b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

build/templates/setup.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ steps:
8383
# and `npx` resolve from the custom registry consistently.
8484
- pwsh: |
8585
$registry = "${{ parameters.customNPMRegistry }}"
86+
$env:NPM_CONFIG_REGISTRY = $registry
8687
$scriptPath = Join-Path "$(Agent.TempDirectory)" 'setup-npm-registry.js'
8788
8889
$lines = @(
@@ -115,7 +116,8 @@ steps:
115116
"",
116117
"async function main() {",
117118
" const root = process.cwd();",
118-
" const registry = process.env.NPM_CONFIG_REGISTRY || " + JSON.stringify($registry) + ";",
119+
" const registry = process.env.NPM_CONFIG_REGISTRY;",
120+
" if (!registry) { throw new Error('NPM_CONFIG_REGISTRY is not set'); }",
119121
"",
120122
" for await (const file of getLockFiles(root)) {",
121123
" await rewrite(file, registry);",

0 commit comments

Comments
 (0)