Skip to content

Commit

Permalink
fix: update globby to latest version Pierre Vanduynslager committed
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg committed Jan 14, 2019
1 parent ffe83a4 commit 71be783
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
13 changes: 3 additions & 10 deletions lib/glob-assets.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
const path = require('path');
const {isPlainObject, castArray, uniq} = require('lodash');
const dirGlob = require('dir-glob');
const globby = require('globby');
const debug = require('debug')('semantic-release:github');

const filesTransform = (files, cwd, transform) =>
files.map(file => `${file.startsWith('!') ? '!' : ''}${transform(cwd, file.startsWith('!') ? file.slice(1) : file)}`);

module.exports = async ({cwd}, assets) =>
uniq(
[].concat(
...(await Promise.all(
assets.map(async asset => {
// Wrap single glob definition in Array
let glob = castArray(isPlainObject(asset) ? asset.path : asset);
// TODO Temporary workaround for https://github.com/kevva/dir-glob/issues/7 and https://github.com/mrmlnc/fast-glob/issues/47
glob = uniq([
...filesTransform(await dirGlob(filesTransform(glob, cwd, path.resolve)), cwd, path.relative),
...glob,
]);
// TODO Temporary workaround for https://github.com/mrmlnc/fast-glob/issues/47
glob = uniq([...(await dirGlob(glob, {cwd})), ...glob]);

// Skip solo negated pattern (avoid to include every non js file with `!**/*.js`)
if (glob.length <= 1 && glob[0].startsWith('!')) {
Expand All @@ -31,7 +24,7 @@ module.exports = async ({cwd}, assets) =>

const globbed = await globby(glob, {
cwd,
expandDirectories: true,
expandDirectories: false, // TODO Temporary workaround for https://github.com/mrmlnc/fast-glob/issues/47
gitignore: false,
dot: true,
onlyFiles: false,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"dir-glob": "^2.0.0",
"execa": "^1.0.0",
"fs-extra": "^7.0.0",
"globby": "^8.0.1",
"globby": "^9.0.0",
"lodash": "^4.17.4",
"micromatch": "^3.1.4",
"p-reduce": "^1.0.0"
Expand Down

0 comments on commit 71be783

Please sign in to comment.