runas-plugin-npm
Version:
Runas plugin for npm
153 lines (102 loc) • 3.36 kB
Markdown
- [Available Commands](
- [Flows](
- [Steps](
- [Plugins](
- [npm](
- [npmRegistry](
[[Index]](
npm commands wrapper for runas
Any step can ensure that **npm install** or **npm update** are correctly executed:
**Add package dependency**:
npm install runas-plugin-npm --save
**Add plugin on steps/$stepName/config.json plugins**:
```
{
"plugins": [
[...]
"npm"
]
}
```
```
{
"npmDependencies": {
"installed": true,
"updated": true,
"baseDir" : "any", (default is &
"directory" : "node_modules" (default is &
}
}
```
- **installed** _(default: false)_ Ensure that npm install is executed if ${npm.directory} doesn&
- **updated** _(default: false)_ Ensure that `npm update` and `npm prune` are executed. Detect if there are symbolics links and ask user to delete
- **directory** _(default: &
- **baseDir** _(default: &
**By default the hook is set on check stage**
In config.json of your step
```
{
"stages" : ["check","run"],
"npmDependencies": {
[...]
}
}
```
Normal use, ensure npm install was executed:
```
{
"npmDependencies": {
"installed": true
}
}
```
Check if there are symbolics links and ask user to update:
```
{
"npmDependencies": {
"updated": true
}
}
```
Execute **npm list ${opts}**
| Param | Description |
| --- | --- |
| opts | array with command options to append to npm list for example [ &
| returns | a Promise with the complete child_process object result of the execution |
[[Index]](
Plugin used to registry npm modules into a public npm registry
How to use this plugin:
- 1. Implicit: Calling public addons.
- 2. Explicit: By configuration. Checks if npm Registry is well configured.
configure this.params.stages with an array of the stages you want to check if the npm registry is ok.
```
"stages" : ["check", "run"]
```
This parameters should be set on the step:
- **--registryUrl**: [String], default: &
Note: you can change the repository that artifacts is going to be published by adding a .runas/runas.json file like this:
```
{
"params" : {
"registryUrl" : "https://registry.npmjs.org/"
}
}
```
Return: 0 if everything is Ok or status of the command executed.