Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions eng/common/pipelines/templates/jobs/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ jobs:
displayName: 'Packages to be published'

- ${{ if eq(parameters.Registry, 'https://registry.npmjs.org/') }}:

- task: PowerShell@2
displayName: 'Delete repo .npmrc'
condition: and(succeeded(), ne(variables['SkipPublishing'], 'true'))
inputs:
targetType: inline
script: |
$npmrcPath = "$(System.DefaultWorkingDirectory)/.npmrc"
if (Test-Path $npmrcPath) {
Remove-Item -Path $npmrcPath -Force
Write-Host "Deleted $npmrcPath to use default npmjs registry."
} else {
Write-Host "No repo .npmrc found at $npmrcPath."
}
pwsh: true

Comment on lines +73 to +87
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleting the repo-level .npmrc mutates the checked-out sources and can also remove unrelated npm settings (e.g., proxy/strict-ssl) that might be required for network access on some agents. A more deterministic approach is to leave the file alone and force npm view (in the tag verification step) to use ${{ parameters.Registry }} via --registry or NPM_CONFIG_REGISTRY, so the job always queries npmjs regardless of any .npmrc in the repo/workspace.

Suggested change
- task: PowerShell@2
displayName: 'Delete repo .npmrc'
inputs:
targetType: inline
script: |
$npmrcPath = "$(System.DefaultWorkingDirectory)/.npmrc"
if (Test-Path $npmrcPath) {
Remove-Item -Path $npmrcPath -Force
Write-Host "Deleted $npmrcPath to use default npmjs registry."
} else {
Write-Host "No repo .npmrc found at $npmrcPath."
}
pwsh: true

Copilot uses AI. Check for mistakes.
- task: EsrpRelease@9
displayName: 'Publish ${{ parameters.ArtifactName }} via ESRP'
condition: and(succeeded(), ne(variables['SkipPublishing'], 'true'))
Expand Down
Loading