Decouple NpmAuthenticateV0 from packaging-common/npm modules#21911
Open
Decouple NpmAuthenticateV0 from packaging-common/npm modules#21911
Conversation
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
packaging-common/npm/ is a shared package consumed by three tasks: NpmAuthenticateV0, NpmV1, and DownloadGitHubNpmPackageV1. Despite being "shared," each task uses a different subset of the package. The shared abstraction adds dependency coupling and test complexity without meaningful code reuse. This PR will decouple the dependency on a package from the separate repo, while providing the same utility in an improved manner.
Task Name
NpmAuthenticateV0
Description
What changed:
Inlined registry parsing, URL normalization, credential formatting, and file I/O (~120 lines replacing 3 external module imports)
Replaced the NpmRegistry class with a local NpmrcCredential interface
Extracted credential resolution into npmrcCredential.ts and backup management into npmrcBackupManager.ts
Consolidated the duplicated WIF auth branches into a single check
Improved variable naming throughout (endpointsArray → previouslyAuthenticatedUrls, registry → npmrcEntry, etc.)
Rewrote tests to exercise real code paths instead of mocking our own logic
The only remaining packaging-common dependency is locationUtilities (for Azure DevOps service location), which is a general-purpose module used across many tasks.
Risk Assessment (Low / Medium / High)
Medium
Change Behind Feature Flag (Yes / No)
Can this change be behine feature flag, if not why?
Tech Design / Approach
Documentation Changes Required (Yes/No)
Indicate whether related documentation needs to be updated.
N/A
Unit Tests Added or Updated (Yes / No)
Indicate whether unit tests were added or modified to reflect these changes.
Y
Additional Testing Performed
List all other tests performed (manual or automated, including integration, regression, scenario tests, etc.).
Local, E2E, Testing Pipelines
Logging Added/Updated (Yes/No)
Y
Telemetry Added/Updated (Yes/No)
N
Rollback Scenario and Process (Yes/No)
Rollback via task override can be applied to revert to a previous version
Dependency Impact Assessed and Regression Tested (Yes/No)
Y
Checklist