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

Bugfixes to yarn pack, partly fixes #755 #1464

Merged
merged 3 commits into from
Nov 26, 2016
Merged

Conversation

tkloht
Copy link
Contributor

@tkloht tkloht commented Oct 26, 2016

Summary
Contains two fixes for yarn pack if "files" is used in package.json:

  • some files (package.json, readme, license, changelog) should always be included, even if not listed in the files field. This was not the case, fixed by 13e7b42
  • all other files should be excluded, but the exclude filter did not match files starting with a dot (this is the default behaviour of minimatch it seems). fixed by 8851acb

Please note that this only partly fixes #755 .
As far as I can see what happens in #755 is the following:

  • some files which should be included we not included, in my example it was package.json
  • some files which should be excluded were included, in my example .gitignore and others.

While working on this I was wondering why a missing file would create a corrupt archive, but it seemed to be fixed at first. Then I added some more testcases and noticed that it is still possible to create corrupt archives, but this is not limited to the usage of "files" - see #1442.
Basically I think some directory was falsely included, and that invoked the bug described in #1442 .
But a missing or included file does not directly result in a corrupt archive.
Hope this makes sense, I find it difficult to explain right now.

Test plan
I have added some tests for this, just run yarn test.
If you want to see the failing tests checkout 6612ec6.

@tkloht
Copy link
Contributor Author

tkloht commented Oct 26, 2016

I fixed the tests for node 4 but travis is still failing, I have no idea why.
I anyone has an idea why please let me know.

npm pack includes some files even if they are not included in the “files” field in package.json. This commit creates the same behaviour in yarn pack.
if files is used in package.json all other files should be excluded. Files with dot as first character have to be excluded explicitly because minimatch will not match them by default.
@tkloht
Copy link
Contributor Author

tkloht commented Oct 27, 2016

Ok I have updated to skip the failing test for now, but the error message ist still there.
So it seems the test is still run just not marked as fail - is that how it is supposed to work?

@bestander bestander merged commit 949c9e5 into yarnpkg:master Nov 26, 2016
bestander added a commit that referenced this pull request Nov 27, 2016
@bestander
Copy link
Member

@T-Obi, I had to revert the merge because of CI issue https://circleci.com/gh/yarnpkg/yarn/2330.
Could you rebase and send a new PR and ping me?

bestander pushed a commit that referenced this pull request Nov 29, 2016
* add tests for pack with files-array

* include mandatory files if not in files-array

npm pack includes some files even if they are not included in the “files” field in package.json. This commit creates the same behaviour in yarn pack.

* explicitly exclude dotfiles in pack with files

if files is used in package.json all other files should be excluded. Files with dot as first character have to be excluded explicitly because minimatch will not match them by default.
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.

published package is corrupted if "files" is used in package.json
2 participants