diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f11c74bf0..f63236285e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,15 +4,15 @@ Please add one entry in this file for each change in Yarn's behavior. Use the sa ## Master -- Run the engines check before showing the UI for `upgrade-interactive` +- Ensures the engine check is ran before showing the UI for `upgrade-interactive` [#6536](https://github.com/yarnpkg/yarn/pull/6536) - [**Orta Therox**](https://github.com/orta) -- Restore Node v4 support by downgrading `cli-table3` +- Restores Node v4 support by downgrading `cli-table3` [#6535](https://github.com/yarnpkg/yarn/pull/6535) - [**Mark Stacey**](https://github.com/Gudahtt) -- Prevent infinite loop when parsing corrupted lockfile with unterminated string +- Prevents infinite loop when parsing corrupted lockfiles with unterminated strings [#4965](https://github.com/yarnpkg/yarn/pull/4965) - [**Ryan Hendrickson**](https://github.com/rhendric) @@ -32,6 +32,10 @@ Please add one entry in this file for each change in Yarn's behavior. Use the sa [#5322](https://github.com/yarnpkg/yarn/pull/5322) - [**Karolis Narkevicius**](https://twitter.com/KidkArolis) +- Fixes how the `files` property is interpreted to bring it in line with npm + + [#6562](https://github.com/yarnpkg/yarn/pull/6562) - [**Bertrand Marron**](https://github.com/tusbar) + ## 1.12.0 - Adds initial support for PnP on Windows diff --git a/__tests__/commands/pack.js b/__tests__/commands/pack.js index cd825c67b8..e81fd0a4d1 100644 --- a/__tests__/commands/pack.js +++ b/__tests__/commands/pack.js @@ -67,6 +67,18 @@ test.concurrent('pack should include all files listed in the files array', (): P }); }); +test.concurrent('pack should include files based from the package’s root', (): Promise => { + return runPack([], {}, 'files-include-from-root', async (config): Promise => { + const {cwd} = config; + const files = await getFilesFromArchive( + path.join(cwd, 'files-include-from-root-v1.0.0.tgz'), + path.join(cwd, 'files-include-from-root-v1.0.0'), + ); + expect(files.indexOf('index.js')).toBeGreaterThanOrEqual(0); + expect(files.indexOf('sub/index.js')).toEqual(-1); + }); +}); + test.concurrent('pack should included globbed files', (): Promise => { return runPack([], {}, 'files-glob', async (config): Promise => { const {cwd} = config; diff --git a/__tests__/fixtures/pack/files-include-from-root/index.js b/__tests__/fixtures/pack/files-include-from-root/index.js new file mode 100644 index 0000000000..452029d835 --- /dev/null +++ b/__tests__/fixtures/pack/files-include-from-root/index.js @@ -0,0 +1 @@ +console.log('included'); diff --git a/__tests__/fixtures/pack/files-include-from-root/package.json b/__tests__/fixtures/pack/files-include-from-root/package.json new file mode 100644 index 0000000000..94eca8baf3 --- /dev/null +++ b/__tests__/fixtures/pack/files-include-from-root/package.json @@ -0,0 +1,6 @@ +{ + "name": "files-include-from-root", + "version": "1.0.0", + "license": "MIT", + "files": ["index.js"] +} diff --git a/__tests__/fixtures/pack/files-include-from-root/sub/index.js b/__tests__/fixtures/pack/files-include-from-root/sub/index.js new file mode 100644 index 0000000000..14816cc323 --- /dev/null +++ b/__tests__/fixtures/pack/files-include-from-root/sub/index.js @@ -0,0 +1 @@ +console.log('not included'); diff --git a/src/cli/commands/pack.js b/src/cli/commands/pack.js index c84e107387..b6500751db 100644 --- a/src/cli/commands/pack.js +++ b/src/cli/commands/pack.js @@ -88,7 +88,7 @@ export async function packTarball( onlyFiles.map((filename: string): string => `!${filename}`), onlyFiles.map((filename: string): string => `!${path.join(filename, '**')}`), ); - const regexes = ignoreLinesToRegex(lines, '.'); + const regexes = ignoreLinesToRegex(lines, './'); filters = filters.concat(regexes); }