-
Notifications
You must be signed in to change notification settings - Fork 172
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
Add NPM plugin #422
Open
alondahari
wants to merge
8
commits into
1Password:main
Choose a base branch
from
alondahari:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add NPM plugin #422
Commits on Jan 26, 2024
-
This is the initial commit to handle integration with NPM, with the official registry. After running the boiler plate I updated the relevant fields, just enough to do manual testing of the basic use case (npm install). Still left to do: - Parse existing .npmrc file - Define when auth is needed - testing <!-- ps-id: d44814af-d6d4-4fd8-8dc4-62ed0ac06602 -->
Configuration menu - View commit details
-
Copy full SHA for 97667cb - Browse repository at this point
Copy the full SHA 97667cbView commit details -
Add a list of commands that don't require authentication. When running those commands with the cli, the plugin will not try to fetch the token from the vault. I opted for a negative list of commands over a positive one since the latter would end up being much longer, would need to be more complete, and would probably need more updates with time, with newer npm versions. <!-- ps-id: ec70313e-76dd-4aab-811d-196348b499ac -->
Configuration menu - View commit details
-
Copy full SHA for bd53b79 - Browse repository at this point
Copy the full SHA bd53b79View commit details -
Parse token from existing .npmrc
Update the access_token specfication to find the relevant .npmrc config file and create the 1password secret from it when initializing the plugin. <!-- ps-id: e7ddf1fc-f911-475f-9b2c-5b43edd41471 -->
Configuration menu - View commit details
-
Copy full SHA for 3970931 - Browse repository at this point
Copy the full SHA 3970931View commit details -
Parse project level cofig file
The .npmrc can live in the project root, as well as the home directory. Decided to only support the per-project and per-user config files, since the global and the builtin configs should not contain the auth config probably. Reference: https://docs.npmjs.com/cli/v10/configuring-npm/npmrc#global-config-file <!-- ps-id: 362d7c8f-e1ad-4533-882f-e103b3d75caf -->
Configuration menu - View commit details
-
Copy full SHA for df153a5 - Browse repository at this point
Copy the full SHA df153a5View commit details -
NPM packages can live in different registries, not just the official one. This commit adds support for them by setting the env var according to the right backend. To support that, I had to use a temp file and not the env var provisioner, since the key name would be different per registry. I also added support for different scopes along the way. I decided to separate the credentials instead of having a single line ithe 1password vault, to allow users to configure their secrets more easily. <!-- ps-id: 7ec3e696-9c29-4354-bba5-ae4206bc871f -->
Configuration menu - View commit details
-
Copy full SHA for 994299a - Browse repository at this point
Copy the full SHA 994299aView commit details -
Let's support best practice by defaulting to the official npm registry if the secret doesn't contain a host.
Configuration menu - View commit details
-
Copy full SHA for 940bcfa - Browse repository at this point
Copy the full SHA 940bcfaView commit details -
This will be useful when testing the access token
Configuration menu - View commit details
-
Copy full SHA for 5e037aa - Browse repository at this point
Copy the full SHA 5e037aaView commit details -
Add some tests around importing and provisioning the credentials.
Configuration menu - View commit details
-
Copy full SHA for ff754bb - Browse repository at this point
Copy the full SHA ff754bbView commit details
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.