@semantic-release/github 5.0.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/glob-assets.js +25 -4
- package/package.json +2 -1
package/lib/glob-assets.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
const path = require('path');
|
|
1
2
|
const {basename} = require('path');
|
|
2
|
-
const {isPlainObject, castArray, uniqWith} = require('lodash');
|
|
3
|
+
const {isPlainObject, castArray, uniqWith, uniq} = require('lodash');
|
|
4
|
+
const dirGlob = require('dir-glob');
|
|
3
5
|
const globby = require('globby');
|
|
4
6
|
const debug = require('debug')('semantic-release:github');
|
|
5
7
|
|
|
8
|
+
const filesTransform = (files, cwd, transform) =>
|
|
9
|
+
files.map(file => `${file.startsWith('!') ? '!' : ''}${transform(cwd, file.startsWith('!') ? file.slice(1) : file)}`);
|
|
10
|
+
|
|
6
11
|
module.exports = async ({cwd}, assets) =>
|
|
7
12
|
uniqWith(
|
|
8
13
|
[]
|
|
@@ -10,16 +15,30 @@ module.exports = async ({cwd}, assets) =>
|
|
|
10
15
|
...(await Promise.all(
|
|
11
16
|
assets.map(async asset => {
|
|
12
17
|
// Wrap single glob definition in Array
|
|
13
|
-
|
|
18
|
+
let glob = castArray(isPlainObject(asset) ? asset.path : asset);
|
|
19
|
+
// TODO Temporary workaround for https://github.com/kevva/dir-glob/issues/7 and https://github.com/mrmlnc/fast-glob/issues/47
|
|
20
|
+
glob = uniq([
|
|
21
|
+
...filesTransform(await dirGlob(filesTransform(glob, cwd, path.resolve)), cwd, path.relative),
|
|
22
|
+
...glob,
|
|
23
|
+
]);
|
|
24
|
+
|
|
14
25
|
// Skip solo negated pattern (avoid to include every non js file with `!**/*.js`)
|
|
15
26
|
if (glob.length <= 1 && glob[0].startsWith('!')) {
|
|
16
27
|
debug(
|
|
17
|
-
'skipping the negated glob %o as its alone in its group and would retrieve a large amount of files
|
|
28
|
+
'skipping the negated glob %o as its alone in its group and would retrieve a large amount of files',
|
|
18
29
|
glob[0]
|
|
19
30
|
);
|
|
20
31
|
return [];
|
|
21
32
|
}
|
|
22
|
-
|
|
33
|
+
|
|
34
|
+
const globbed = await globby(glob, {
|
|
35
|
+
cwd,
|
|
36
|
+
expandDirectories: true,
|
|
37
|
+
gitignore: false,
|
|
38
|
+
dot: true,
|
|
39
|
+
onlyFiles: false,
|
|
40
|
+
});
|
|
41
|
+
|
|
23
42
|
if (isPlainObject(asset)) {
|
|
24
43
|
if (globbed.length > 1) {
|
|
25
44
|
// If asset is an Object with a glob the `path` property that resolve to multiple files,
|
|
@@ -34,10 +53,12 @@ module.exports = async ({cwd}, assets) =>
|
|
|
34
53
|
// - other properties of the original asset definition
|
|
35
54
|
return {...asset, path: globbed[0] || asset.path};
|
|
36
55
|
}
|
|
56
|
+
|
|
37
57
|
if (globbed.length > 0) {
|
|
38
58
|
// If asset is a String definition, output each files matched
|
|
39
59
|
return globbed;
|
|
40
60
|
}
|
|
61
|
+
|
|
41
62
|
// If asset is a String definition but no match is found, output the elements of the original glob (each one will be considered as a missing file)
|
|
42
63
|
return glob;
|
|
43
64
|
})
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semantic-release/github",
|
|
3
3
|
"description": "Set of semantic-release plugins for publishing a GitHub release",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.1",
|
|
5
5
|
"author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/semantic-release/github/issues"
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"aggregate-error": "^1.0.0",
|
|
22
22
|
"bottleneck": "^2.0.1",
|
|
23
23
|
"debug": "^3.1.0",
|
|
24
|
+
"dir-glob": "^2.0.0",
|
|
24
25
|
"fs-extra": "^7.0.0",
|
|
25
26
|
"globby": "^8.0.0",
|
|
26
27
|
"http-proxy-agent": "^2.1.0",
|