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 adds unexpected files #7391

Closed
yankeguo opened this issue Jul 11, 2019 · 1 comment
Closed

yarn pack adds unexpected files #7391

yankeguo opened this issue Jul 11, 2019 · 1 comment

Comments

@yankeguo
Copy link

Do you want to request a feature or report a bug?

bug

What is the current behavior?

try run yarn pack in my project, the produced tgz file contains unexpected files.

It seems .gitignore take a higher priority over files field (white list) in package.json

  • package.json
{
  // ...
  "files": [
    "index.js",
    "index.d.ts"
  ],
 // ...
}
  • .gitignore
# ...
# typescript
*.js
!test/**/*.js
  • result of yarn pack
package
package/LICENSE
package/README.md
package/index.d.ts
package/index.js
package/package.json
package/test
package/test/scripts
package/test/testScriptlet.js
package/test/scripts/bad.js
package/test/scripts/cache.js
package/test/scripts/func1.js
package/test/scripts/load.js
package/test/scripts/loadTarget.js
package/test/scripts/loops
package/test/scripts/staticBoolean.js
package/test/scripts/staticObject.js
package/test/scripts/staticString.js
package/test/scripts/loops/loop1.js
package/test/scripts/loops/loop2.js
package/test/scripts/loops/loop3.js
  • result of npm pack
package/package.json
package/index.d.ts
package/index.js
package/LICENSE
package/README.md

If the current behavior is a bug, please provide the steps to reproduce.

Please go and check my repo https://github.com/guoyk93/scriptlet

run yarn pack and npm pack, remember to run tsc before packaging.

What is the expected behavior?

I believe yarn pack should work identically as npm pack

Please mention your node.js, yarn and operating system version.

node v10.16.0
yarn 1.16.0
npm 6.9.0
os Linux Mint 19.1 (Ubuntu 18.04 LTS)

@yankeguo
Copy link
Author

I checked src/cli/commands/pack.js and util/filter.js, it seems the logic is to load ignore files (.npmignore, if not found, load .gitignore) and then append rules to blacklist files in files field.

I think when files field is white list mode, ignore files (.gitignore, .npmignore, etc) should not be used

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

1 participant