How can I run `npm prune` but exclude one package

Viewed 367

Is there a way to run npm prune but a single package that is not in the dependencies?

I know it sounds weird, but there is a legit use-case.

Use case:

  1. Inside an abstracted CI/CD flow, I want to npm install any new additions to the package.json
  2. Then npm prune should remove any extraneous packages that may have been removed from the package.json
  3. Then I want to npm install XXXX a single dependency that is required only for the CI/CD flow, however subsequent flows should not install this if it is already present, thus on the second execution of the CI/CD flow, this XXXX package would be removed via the npm prune command. :-(
0 Answers
Related