File tree 1 file changed +4
-5
lines changed
packages/tools/cli/src/lockfile
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ import type { PackageManager } from '../package-manager';
2
2
import { buildPNPMDepTree } from './pnpm' ;
3
3
import { buildNPMDepTree } from './npm' ;
4
4
import { buildYarnDepTree } from './yarn' ;
5
- import fsp from 'fs/promises' ;
6
- import path from 'path' ;
5
+ import fsp from 'node: fs/promises' ;
6
+ import path from 'node: path' ;
7
7
8
8
export interface PackageLockDeps {
9
9
[ depName : string ] : PackageLockDep
@@ -34,10 +34,9 @@ export function buildDepTrees(packageManager: PackageManager, dir: string) {
34
34
35
35
export async function getPNPMLockfileVersion ( dir : string ) {
36
36
const content = await fsp . readFile ( path . resolve ( dir , 'pnpm-lock.yaml' ) , 'utf-8' ) ;
37
- const [ , lockfileVersion ] = content . match ( / ^ l o c k f i l e V e r s i o n : ' ? ( \d * (?: .\d * ) ? ) ' ? $ / m) ?? [ ] ;
37
+ const [ , lockfileVersion ] = ( / ^ l o c k f i l e V e r s i o n : [ " ' ] ? ( \d * (?: \ .\d * ) ? ) [ " ' ] ? $ / m. exec ( content ) ) ?? [ ] ;
38
38
39
- if ( ! lockfileVersion )
40
- throw new Error ( `Can't detect lockfile version` )
39
+ if ( ! lockfileVersion ) throw new Error ( 'Can\'t detect lockfile version' ) ;
41
40
42
41
return lockfileVersion ;
43
42
}
You can’t perform that action at this time.
0 commit comments