1
- const path = require ( 'path' ) ;
2
1
const { isPlainObject, castArray, uniq} = require ( 'lodash' ) ;
3
2
const dirGlob = require ( 'dir-glob' ) ;
4
3
const globby = require ( 'globby' ) ;
5
4
const debug = require ( 'debug' ) ( 'semantic-release:github' ) ;
6
5
7
- const filesTransform = ( files , cwd , transform ) =>
8
- files . map ( file => `${ file . startsWith ( '!' ) ? '!' : '' } ${ transform ( cwd , file . startsWith ( '!' ) ? file . slice ( 1 ) : file ) } ` ) ;
9
-
10
6
module . exports = async ( { cwd} , assets ) =>
11
7
uniq (
12
8
[ ] . concat (
13
9
...( await Promise . all (
14
10
assets . map ( async asset => {
15
11
// Wrap single glob definition in Array
16
12
let glob = castArray ( isPlainObject ( asset ) ? asset . path : asset ) ;
17
- // TODO Temporary workaround for https://github.com/kevva/dir-glob/issues/7 and https://github.com/mrmlnc/fast-glob/issues/47
18
- glob = uniq ( [
19
- ...filesTransform ( await dirGlob ( filesTransform ( glob , cwd , path . resolve ) ) , cwd , path . relative ) ,
20
- ...glob ,
21
- ] ) ;
13
+ // TODO Temporary workaround for https://github.com/mrmlnc/fast-glob/issues/47
14
+ glob = uniq ( [ ...( await dirGlob ( glob , { cwd} ) ) , ...glob ] ) ;
22
15
23
16
// Skip solo negated pattern (avoid to include every non js file with `!**/*.js`)
24
17
if ( glob . length <= 1 && glob [ 0 ] . startsWith ( '!' ) ) {
@@ -31,7 +24,7 @@ module.exports = async ({cwd}, assets) =>
31
24
32
25
const globbed = await globby ( glob , {
33
26
cwd,
34
- expandDirectories : true ,
27
+ expandDirectories : false , // TODO Temporary workaround for https://github.com/mrmlnc/fast-glob/issues/47
35
28
gitignore : false ,
36
29
dot : true ,
37
30
onlyFiles : false ,
0 commit comments