-
Notifications
You must be signed in to change notification settings - Fork 665
DYN-9590 Update setnpmreg script #16523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-9590
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the PowerShell script used for setting up npm registry configuration. The changes improve the script's functionality by adding authentication token configuration and fixing file formatting.
- Update .npmrc file creation with proper newline formatting
- Add authentication token configuration for Autodesk npm registry
- Remove unnecessary quotes around parameter values for cleaner syntax
if ($response.StatusCode -eq 200) { | ||
Write-Host "adsk npm registry is reachable" -ForegroundColor Green | ||
createNpmrcFile -registry $adskNpmRegistry | ||
Write-Output "//npm.autodesk.com/artifactory/api/npm/:_authToken=\`${NPM_TOKEN}" | Out-File -Append -FilePath .npmrc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The authentication token is being written to the .npmrc file without validation that the NPM_TOKEN environment variable exists. This could result in a malformed .npmrc file with 'undefined' or empty token values. Consider adding a check to ensure NPM_TOKEN is set before writing the auth configuration.
Write-Output "//npm.autodesk.com/artifactory/api/npm/:_authToken=\`${NPM_TOKEN}" | Out-File -Append -FilePath .npmrc | |
if (-not $env:NPM_TOKEN) { | |
Write-Host "ERROR: NPM_TOKEN environment variable is not set. Cannot write authentication token to .npmrc." -ForegroundColor Red | |
exit 1 | |
} | |
Write-Output "//npm.autodesk.com/artifactory/api/npm/:_authToken=${env:NPM_TOKEN}" | Out-File -Append -FilePath .npmrc |
Copilot uses AI. Check for mistakes.
Purpose
Update setnpmreg script
Declarations
Check these if you believe they are true
Release Notes
N/A
Reviewers
(FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR)
(FILL ME IN, optional) Any additional notes to reviewers or testers.
FYIs
(FILL ME IN, Optional) Names of anyone else you wish to be notified of