Working with NPM
Publish NPM Package
Configure your scope to use OneDev registry:
$ npm config set @<scope>:registry https://onedev.example.com/<project path>/~npm/
Param Explanation <scope> scope of your package <project path> path of a project with package management enabled Configure auth token of the registry:
$ npm config set -- '//onedev.example.com/<project path>/~npm/:_authToken' "<onedev_access_token>"
Param Explanation <project path> same as above <ondev_access_token> OneDev access token with package write permission over the project Publish the image:
$ npm publish
For CI/CD job, run below to publish package via command step:
# Use @@ to reference scope in job commands to avoid being interpreted as variable
npm config set @@<scope>:registry https://onedev.example.com/<project path>/~npm/
# Use job token to tell OneDev the build publishing the package
# Job secret 'access-token' should be defined in project build setting as an access token with package write permission
npm config set -- '//onedev.example.com/<project path>/~npm/:_authToken' "@job_token@:@secret:access-token@"
npm publishParam Explanation <scope> same as above <project path> same as above
Consume Published NPM Package
The package detail page contains instructions on how to consume published image.