This is an old revision of the document!
Table of Contents
NPM
Searching packages: https://stackoverflow.com/questions/10568512/how-to-find-search-find-npm-packages
Create a project
npm init
Start project
# install modules from package.json npm install
# starts the tests defined in npm test
Using NPM in browser
Setting the default registry
npm config set registry https://yoururl.com/artifactory/api/npm/npm-all npm config get registry
The file, where the config is stored is in your home dir and is called '.npmrc'
Making the npm use a special registry for some package namespace is done as following
Opens the '.npmrc' file
npm config edit
And configure the registry e.g. for the `@simpl` pacakges.
Somewhere in `.nprc` add
@simpl:registry=https://code.yourdomain.com/api/v4/packages/npm/ @simpl-labs:registry=https://code.yourdomain.com/api/v4/packages/npm/
If the repository requires authentication - there is some weird syntax allowing to add a token as authentication for a repository, using the `domain` notation <code> @simpl:registry=https://code.yourdomain.com/api/v4/packages/npm/ @simpl-labs:registry=https://code.yourdomain.com/api/v4/packages/npm/ code.yourdomain.com/api/v4/packages/npm/:_authToken=CSC-y-79x5babLxHyeWyE1xJ </code>