Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pack): sort files to produce identical output on Windows and Unix #8142

Merged
merged 5 commits into from
May 21, 2020
Merged

fix(pack): sort files to produce identical output on Windows and Unix #8142

merged 5 commits into from
May 21, 2020

Conversation

merceyz
Copy link
Member

@merceyz merceyz commented May 21, 2020

Summary

Running yarn pack on Windows and Unix systems produce different results, since on Unix systems the files are sorted while on Windows they aren't.

Running yarn pack on https://github.com/arcanis/babel-plugin-lazy-import produces this output on Windows

$ tar -ztf babel-plugin-lazy-import-v1.0.0.tgz
package
package/index.js
package/package.json
package/README.md

While on Unix it produces

$ tar -ztf babel-plugin-lazy-import-v1.0.0.tgz
package
package/README.md
package/index.js
package/package.json

This PR fixes this by telling tar-fs to sort the files before it packs them. yarn pack also included the .yarnrc.yml config file so I added it to the DEFAULT_IGNORE list.

Test plan

Run yarn pack in a repository containing multiple files and check that the output of tar -ztf package.tgz is the same on Windows and Unix

@arcanis arcanis merged commit 17992a7 into yarnpkg:master May 21, 2020
@merceyz merceyz deleted the pack-issues branch May 21, 2020 17:33
arcanis added a commit that referenced this pull request Aug 27, 2020
…#8142)

* fix(pack): always ignore yarnrc.yml file

* fix(pack): sort files before packing

* docs: changelog

* chore: ping ci

* Update CHANGELOG.md

Co-authored-by: Maël Nison <nison.mael@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants