Newer
Older
```yaml
include:
- component: "gitlab.arm.com/ci/component/node@<version>"
Installs the NPM modules and caches them. Executes `npm run lint`. Executes `npm test` All of those are then combined together using the
```yaml
extends: .node-install
script:
- !reference [.node-fragment, lint]
- !reference [.node-fragment, test]
Node projects have a defined workflow through NPM. The components ease setting up the workflow.
The `.node` job will use the `node` container from this repo for the same tag as the component version used.
The image can be overridden with the [image][image] keyword in the `.gitlab-ci.yml`:
```yaml
inputs:
image: registry.gitlab.arm.com/ci/component/node
job:
extends: .node-install
```
The `node` image has rootless global package installs configured.
Global packages can be installed as the default unpriviledge `ci` user.
A space separated list of GitLab CI scopes to add authentication for.
To install packages from other GitLab scopes (groups) add them to this variable:
```yaml
include:
- component: "gitlab.arm.com/ci/component/node@<version>"
inputs:
SCOPES: "build some-other-group"
These space separated variables allow certain package groups to be installed:
```yaml
include:
- component: "gitlab.arm.com/ci/component/node@<version>"
inputs:
OMIT: "dev"
INCLUDE: "optional prod"
install:
extends: .node-install
```
They correspond to the `--omit`/`--include` arguments to `npm`.
The prefix to add to the NodeJS cache, which defaults to `nodejs-${VERSION}`.
It will always be invalidated when `package-lock.json` changes.