Skip to content
This repository has been archived by the owner on Mar 4, 2022. It is now read-only.

Builder cannot resolve shared dependencies #145

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dusura
Copy link

@dusura dusura commented Oct 9, 2017

Perhaps this is against the general philosophy of builder but it would be nice if builder could resolve "shared" dependencies by adding any local "node_modules" folders to its path.

For example, builder will not run commands in a monorepo that uses the lerna hoist feature because it doesn't know about the monorepo's base "node_modules".

@coveralls
Copy link

coveralls commented Oct 9, 2017

Coverage Status

Coverage increased (+0.01%) to 93.675% when pulling 85fe27d on dusura:shared-dependencies into 390eaa4 on FormidableLabs:master.

@ryan-roemer
Copy link
Member

Thanks for the PR @dusura !

Can you give me a little more background here -- an example of a file layout that current builder can't handle would be a great accelerator for me to wrap my head around the problem we're solving here...

@dusura
Copy link
Author

dusura commented Oct 9, 2017

Hi @ryan-roemer. Thanks for the interest. I created a small demo so you can understand the issue.

@ryan-roemer
Copy link
Member

Thanks for the repository!

So everything works when I do:

npm install
npm run create-component
npm run bootstrap
cd component/YOUR-COMPONENT-HERE
npm install # <== I ADDED THIS
npm run figlet
[builder:config:environment] {"cwd":"/Users/rye/scm/vendor/builder-shared-dependencies-pr145/component/whiz-bang","dir":"/Users/rye/scm/vendor/builder-shared-dependencies-pr145/component/whiz-bang/node_modules/builder/lib"}
[builder:builder-core:start:91603] Started: run figlet
[builder:run] figlet - builder run figlet-cmd
[builder:proc:start] Command: builder run figlet-cmd
[builder:config:environment] {"cwd":"/Users/rye/scm/vendor/builder-shared-dependencies-pr145/component/whiz-bang","dir":"/Users/rye/scm/vendor/builder-shared-dependencies-pr145/component/whiz-bang/node_modules/builder/lib"}
[builder:builder-core:start:91604] Started: run figlet-cmd
[builder:run] figlet-cmd - figlet "my builder script!"
[builder:proc:start] Command: figlet "my builder script!"
                    _           _ _     _                           _       _   _ 
  _ __ ___  _   _  | |__  _   _(_) | __| | ___ _ __   ___  ___ _ __(_)_ __ | |_| |
 | '_ ` _ \| | | | | '_ \| | | | | |/ _` |/ _ \ '__| / __|/ __| '__| | '_ \| __| |
 | | | | | | |_| | | |_) | |_| | | | (_| |  __/ |    \__ \ (__| |  | | |_) | |_|_|
 |_| |_| |_|\__, | |_.__/ \__,_|_|_|\__,_|\___|_|    |___/\___|_|  |_| .__/ \__(_)
            |___/                                                    |_|          
[builder:proc:end:0] Command: figlet "my builder script!"
[builder:builder-core:end:91604] Task: run figlet-cmd ended normally
[builder:proc:end:0] Command: builder run figlet-cmd
[builder:builder-core:end:91603] Task: run figlet ended normally

So you're saying that normally I should be able to not add that extra npm install and still have everything work using npm CLI? I can't see how that would work as even builder isn't available in component/NAME_HERE/node_modules/.bin/builder -- it seems maybe there's an install step or maybe a "use a wrapper command to execute provided by lerna or something"?

(Separately, we have a tool to do just that -- exec commands with extra NODE_PATH to deal with non-standard installations / requires, but I'll wait on chatting more about that until if/when I'm sure it would be appropriate to discuss here).

@trusktr
Copy link

trusktr commented Feb 13, 2018

Interesting! I would've ran into this eventually, as I'm looking to start using builder in a monorepo. Related issue: #150

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants