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

Is lerna bootstrap supposed to install common dev dependencies into each project? #470

Closed
ryancole opened this issue Dec 30, 2016 · 6 comments

Comments

@ryancole
Copy link

ryancole commented Dec 30, 2016

It's my understanding that lerna bootstrap will install the dev dependencies defined in the outer most package.json into each child project. It's my understanding that this would be done via sym links to an outer node_modules.

I'm on Windows 10 and this does not appear to be happening with I run lerna bootstrap. Each project's own dependencies get installed but none of the dependencies from the parent package.json are installed.

Am I understanding this incorrectly? Thanks!

@cchamberlain
Copy link

I don't think this is the case. My understanding is this:

You may install common devDependencies to the lerna repo root but not CLI dependencies. This means that if one of your packages runs a babel command via its npm scripts, you must have babel-cli defined as a dev dependency of that project. The only reason that installing common devDependencies to the repo root works at all is because of node's built-in resolution of node_modules when being required from node code (it walks up the file system until it finds a node_modules directory with the package in it - in this case that could be the repo root).

The CLI references called from npm scripts don't resolve the same way, rather they will be able to hit anything in the current projects node_modules/.bin OR the global npm bin.

Would love to be corrected if I have anything off here.

@cif
Copy link
Contributor

cif commented Feb 8, 2017

THANK YOU @cchamberlain. The fact that you have to install common devDependencies at the project root and not via lerna boostrap should be in the docs / README!

I realize that this is a feature of node and not lerna but I've been using node since day one and walking up to resolve deps is news to me!

@hzoo
Copy link
Contributor

hzoo commented Feb 8, 2017

Bootstrap just links the internal dependencies together. For example with babel-x packages a lot of them rely on own other but we want to be up to date when developing so it's linked together. All the other packages are npm installed.

I think our readme explains it well? https://github.com/lerna/lerna#bootstrap - tried to be pretty verbose.

You don't have to install common devDependencies in the root - it just makes sense to do so because it will work anyways due to the resolution. and we just added a --hoist option to do it for you https://github.com/lerna/lerna/releases/tag/v2.0.0-beta.35

If something is confusing in the readme feel free to note in this issue or make a pr (if you have a question i'm sure others do as well)

@hzoo hzoo closed this as completed Feb 8, 2017
@cif
Copy link
Contributor

cif commented Feb 9, 2017

Understood on how the bootstrap command works, just wasn't clear how common devDependencies https://github.com/lerna/lerna/blob/master/README.md#common-devdependencies were actually being resolved. Turns out this is simply a node feature I wasn't aware of. My comment is that a short note explaining this in that particular section would be helpful.

@gpltaylor
Copy link

Where the hell did that little feature come from! I know this is a node thing, but I have been scratching my head wondering how to make sure all the packages are using the same version! I have been looking at webpack stats for years to work this out.

Node keeps looking up the tree for a node_modules, this is clever and a little scary.
Today is a school day 😄

@lock
Copy link

lock bot commented Dec 28, 2018

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants