Skip to content

Conversation

avidit
Copy link
Contributor

@avidit avidit commented Sep 25, 2025

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

@Copilot Copilot AI review requested due to automatic review settings September 25, 2025 16:06
@avidit avidit added the WIP label Sep 25, 2025
@github-actions github-actions bot changed the title DYN-9550 Update setnpmreg script 9590: DYN-9550 Update setnpmreg script Sep 25, 2025
Copy link

@github-actions github-actions bot left a 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

Copy link
Contributor

@Copilot Copilot AI left a 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
Copy link

Copilot AI Sep 25, 2025

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.

Suggested change
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.

@avidit avidit changed the title 9590: DYN-9550 Update setnpmreg script DYN-9550 Update setnpmreg script Sep 26, 2025
@github-actions github-actions bot changed the title DYN-9550 Update setnpmreg script 9590: DYN-9550 Update setnpmreg script Sep 26, 2025
@avidit avidit changed the title 9590: DYN-9550 Update setnpmreg script DYN-9550: Update setnpmreg script Sep 26, 2025
@github-actions github-actions bot changed the title DYN-9550: Update setnpmreg script 9590: DYN-9550: Update setnpmreg script Sep 26, 2025
@avidit avidit changed the title 9590: DYN-9550: Update setnpmreg script DYN-9590 Update setnpmreg script Sep 26, 2025
@zeusongit
Copy link
Contributor

@avidit is this still needed?

@avidit
Copy link
Contributor Author

avidit commented Oct 6, 2025

@avidit is this still needed?

I believe so, for pullRequestValidation jobs and dev boxes, after anonymous access is restricted

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious where is the NPM_TOKEN is set?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@avidit avidit Oct 9, 2025

Choose a reason for hiding this comment

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

We can set NPM_TOKEN env variable in CI environment. In dev machines we would need to do npm login --registry https://npm.autodesk.com/artifactory/api/npm/autodesk-npm-virtual --auth-type web. I am still waiting for the next test window to verify this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants