File tree 2 files changed +7
-11
lines changed
@commitlint/config-lerna-scopes
2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change 1
- const path = require ( 'path' ) ;
2
- const globby = require ( 'globby' ) ;
3
- const jsonfile = require ( 'load-json-file' ) ;
1
+ const Repository = require ( 'lerna/lib/Repository' ) ;
4
2
5
3
module . exports = {
6
4
utils : { getPackages} ,
7
5
rules : {
8
- 'scope-enum' : ( ) => getPackages ( )
9
- . then ( names => [ 2 , 'always' , names ] )
6
+ 'scope-enum' : ( ) => [ 2 , 'always' , getPackages ( ) ]
10
7
}
11
8
} ;
12
9
13
10
function getPackages ( ) {
14
- const root = path . resolve ( process . cwd ( ) , './packages' ) ;
15
- const glob = path . resolve ( root , '*/package.json' ) ;
16
-
17
- return globby ( glob )
18
- . then ( paths => Promise . all ( paths . map ( jsonfile ) ) )
19
- . then ( manifests => manifests . map ( manifest => manifest . name ) ) ;
11
+ const repo = new Repository ( process . cwd ( ) ) ;
12
+ return repo . packages
13
+ . map ( pkg => pkg . name )
14
+ . map ( name => name . charAt ( 0 ) === '@' ? name . split ( '/' ) [ 1 ] : name ) ;
20
15
}
Original file line number Diff line number Diff line change 26
26
"homepage" : " https://github.com/marionebl/commitlint#readme" ,
27
27
"dependencies" : {
28
28
"globby" : " 6.1.0" ,
29
+ "lerna" : " ^2.0.0" ,
29
30
"load-json-file" : " 2.0.0"
30
31
},
31
32
"devDependencies" : {
You can’t perform that action at this time.
0 commit comments