-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 does not honor globs in "files" option of package.json #3336
Comments
Keeping notes for myself: yarn pack eventually calls: this line with the following filters: [ { base: '.',
isNegation: true,
regex: /^(?:\/(?=.)package\.json)$/i },
{ base: '.',
isNegation: true,
regex: /^(?:\/(?=.)readme[^\/]*?)$/i },
{ base: '.',
isNegation: true,
regex: /^(?:\/(?!\.)(?=.)(?:license|licence)+[^\/]*?)$/i },
{ base: '.',
isNegation: true,
regex: /^(?:\/(?!\.)(?=.)(?:changes|changelog|history)+[^\/]*?)$/i },
{ base: '.',
isNegation: false,
regex: /^(?:(?!\.)(?=.)[^\/]*?)$/i },
{ base: '.', isNegation: false, regex: /^(?:(?=.)\.[^\/]*?)$/i },
{ base: '.',
isNegation: true,
regex: /^(?:(?=.)config\/(?:(?!(?:\/|^)\.).)*?\/(?!\.)(?=.)[^\/]*?\.js)$/i },
{ base: '.',
isNegation: true,
regex: /^(?:(?=.)lib\/(?:(?!(?:\/|^)\.).)*?\/(?!\.)(?=.)[^\/]*?\.js)$/i },
{ base: '.',
isNegation: false,
regex: /^(?:\/(?=.)node_modules)$/i },
{ base: 'files',
isNegation: true,
regex: /^(?:(?=.)\.gitignore)$/i },
{ base: 'files',
isNegation: false,
regex: /^(?:(?!\.)(?=.)[^\/]*?)$/i } ] |
More notes: it ends up calling to here with the following context: filter = { base: '.',
isNegation: true,
regex: /^(?:(?=.)lib\/(?:(?!(?:\/|^)\.).)*?\/(?!\.)(?=.)[^\/]*?\.js)$/i }
basename = 'myfile.js'
loc = 'lib/myfile.js'
// matchesFilter(...) returns false in this case |
So this is effectively console.logging Ignore list: !/package.json
!/readme*
!/+(license|licence)*
!/+(changes|changelog|history)*
*
.*
!config/**/*.js
!lib/**/*.js
/lib/
/node_modules/
!.gitignore |
Interesting: const mm = require('minimatch')
const loc = 'lib/sftp.js'
const re = mm.makeRe('lib/**/*.js', {nocase: true})
re.test(loc) // => false
mm(loc, 'lib/**/*.js', {nocase: true}) // => true minimatch version: 3.0.3 |
See this line (#648) in minimatch.js |
Send a PR with tests please :) |
@bestander I have a PR here: /pull/3339, and per your request I have added a fixture + a test that tests this. I am having trouble getting the tests to pass: sometimes an async timeout error is thrown. Is that normal? |
Yeah, I am ashamed that our tests are flaky sometimes. |
* Switch to micromatch: fixes yarnpkg/yarn#3336 * Trim patterns before generating RegExp Test suite now passes * Add test + test fixtures to test micromatch * Oops. Actually add the fixtures to Git this time * Update yarn.lock reverted registry change
Do you want to request a feature or report a bug? bug
What is the current behavior?
My package.json "files" option specifies globs as entries:
When I run
yarn pack
it produces a.tgz
file with the following entries:However, when I run
npm pack
, it packs the following files instead:If the current behavior is a bug, please provide the steps to reproduce.
See above
What is the expected behavior?
See the
npm pack
outputPlease mention your node.js, yarn and operating system version.
node: v7.7.3
yarn: v0.23.4
OS: macOS Sierra 10.12.2
The text was updated successfully, but these errors were encountered: