[Bug] yarn pack packs hidden files that shouldn't be there
See original GitHub issue- I’d be willing to implement a fix
Describe the bug
yarn pack
packs hidden files (in my case, .babelrc) files that should not be included.
package.json
:
{
"name": "react-fit",
"version": "1.3.1",
…
"main": "dist/umd/Fit.js",
"module": "dist/esm/Fit.js",
"source": "src/Fit.jsx",
"scripts": {
"build": "yarn build-js-all",
"build-js-all": "yarn build-js-esm && yarn build-js-umd",
"build-js-esm": "cross-env BABEL_ENV=production-esm babel src -d dist/esm --ignore \"**/*.spec.js,**/*.spec.jsx\"",
"build-js-umd": "cross-env BABEL_ENV=production-umd babel src -d dist/umd --ignore \"**/*.spec.js,**/*.spec.jsx\"",
"clean": "rimraf dist",
"lint": "eslint src/ test/ --ext .jsx,.js",
"prepublishOnly": "yarn clean && yarn build",
"test": "yarn lint"
},
…
"files": [
".babelrc",
"LICENSE",
"README.md",
"dist/",
"src/"
],
…
}
Note files
that does not include test
directory.
yarn pack
output:
wojciech.maj@WS-C02XL2MTJHD2 react-fit % yarn pack
➤ YN0000: .babelrc
➤ YN0000: LICENSE
➤ YN0000: README.md
➤ YN0000: dist/esm/Fit.js
➤ YN0000: dist/esm/shared/utils.js
➤ YN0000: dist/umd/Fit.js
➤ YN0000: dist/umd/shared/utils.js
➤ YN0000: package.json
➤ YN0000: src/Fit.jsx
➤ YN0000: src/shared/utils.js
➤ YN0000: test/.babelrc
➤ YN0000: Package archive generated in /Users/wojciech.maj/Projekty/GitHub projects/react-fit/package.tgz
➤ YN0000: Done in 0.49s
Note how test/.babelrc
was added to the package.
```npm pack` output:
wojciech.maj@WS-C02XL2MTJHD2 react-fit % npm pack
npm notice
npm notice 📦 react-fit@1.3.1
npm notice === Tarball Contents ===
npm notice 332B .babelrc
npm notice 1.1kB LICENSE
npm notice 15.0kB dist/esm/Fit.js
npm notice 16.5kB dist/umd/Fit.js
npm notice 763B dist/esm/shared/utils.js
npm notice 950B dist/umd/shared/utils.js
npm notice 367B src/shared/utils.js
npm notice 1.9kB package.json
npm notice 8.6kB src/Fit.jsx
npm notice 5.6kB README.md
npm notice === Tarball Details ===
npm notice name: react-fit
npm notice version: 1.3.1
npm notice filename: react-fit-1.3.1.tgz
npm notice package size: 9.5 kB
npm notice unpacked size: 51.0 kB
npm notice shasum: 850cb5d554fdfa4b27891f62a9d290d3e7eda57b
npm notice integrity: sha512-MmVk/SXyVbxiz[...]YKNBLpbK/aI1w==
npm notice total files: 10
npm notice
react-fit-1.3.1.tgz
Note how test/.babelrc
was not added to the package.
To Reproduce
https://github.com/wojtekmaj/react-fit
run npm pack
and then yarn pack
, compare.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment if relevant (please complete the following information):
- OS: [e.g. OSX, Linux, Windows, …] macOS Big Sur
- Node version [e.g. 8.15.0, 10.15.1, …] 10.5.0
- Yarn version [e.g. 2.0.0-rc1, …] 2.2.2
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
How to ignore files from your npm package | Zell Liew
First, npm will check your repository for a .gitignore file. If there is a .gitignore file, npm will ignore files according to what's...
Read more >Configuration options | Yarn - Package Manager
List of all the configuration option for Yarn (yarnrc files) ... Yarn is a modular package manager that can resolve packages from various...
Read more >Do I commit the package-lock.json file created by npm 5?
Yes, package-lock.json is intended to be checked into source control. If you're using npm 5+, you may see this notice on the command...
Read more >When not to use package-lock.json - DEV Community
json or yarn.lock . These PRs are closed without merging because dependency lock files are not designed to be used by packages that...
Read more >What Is a Hidden File? - Lifewire
Hidden files are files with the hidden attribute set. ... they're not files that you should be changing, deleting, or moving around.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Closing as working as intended
Can we at least get a documentation update out of this?