Getting started
Setup
WARNING
Codey requires a minimum node version of v18 in order to work properly.
Codey packages are privately hosted on Azure Devops. To get access to these packages the following setup is required.
First we need to let npm know where to find the @xerius
packages using a .npmrc
file. This file needs to sit next to the package.json
with the following content:
@xerius:registry=https://pkgs.dev.azure.com/xeriusit/_packaging/XeriusGroup/npm/registry/
INFO
Ensure you put @xerius:
in front of the registry
. Forgetting this will lead to npm wanting to fetch all packages from the private npm registry.
Authenticate on Windows
To authenticate with azure devops use the following command:
npx vsts-npm-auth -config .npmrc
This command not working?
Try adding the -F option to prompt the login screen:
npx vsts-npm-auth -config .npmrc -F
When prompted with a log-in screen, authenticate with your Xerius email address.
More information can be found on Azure Devops
Authenticate on Mac
The vsts-npm-auth
package is not available for Mac. To authenticate on Mac, you need to use a PAT (Personal Access Token) and add an .npmrc
in the $home
of your user:
Add .npmrc
to $home
; begin auth token
//pkgs.dev.azure.com/xeriusit/_packaging/XeriusGroup/npm/registry/:username=xeriusit
//pkgs.dev.azure.com/xeriusit/_packaging/XeriusGroup/npm/registry/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
//pkgs.dev.azure.com/xeriusit/_packaging/XeriusGroup/npm/registry/:email=anemail@xerius.be
//pkgs.dev.azure.com/xeriusit/_packaging/XeriusGroup/npm/:username=xeriusit
//pkgs.dev.azure.com/xeriusit/_packaging/XeriusGroup/npm/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
//pkgs.dev.azure.com/xeriusit/_packaging/XeriusGroup/npm/:email=anemail@xerius.be
; end auth token
Generate PAT
Generate a Personal Access Token with Packaging read & write scopes.
Base64 encode the PAT
One safe and secure method of Base64 encoding a string is to:
- From 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
Filling the BASE64 token in the .npmrc
file
Replace both [BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
values in your user .npmrc
file with your encoded personal access token from Step 3.
Install Codey Packages
An overview of all Codey packages can be found here.
Pipeline
When setting up a build pipeline we advise adding an npm authentication task to make sure all npm packages can be installed correctly.
- task: npmAuthenticate@0
displayName: Authenticate npm
inputs:
workingFile: "${{parameters.workingDir}}/<your-app-root>/.npmrc"