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

yarn pack includes unexpected files with a negative expression in files of package.json #8332

Open
eunjae-lee opened this issue Sep 7, 2020 · 2 comments

Comments

@eunjae-lee
Copy link

eunjae-lee commented Sep 7, 2020

Bug description

Command

yarn pack

What is the current behavior?

When files of package.json includes a negative expression, yarn pack includes unexpected files (I guess the whole directory).

What is the expected behavior?

It should include only what it's supposed to include. The output is different from npm pack.

Steps to Reproduce

  1. git clone git@github.com:eunjae-lee/yarn-pack-issue.git
  2. Run touch .env && yarn pack
  3. You will see this-file-should-not-be-packed.js and .env are included in the tgz file.

What is worse is that .env is in .gitignore. (It's the same even if it's also included in .npmignore.)

  1. If you remove the line 8 of package.json which is "!**/__tests__/**",
  2. then run again yarn pack
  3. This time, it doesn't include this-file-should-not-be-packed.js or .env.

Environment

  • Node Version: 12.18.0
  • Yarn v1 Version: 1.16.0 and 1.22.5
  • OS and version: macOS 10.15.3

Related Issues

@nicklozon
Copy link

It seems yarn is matching all files against all matchers, but only files that match on positive matchers should be compared against negative matchers and then omitted.

Siegrift added a commit to api3dao/airnode that referenced this issue Jun 8, 2022
Previously we used "yarn pack" which does not work properly when there
is a negative matcher in "files" inside a package.json.

See: yarnpkg/yarn#8332 for details.
Siegrift added a commit to api3dao/airnode that referenced this issue Jun 8, 2022
Previously we used "yarn pack" which does not work properly when there
is a negative matcher in "files" inside a package.json.

See: yarnpkg/yarn#8332 for details.
Siegrift added a commit to api3dao/airnode that referenced this issue Jun 8, 2022
Previously we used "yarn pack" which does not work properly when there
is a negative matcher in "files" inside a package.json.

See: yarnpkg/yarn#8332 for details.
Siegrift added a commit to api3dao/airnode that referenced this issue Jun 8, 2022
…r airnode-examples (#1158)

* Improve TS project references structure

* Remove unused examples test

* Move airnode examples scripts to "src" folder

* Fix published artifacts for airnode-examples package

You can verify what gets published by running "npm publish --dry-run"

* Add changeset

* Make compile scripts consistent

* Add tests in "src" directory to tsconfig for tests

* Use npm to pack packages

Previously we used "yarn pack" which does not work properly when there
is a negative matcher in "files" inside a package.json.

See: yarnpkg/yarn#8332 for details.

* Revert using "npm pack" instead of "yarn pack"

Tried using "npm pack" because yarn doesn't handle negative patterns
inside "files" in package.json correctly. This broke docker artifacts
and in general is not worth fixing. This commit reverts the change and
does not use the exclude pattern in "files".
brunnre8 added a commit to thelounge/thelounge that referenced this issue Mar 12, 2023
Rather than playing whack a mole with an exclude list, let's use
an include list instead.

Yarn can't cope with negative file specs in the "files" array
yarnpkg/yarn#8332 and can't be used
brunnre8 added a commit to thelounge/thelounge that referenced this issue Mar 12, 2023
Rather than playing whack a mole with an exclude list, let's use
an include list instead.

Yarn can't cope with negative file specs in the "files" array
yarnpkg/yarn#8332 and can't be used
brunnre8 added a commit to thelounge/thelounge that referenced this issue Mar 12, 2023
Rather than playing whack a mole with an exclude list, let's use
an include list instead.

Yarn can't cope with negative file specs in the "files" array
yarnpkg/yarn#8332 and can't be used
@wcandillon
Copy link

is there a way to have the files property handled exactly the same way than on npm?

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

No branches or pull requests

3 participants