I want to use latest
distribution tag in my package.json
for internal packages. This allows me to always get their latest versions when I npm install
in local environment, without updating all external 3rd parties.
The issue comes when I'm hotfixing deployed verion:
- For hotfix purpose I generate and save
package-lock.json
for each deployed version of the application. - But when I
npm install
during hotfix preparation, there is a conflict between versions of internal package inpackage.json
andpackage-lock.json
:package-lock.json
points to version that was used in deployed application, butpackage.json
point tolatest
distribution tag, which itself points to later version. - Since version specified in
package-lock.json
doesn't suit to version range specified inpackage.json
(which is very specific - only the latest version will suit),npm install
ignorespackage-lock.json
and installs the latest version.
I searched through documentation and internet and didn't find any existing solution for the issue:
- I didn't find any
npm install
flag that would treatpackage-lock.json
versions with higher priority than distribution tag inpackage.json
- I dind't find any tool that would reconstruct
package.json
frompackage-lock.json
, or at least replace aliases (distribution tags) inpackage.json
with specific versions frompackage-lock.json
.
Is there any solution for my issue (besides writing a tool that will implement last approach)?
Sandbox:
https://github.com/maxlk/npm-lock-version-should-override-latest (clone and run npm install
or its alternative)