From 82fc55a4429d3aec311a9f52f0195d861d442afa Mon Sep 17 00:00:00 2001 From: Kilian Date: Sat, 22 Feb 2020 22:05:14 +0100 Subject: [PATCH 1/2] Change npm dependencies install example --- doc/ci/caching/index.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/ci/caching/index.md b/doc/ci/caching/index.md index 0109d87921b394..e0a3cb70df9a9b 100644 --- a/doc/ci/caching/index.md +++ b/doc/ci/caching/index.md @@ -206,10 +206,15 @@ templates](https://gitlab.com/gitlab-org/gitlab-foss/tree/master/lib/gitlab/ci/t ### Caching Node.js dependencies -Assuming your project is using [npm](https://www.npmjs.com/) or -[Yarn](https://classic.yarnpkg.com/en/) to install the Node.js dependencies, the -following example defines `cache` globally so that all jobs inherit it. -Node.js modules are installed in `node_modules/` and are cached per-branch: +Assuming your project is using [npm](https://www.npmjs.com/) +to install the Node.js dependencies. + +TIP: **Tip:** +By default, npm stores cache data in the home folder `~/.npm` +but [you can't cache things outside of the project directory](../yaml/README.md#cachepaths) so we simply tell npm to use `./.npm` instead. + +The following example defines `cache` globally so that all jobs inherit it. +The npm cache is defined under `.npm/` and is cached per-branch: ```yaml # @@ -221,10 +226,10 @@ image: node:latest cache: key: ${CI_COMMIT_REF_SLUG} paths: - - node_modules/ + - .npm/ before_script: - - npm install + - npm ci --cache .npm --prefer-offline test_async: script: -- GitLab From fc5fecdade4c5880146fe1e28f2de85d8994c28c Mon Sep 17 00:00:00 2001 From: Kilian Decaderincourt Date: Sun, 1 Mar 2020 11:18:54 +0000 Subject: [PATCH 2/2] Apply suggestion to doc/ci/caching/index.md --- doc/ci/caching/index.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/doc/ci/caching/index.md b/doc/ci/caching/index.md index e0a3cb70df9a9b..a60310076a8738 100644 --- a/doc/ci/caching/index.md +++ b/doc/ci/caching/index.md @@ -206,15 +206,11 @@ templates](https://gitlab.com/gitlab-org/gitlab-foss/tree/master/lib/gitlab/ci/t ### Caching Node.js dependencies -Assuming your project is using [npm](https://www.npmjs.com/) -to install the Node.js dependencies. - -TIP: **Tip:** -By default, npm stores cache data in the home folder `~/.npm` -but [you can't cache things outside of the project directory](../yaml/README.md#cachepaths) so we simply tell npm to use `./.npm` instead. - -The following example defines `cache` globally so that all jobs inherit it. -The npm cache is defined under `.npm/` and is cached per-branch: +Assuming your project is using [npm](https://www.npmjs.com/) to install the Node.js +dependencies, the following example defines `cache` globally so that all jobs inherit it. +By default, npm stores cache data in the home folder `~/.npm` but since +[you can't cache things outside of the project directory](../yaml/README.md#cachepaths), +we tell npm to use `./.npm` instead, and it is cached per-branch: ```yaml # -- GitLab