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

Globby finds files in lerna packages node_modules #27

Closed
Raigen opened this issue Feb 22, 2018 · 2 comments
Closed

Globby finds files in lerna packages node_modules #27

Raigen opened this issue Feb 22, 2018 · 2 comments
Labels
enhancement New feature or request

Comments

@Raigen
Copy link
Contributor

Raigen commented Feb 22, 2018

In a lerna monorepo the root's node_modules will be ignored but not node_modules from the packages. Is this intended behavior?

I am using my babel6 test repo https://github.com/Raigen/babel6-tmp

globby(['**/.babelrc', '!./node_modules/**'])

[ 'packages/pck1/.babelrc',
  'packages/pck1/node_modules/pck2/.babelrc',
  'packages/pck2/.babelrc' ]

With this pattern it works as I would expect it.

globby(['**/.babelrc', '!**/node_modules/**'])

[ 'packages/pck1/.babelrc', 'packages/pck2/.babelrc' ]

Especially for the package.json this becomes a long list when dependencies are already installed via lerna bootstrap when I run npx babel-upgrade in the repo.
This does also caused me problems in our main project. I had a dist directory with copied node_modules still lying around and that was why babel-upgrade did not updated the .babelrc, because it found a lot of package.json and it does not update .babelrc when more than one package.json is found.

@hzoo
Copy link
Member

hzoo commented Feb 22, 2018

I didn't think about supporting monorepos yet, so anything related to that isn't intended to work yet! Thanks for a report though. I guess that's the fun thing about these. Yeah there's a checkbox in the readme " monorepo support". If you'd like to work on that go ahead though!

@hzoo hzoo added the enhancement New feature or request label Feb 22, 2018
@Raigen
Copy link
Contributor Author

Raigen commented Feb 23, 2018

I already planned to do a PR for it, just wanted to doublecheck that this is not intended and my fix does not breaks other usages.

This can also occure in non-monorepos. We used to have a git-ignored dist directory which holds a copy of node_modules, so it also found those package.json files and decided to not touch the .babelrc.

While testing this out with our different projects I also found one project that puts the package.json into the build directory. I am not sure how to ignore this in all cases. Looking up .gitignore?
At least as short term solution a warning for developers to cleanup their project folder before running babel-upgrade might be a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants