Skip to content

chore(docs, dev): Use "npm ci" instead of "npm install"

Angelo Rivera requested to merge fix-npm-install into main

Description

Per the NPM Docs, the primary difference between npm install vs npm ci is the following:

It will never write to package.json or any of the package-locks: installs are essentially frozen.

Here's a breakdown of the differences between each:

 cases                                | npm install | npm ci
 --------------------------------------|-------------|-------------
  needs package.json                   | no          | yes
  needs package-lock.json              | no          | yes
  installs from package.json           | yes         | no
  installs from package-lock.json      | no          | yes
  compares both                        | no          | yes
  updates loose package versions       | yes         | no
  updates loose dependencies           | yes         | no
  writes to package.json               | yes         | no
  writes to package-lock.json          | yes         | no
  deletes node_modules before install  | no          | yes
  used for installing separate package | yes         | no
  should be used on build systems / CI | no          | yes
  can be used for development          | yes         | yes
  reproducible installs                | no          | yes

Taken from this source.

In my experience, it's generally good practice to use npm ci instead of npm i whenever possible for reproducible builds and most importantly ensuring your node module versions are consistent.

The javascript world sometimes likes to include breaking changes in patch versions, so it's better to be safe than sorry 😄

How has this been tested?

Mostly, documentation changes. But the webview install script has been modified, and I ensured that each folder has both a package.json and package-lock.json.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)
  • Test gap
Edited by Angelo Rivera

Merge request reports