|
18 | 18 | - [Java - Gradle](#java---gradle) |
19 | 19 | - [Java - Maven](#java---maven) |
20 | 20 | - [Node - npm](#node---npm) |
21 | | - - [macOS and Ubuntu](#macos-and-ubuntu) |
22 | | - - [Windows](#windows-3) |
23 | | - - [Using multiple systems and `npm config`](#using-multiple-systems-and-npm-config) |
24 | 21 | - [Node - Lerna](#node---lerna) |
25 | 22 | - [Node - Yarn](#node---yarn) |
26 | 23 | - [Node - Yarn 2](#node---yarn-2) |
@@ -259,40 +256,12 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba |
259 | 256 |
|
260 | 257 | ## Node - npm |
261 | 258 |
|
262 | | -For npm, cache files are stored in `~/.npm` on Posix, or `~\AppData\npm-cache` on Windows. See https://docs.npmjs.com/cli/cache#cache |
| 259 | +For npm, cache files are stored in `~/.npm` on Posix, or `~\AppData\npm-cache` on Windows, but it's possible to use `npm config get cache` to find the path on any platform. See [the npm docs](https://docs.npmjs.com/cli/cache#cache) for more details. |
263 | 260 |
|
264 | 261 | If using `npm config` to retrieve the cache directory, ensure you run [actions/setup-node](https://github.com/actions/setup-node) first to ensure your `npm` version is correct. |
265 | 262 |
|
266 | 263 | >Note: It is not recommended to cache `node_modules`, as it can break across Node versions and won't work with `npm ci` |
267 | 264 |
|
268 | | -### macOS and Ubuntu |
269 | | - |
270 | | -```yaml |
271 | | -- uses: actions/cache@v3 |
272 | | - with: |
273 | | - path: ~/.npm |
274 | | - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
275 | | - restore-keys: | |
276 | | - ${{ runner.os }}-node- |
277 | | -``` |
278 | | - |
279 | | -### Windows |
280 | | - |
281 | | -```yaml |
282 | | -- name: Get npm cache directory |
283 | | - id: npm-cache |
284 | | - run: | |
285 | | - echo "::set-output name=dir::$(npm config get cache)" |
286 | | -- uses: actions/cache@v3 |
287 | | - with: |
288 | | - path: ${{ steps.npm-cache.outputs.dir }} |
289 | | - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
290 | | - restore-keys: | |
291 | | - ${{ runner.os }}-node- |
292 | | -``` |
293 | | - |
294 | | -### Using multiple systems and `npm config` |
295 | | - |
296 | 265 | ```yaml |
297 | 266 | - name: Get npm cache directory |
298 | 267 | id: npm-cache-dir |
|
0 commit comments