You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This effects yarn only, when running yarn pack, the field "files" specified in package.json used for whitelisting is entirely ignored because of "!src/serve-dev.*". The think the implementation in yarn is stateless meaning it will take the glob pattern of all 3 output. This results in my entire directly being published to npm when I use yarn publish which can leak unwanted secrets.
x package/LICENSE
x package/dist/vue-horizontal-list.esm.js
x package/dist/vue-horizontal-list.min.js
x package/dist/vue-horizontal-list.ssr.js
x package/package.json
x package/README.md
x package/src/vue-horizontal-list.vue
x package
x package/.DS_Store
x package/.browserslistrc
x package/.gitignore
x package/.idea
x package/.npmignore-t
x package/LICENSE
x package/README.md
x package/babel.config.js
x package/build
x package/demo.png
x package/dist
[...]
The text was updated successfully, but these errors were encountered:
The glob pattern negate flag in package.json#files is not supported in yarn, it is not written anywhere.
Apparently it's an implementation choice through looking at utils/filter.js and cli/pack.js in yarn sourcecode.
I think it might be best to mention this in the docs.
yarnpkg/yarn#7888team-innovation/vue-sfc-rollup#40fuxingloh/yarn@62b7282
There is an open bug with yarn surrounding the differences between npm and yarn in this regard. According to this comment on the thread, the comment immediately following, and the relevant article, it would seem that using .npmignore is opting for a blacklist approach instead of a whitelist. While this may work for some, it comes with more inherent risks - thus I am opting against it.
With a little tweak, I can remove the need for the negate flag entirely, and thus make the files array work for both yarn and npm. I will look into getting this done in the next patch release, which is already well under way.
This effects yarn only, when running
yarn pack
, the field"files"
specified inpackage.json
used for whitelisting is entirely ignored because of"!src/serve-dev.*"
. The think the implementation in yarn is stateless meaning it will take the glob pattern of all 3 output. This results in my entire directly being published to npm when I useyarn publish
which can leak unwanted secrets.References:
https://classic.yarnpkg.com/en/docs/package-json/#toc-files
https://docs.npmjs.com/files/package.json#files
For my project, I removed "files" and used
.npmignore
instead as they both produce the same result. fuxingloh/vue-horizontal-list@252f988More Info:
NPM:
npm pack
< 👍Version: 6.14.4
npm pack && tar -xvzf *.tgz && rm -rf package *.tgz
Output:
YARN:
yarn pack
< 👎Version: 1.22.4
yarn pack && tar -xvzf *.tgz && rm -rf package *.tgz
Output:
The text was updated successfully, but these errors were encountered: