From 281586f75e7e98d3d3410ccf95e49c428be2c889 Mon Sep 17 00:00:00 2001 From: ghiscoding Date: Fri, 3 Jun 2022 14:19:28 -0400 Subject: [PATCH] fix: correctly add npm package lock to git add list --- packages/version/src/version-command.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/version/src/version-command.ts b/packages/version/src/version-command.ts index fdc2457d..310065c1 100644 --- a/packages/version/src/version-command.ts +++ b/packages/version/src/version-command.ts @@ -659,6 +659,7 @@ export class VersionCommand extends Command { break; case 'npm': default: + lockFilename = 'package-lock.json'; const localNpmVersion = execSync('npm', ['--version']); this.logger.silly(`npm`, `current local npm version is "${localNpmVersion}"`); @@ -669,8 +670,7 @@ export class VersionCommand extends Command { await exec('npm', ['install', '--package-lock-only'], { cwd: this.project.manifest.location }); } else { // with npm, we need to do update the lock file in 2 steps - // 1. use shrinkwrap will delete current lock file and create new "npm-shrinkwrap.json" but will avoid npm retrieving package version info from registry - lockFilename = 'package-lock.json'; + // 1. using shrinkwrap will delete current lock file and create new "npm-shrinkwrap.json" but will avoid npm retrieving package version info from registry this.logger.verbose(`lock`, `updating lock file via "npm shrinkwrap --package-lock-only".`); this.logger.warn(`npm`, `Your npm version is lower than 8.5.0, we strongly suggest to upgrade your npm client to avoid the use of "npm shrinkwrap" instead of the regular "npm install --package-lock-only".`); await exec('npm', ['shrinkwrap', '--package-lock-only'], { cwd: this.project.manifest.location });