diff --git a/lib/glob-assets.js b/lib/glob-assets.js index 1519a125..947cbb4b 100644 --- a/lib/glob-assets.js +++ b/lib/glob-assets.js @@ -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( [] @@ -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('!')) { @@ -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, diff --git a/package.json b/package.json index 09a23ab1..cf674605 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/test/glob-assets.test.js b/test/glob-assets.test.js index 403bb9b0..4aea809b 100644 --- a/test/glob-assets.test.js +++ b/test/glob-assets.test.js @@ -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); });