CLI tool Guidance
We support using NPX/NPM to install CLI tool, no matter NPX or NPM you need to get access token first then do the installation.
Create azure feed and NPM access token
Generate a .npmrc for installation
Please follow steps below to generate a .npmrc for installation:
- Add a
.npmrcto your project, in the same directory as yourpackage.json - Add codes below to
.npmrc:
registry=https://dnvgl-one.pkgs.visualstudio.com/456fe6d6-0acc-47eb-8479-90237b03b54c/_packaging/dnv-cli/npm/registry/
always-auth=true
; begin auth token
//dnvgl-one.pkgs.visualstudio.com/456fe6d6-0acc-47eb-8479-90237b03b54c/_packaging/dnv-cli/npm/registry/:username=dnvgl-one
//dnvgl-one.pkgs.visualstudio.com/456fe6d6-0acc-47eb-8479-90237b03b54c/_packaging/dnv-cli/npm/registry/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
//dnvgl-one.pkgs.visualstudio.com/456fe6d6-0acc-47eb-8479-90237b03b54c/_packaging/dnv-cli/npm/registry/:email=npm requires email to be set but doesn't use the value
//dnvgl-one.pkgs.visualstudio.com/456fe6d6-0acc-47eb-8479-90237b03b54c/_packaging/dnv-cli/npm/:username=dnvgl-one
//dnvgl-one.pkgs.visualstudio.com/456fe6d6-0acc-47eb-8479-90237b03b54c/_packaging/dnv-cli/npm/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
//dnvgl-one.pkgs.visualstudio.com/456fe6d6-0acc-47eb-8479-90237b03b54c/_packaging/dnv-cli/npm/:email=npm requires email to be set but doesn't use the value
; end auth token
Generate a Personal Access Token with Packaging - read & write scope.
Base64 encode the personal access token got from Step 3.
In a command/shell prompt, run
node -e "require('readline') .createInterface({input:process.stdin,output:process.stdout,historySize:0}) .question('PAT> ',p => { b64=Buffer.from(p.trim()).toString('base64');console.log(b64);process.exit(); })"
Paste your personal access token value and press Enter/Return
Copy the Base64 encoded value
- Replace all
[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]values in your .npmrc file with your personal access token encoded from Step 4.
You are recommended to put this .npmrc to your user directory and paste the token there. On windows, it should be in C:\Users\{USER}\.npmrc.
Installation may fail if dnv-cli cannot find correct registry.
Install and using CLI tool
After .npmrc is ready, we could start install and use CLI tool now.
You could choose to use NPX or NPM to install and use CLI.
- NPX
- NPM
By using npx, you could use CLI tool directly without install it globally, just run command
npx dnv-cli init
then following command step to step to finish install template.
By using npm, you could install CLI tool globally on your laptop
npm install dnv-cli -g
After dnv-cli is installed, you could use
dnv-cli init
to download templates anytime
Any download error?
🧐 Token may expired sometimes which will cause download error.We are sorry about the inconvience about this. Please contact us anytime when you find CLI tool or download is not working. We will fix it ASAP.