-
Notifications
You must be signed in to change notification settings - Fork 41
feat(ENG-13679): NPM Credential Helper #367
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
1d0196b
npm credential helper
tigh-latte 8631b11
exit code on any failure. update tests to cover this case
tigh-latte 6dfa7a2
remove a few dockers to npms
tigh-latte 50a4535
Rename `InstallError` to `PartialInstallError`
tigh-latte 4d80cda
more generic docs for credential helper
tigh-latte 9de97f3
better help text formatting
tigh-latte 39fab64
copilot feedback
tigh-latte 357a9f7
better doc strings
tigh-latte a8198ee
tests for the npmrc object
tigh-latte 5d8c1dc
changelog entry
tigh-latte ad13e3c
fix leading whitespace bug, and doc clarification around pnpm
tigh-latte c043407
Exclude nested test packages from wheel builds
tigh-latte 522cc24
fix npm test
tigh-latte 632fc75
more specific function name for npm cred fetcher
tigh-latte e24c116
fix code ql check
tigh-latte c5ffd8b
remove not in PATH warning for npm credential helper install, as pnpm…
tigh-latte b1ccd01
more extensive tests around npmrc file handling
tigh-latte b2db9f2
fix: pr feedback
tigh-latte f17b63c
fix: update tokenHelper executable path if a new bin-dir is provided
tigh-latte 99bd6f2
fix: update all references of npm to pnpm
tigh-latte 5bfa3b1
update changelog to reflect pnpm naming instead of npm
tigh-latte File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # Copyright 2026 Cloudsmith Ltd | ||
| """ | ||
|
Copilot marked this conversation as resolved.
|
||
| pnpm credential helper command. | ||
|
|
||
| Implements the pnpm credential helper protocol for Cloudsmith registries. | ||
| """ | ||
|
|
||
| import sys | ||
|
|
||
| import click | ||
|
|
||
| from ....credential_helpers.pnpm import execute | ||
| from ...decorators import common_api_auth_options, resolve_credentials | ||
|
|
||
|
|
||
| @click.command() | ||
| @click.argument("repo", required=False, default="npm.cloudsmith.io") | ||
| @common_api_auth_options | ||
| @resolve_credentials | ||
| def pnpm(opts, repo): | ||
| """ | ||
| Input (arg, optional): | ||
| Server URL as plain text (e.g. "npm.cloudsmith.io") | ||
|
|
||
| Output (stdout): | ||
| Text: <cloudsmith-token> | ||
|
|
||
| \b | ||
| Exit codes: | ||
| 0: Success | ||
| 1: Error (no credentials available, not a Cloudsmith registry, etc.) | ||
|
|
||
| \b | ||
| Environment variables: | ||
| CLOUDSMITH_API_KEY: API key for authentication (optional) | ||
| CLOUDSMITH_ORG: Organisation slug (required for custom domain support) | ||
| """ | ||
|
|
||
| exit_code, stdout, stderr = execute( | ||
| repo, | ||
| credential=opts.credential, | ||
| api_host=opts.api_host, | ||
| org=opts.org, | ||
| ) | ||
|
|
||
| if stdout is not None: | ||
| click.echo(stdout, nl=False) | ||
| if stderr is not None: | ||
| click.echo(stderr, err=True) | ||
|
|
||
| sys.exit(exit_code) | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.