Skip to content

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

Merged
arcanis merged 5 commits intoyarnpkg:masterfrom
merceyz:pack-issues
May 21, 2020
Merged

fix(pack): sort files to produce identical output on Windows and Unix#8142
arcanis merged 5 commits intoyarnpkg:masterfrom
merceyz:pack-issues

Conversation

@merceyz
Copy link
Copy Markdown
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