devops-npmrc v1.0.5
DevOps .npmrc
CLI
CLI tool for adding Azure DevOps artifact feed to .npmrc on unix based systems like macOS or Linux.
Works for both
npm
andyarn
.
Prerequisites
To use the tool you will need:
- DevOps organization name
- DevOps artifact feed name
- A personal access token (global file only)
Find the name of your
organization
andfeed
- Go to https://dev.azure.com/ and log in to your organization.
- Select the project where your feed is located and navigate to
Artifacts
in the menu to the left. - Select the feed you wish to add to
.npmrc
from the dropdown menu in the top left corner. - Retrieve
organization
andfeed
from the url:dev.azure.com/<organization>/Your.Project/_artifacts/<feed>
Generate a
personal access token
- Generate a Personal Access Token with Packaging read & write scopes.
Quick start
Before using the tool make sure you have all the prerequisites.
Add a registry to the global .npmrc
file
npx devops-npmrc@latest
To be able to install packages you also need to add a .npmrc
file to your project
# cd to your project
cd /path/to/your/project
# Then run
npx devops-npmrc@latest -p
To verify that everything is working you can run the following
npm config get registry
# Or using yarn
yarn info <package_in_devops_registry>
Usage
Add a registry to the global .npmrc
file
npx devops-npmrc@latest
Add a .npmrc
file to a project
npx devops-npmrc@latest -p
Available options
-p
,--project
– Generate a.npmrc
file for a project instead of a global file-V
,--version
– output the version number-h
,--help
– display help
Yarn
If you are using yarn
you can select yarn
when asked what package manager you are using, this will generate both a .npmrc
file and a .yarnrc.yml
file.
Contribute
If you wish to contribute, here are some steps to get started:
- Fork the repo and clone it to your local machine.
- Install dependencies by running
yarn
- Make your changes
- Build and bundle the project
- Push to github and submit a pull request
Build and bundle the project
Build the project
yarn build
Bundle the project
yarn bundle
Run the executable (located in the bin directory)
yarn run-bin