File tree 2 files changed +11
-3
lines changed
@commitlint/config-lerna-scopes
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
const glob = require ( 'glob' ) ;
2
2
const Path = require ( 'path' ) ;
3
3
const importFrom = require ( 'import-from' ) ;
4
- const resolvePkg = require ( 'resolve-pkg' ) ;
5
4
const semver = require ( 'semver' ) ;
6
5
7
6
module . exports = {
@@ -54,5 +53,15 @@ function getPackages(context) {
54
53
}
55
54
56
55
function getLernaVersion ( cwd ) {
57
- return require ( Path . join ( resolvePkg ( 'lerna' , { cwd} ) , 'package.json' ) ) . version ;
56
+ const moduleEntrypoint = require . resolve ( 'lerna' , {
57
+ paths : [ cwd ] ,
58
+ } ) ;
59
+ const moduleDir = Path . join (
60
+ moduleEntrypoint . slice ( 0 , moduleEntrypoint . lastIndexOf ( 'node_modules' ) ) ,
61
+ 'node_modules' ,
62
+ 'lerna'
63
+ ) ;
64
+ const modulePackageJson = Path . join ( moduleDir , 'package.json' ) ;
65
+
66
+ return require ( modulePackageJson ) . version ;
58
67
}
Original file line number Diff line number Diff line change 40
40
"dependencies" : {
41
41
"glob" : " ^8.0.3" ,
42
42
"import-from" : " 4.0.0" ,
43
- "resolve-pkg" : " 2.0.0" ,
44
43
"semver" : " 7.3.8"
45
44
},
46
45
"devDependencies" : {
You can’t perform that action at this time.
0 commit comments