-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52b1ced
commit b7d206b
Showing
1 changed file
with
11 additions
and
7 deletions.
There are no files selected for viewing
18 changes: 11 additions & 7 deletions
18
recipes/ci-cd/github-actions/workflows/node/ci-installs.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
# CI installs | ||
> A note on use of `npm ci` | ||
Some flows here use the `npm ci` command - see [NPM CI cheatsheet](https://michaelcurrin.github.io/dev-cheatsheets/cheatsheets/javascript/npm/commands/ci.html) to learn about the command. | ||
Some flows in pages here use the `npm ci` command. This can be safer deploy pipelines. See [NPM CI cheatsheet][] to learn about the command. | ||
|
||
A reason to **not** use is that it will delete `node_modules` if it exists. So if you use the `actions/cache` action to retrieved **cached** dependencies each time (for faster builds), make sure to use `npm install` rather than `npm ci`. Otherwise the cache is unused.. | ||
|
||
For more info on cache, see [Cache](/recipes/ci-cd/github-actions/workflows/cache.md) page of this Cookbook. | ||
## Cache concerns | ||
|
||
The equivalent for Yarn: | ||
A reason to **not** use is that it will **delete** `node_modules` if it exists. | ||
|
||
```sh | ||
$ yarn install --frozen-lockfile | ||
``` | ||
So if you use the `actions/cache` action to retrieved **cached** dependencies each time (for faster builds), make sure to use `npm install` rather than `npm ci`. Otherwise the cache is unused. There is then a risk that packages could get upgraded | ||
|
||
For more info on cache, see [Cache][] page of this Cookbook. | ||
|
||
You can also solve this issue by caching the tarballs in `~/.npm` rather than `node_modules`. This will safe downloading packages and still let `node_modules` get built each time. | ||
|
||
[NPM CI cheatsheet]: https://michaelcurrin.github.io/dev-cheatsheets/cheatsheets/package-managers/javascript/npm/commands/ci.html | ||
[Cache]: {% link recipes/ci-cd/github-actions/workflows/cache.md %} |