Skip to content

Commit

Permalink
fix: update globby to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg committed Jan 11, 2019
1 parent 761d39e commit 1b7e473
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
12 changes: 3 additions & 9 deletions lib/glob-assets.js
Expand Up @@ -5,9 +5,6 @@ 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) =>
uniqWith(
[]
Expand All @@ -16,11 +13,8 @@ module.exports = async ({cwd}, assets) =>
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 @@ -33,7 +27,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
Expand Up @@ -23,7 +23,7 @@
"debug": "^4.0.0",
"dir-glob": "^2.0.0",
"fs-extra": "^7.0.0",
"globby": "^8.0.0",
"globby": "^9.0.0",
"http-proxy-agent": "^2.1.0",
"https-proxy-agent": "^2.2.1",
"issue-parser": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion test/glob-assets.test.js
Expand Up @@ -189,5 +189,5 @@ test('Deduplicate resulting files path', async t => {
await copy(fixtures, cwd);
const globbedAssets = await globAssets({cwd}, ['./upload.txt', path.resolve(cwd, 'upload.txt'), 'upload.txt']);

t.deepEqual(globbedAssets, ['upload.txt']);
t.is(globbedAssets.length, 1);
});

0 comments on commit 1b7e473

Please sign in to comment.