From 2a500e75a332797da2288f28fade925f51b04a02 Mon Sep 17 00:00:00 2001 From: Miroslav Jonas Date: Tue, 28 Mar 2023 14:33:09 +0200 Subject: [PATCH] fix(core): improve lockfile version stringification --- packages/nx/src/lock-file/pnpm-parser.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/nx/src/lock-file/pnpm-parser.ts b/packages/nx/src/lock-file/pnpm-parser.ts index d8b1030bc15668..ee7c49f1362128 100644 --- a/packages/nx/src/lock-file/pnpm-parser.ts +++ b/packages/nx/src/lock-file/pnpm-parser.ts @@ -157,10 +157,14 @@ export function stringifyPnpmLockfile( packageJson: NormalizedPackageJson ): string { const data = parseAndNormalizePnpmLockfile(rootLockFileContent); - const hasV5Separator = data.lockfileVersion.toString().startsWith('5'); + const lockfileVersion: string = + typeof data.lockfileVersion === 'number' + ? data.lockfileVersion.toFixed(1) + : data.lockfileVersion; + const hasV5Separator = lockfileVersion.startsWith('5'); const output: Lockfile = { - lockfileVersion: data.lockfileVersion, + lockfileVersion, importers: { '.': mapRootSnapshot( packageJson,