coding-standards icon indicating copy to clipboard operation
coding-standards copied to clipboard

Increase NPM version requirement and regenerate package lockfiles

Open mattheu opened this issue 3 years ago • 4 comments

@tfrommen suggested in another PR that we regenerate the package-lock.json to use version 2 as a separate Pull Request to keep the size of the change down.

One thing raised in that conversation was that we need to ensure backwards compatibility with Node 12 and NPM 6 as this is what is used by the Altis Build pipeline. I'd just like to be clear that npm 6 does indeed support lockfile v2 so this change should be fine. .

mattheu avatar Jul 28 '22 16:07 mattheu

The issue I am (still) seeing with this is that people locally can use npm 6, and Node 12 or so. And everything is fine. Until they install or update a dependency, in which case they would generate a v1 lockfile, and again produce a massive change.

In the other PR, I said:

if we decided to do require a modern verison of npm, I'd do this outside of this very PR.

By that, I did not mean to just use npm 7+ and push a v2 lockfile, but actually state that the coding standards (i.e., the ESLint and stylelint configs) require npm and Node in a specific version. Since we do not really require any specific version, but want people not to "downgrade" the lockfile, this should do:

  "engines" : { 
    "npm" : ">=7.0.0",
    "node" : ">=15.0.0"
  }

tfrommen avatar Jul 28 '22 17:07 tfrommen

But my understanding is we need this to run on node 12 and npm 6 (as is the current requirement of the Altis build pipeline unless it has changed since Feb. If so I don’t think we can set the engine above that, which could still cause generation of v1 lock files.

mattheu avatar Jul 28 '22 20:07 mattheu

But my understanding is we need this to run on node 12 and npm 6 (as is the current requirement of the Altis build pipeline

Node 12 is what the build pipeline currently has installed, yes. But that is not a requirement in terms of "you cannot use anything newer". I know of projects that are using Node 14, and I think some are looking to use 16 or even Node 18.

tfrommen avatar Jul 28 '22 20:07 tfrommen

@tfrommen I've updated this to add the following.

  • Specify requirement for Node 16 and npm 7. (I skipped node 15 as you suggested as 16 is the current LTS)
  • Add documentation on using this in Altis build script.
  • Remove the Travis CI tests for Node 10, 12 and 14. Replace with 16 ~and 18~.

mattheu avatar Jul 29 '22 10:07 mattheu