@@ -41,7 +41,7 @@ export async function generatePnpmLockfile({
41
41
* versions after 9, because we might get lucky. If it does change, things
42
42
* would break either way.
43
43
*/
44
- const useVersion9 = majorVersion >= 9 ;
44
+ const useReadVersion9 = majorVersion >= 9 ;
45
45
46
46
const { includeDevDependencies, includePatchedDependencies } = useConfig ( ) ;
47
47
const log = useLogger ( ) ;
@@ -51,7 +51,7 @@ export async function generatePnpmLockfile({
51
51
try {
52
52
const isRush = isRushWorkspace ( workspaceRootDir ) ;
53
53
54
- const lockfile = useVersion9
54
+ const lockfile = useReadVersion9
55
55
? await readWantedLockfile_v9 (
56
56
isRush
57
57
? path . join ( workspaceRootDir , "common/config/rush" )
@@ -71,7 +71,11 @@ export async function generatePnpmLockfile({
71
71
72
72
assert ( lockfile , `No input lockfile found at ${ workspaceRootDir } ` ) ;
73
73
74
- const targetImporterId = useVersion9
74
+ const [ lockfileMajorVersion ] = String ( lockfile . lockfileVersion ) . split ( "." ) ;
75
+
76
+ const useLockfileVersion9 = lockfileMajorVersion >= "9" ;
77
+
78
+ const targetImporterId = useLockfileVersion9
75
79
? getLockfileImporterId_v9 ( workspaceRootDir , targetPackageDir )
76
80
: getLockfileImporterId_v8 ( workspaceRootDir , targetPackageDir ) ;
77
81
@@ -141,7 +145,7 @@ export async function generatePnpmLockfile({
141
145
142
146
log . debug ( "Pruning the lockfile" ) ;
143
147
144
- const prunedLockfile = useVersion9
148
+ const prunedLockfile = useLockfileVersion9
145
149
? await pruneLockfile_v9 ( lockfile , targetPackageManifest , "." )
146
150
: await pruneLockfile_v8 ( lockfile , targetPackageManifest , "." ) ;
147
151
@@ -160,7 +164,7 @@ export async function generatePnpmLockfile({
160
164
? lockfile . patchedDependencies
161
165
: undefined ;
162
166
163
- useVersion9
167
+ useLockfileVersion9
164
168
? await writeWantedLockfile_v9 ( isolateDir , {
165
169
...prunedLockfile ,
166
170
patchedDependencies,
0 commit comments