Open trusktr opened 4 years ago
LOCAL_DEV
isn't meant to be used as a normal thing. Symlinks are going to be problematic for many things with builder. Your best bet is to probably look into https://github.com/FormidableLabs/lank#readme and see if there's a lank config that can get everything to work (note that it will conflict with symlink approach if same package at issue). Good luck!
Interesting, thanks for sharing lank
. It's interesting that it takes a different approach than symlinking; I haven't seen any other tools take that approach.
Another problem is that even though LOCAL_DEV
is set, it seems to work only with the main archetype, but the variable does not have any effect on resolution of *-dev
archetypes so all the same problems persist in any project using a -dev
archetype regardless of that variable. I.e., the same problems as main archetypes without LOCAL_DEV
being set, happen with -dev
archetypes regardless of that variable being set or not.
For now, my new workaround is to simply make a package that provides a bin
, and using commander
to set up command like my-cli build
and my-cli test
, etc, that simply call functions with the equivalent names exported from a config file overridable/extendable by each project. This does not rely on mangling PATH or any env variables, its just runtime functions.
Regardless of this workaround for executing common tooling across projects, I think lank
might be useful. I'll have to try that to see how it compares with other tools that symlink. Do you think the lack of symlinks will help builder
operate as usual? If so, then maybe I don't need to implement my workaround.
Oops, I forgot to push the reproduction branch I mentioned in the OP, so I pushed it up in case someone ever wants to try to reproduce it.
For some reason, when
builder
is symlinked (for example, Lerna cross links projects in mono- or umbrella- repos using symlinks) then for some reason this causes a simple builder script that runstsc
to fork bomb and eventually crash the whole system (I need to reboot if I don't quit out of the CLI before it crashes).The script I have in my archetype is simple, like this:
This archetype, and builder itself, are both symlinked into the consuming project.
In the project, when I run
LOCAL_DEV=true builder run tsc
, then builder spawns (fork bombs?) a bunch oftsc
processes indefinitely until the OS crashes.If I try to manually run the
tsc
script manually by runningwhere
builder-js-package
is my symlinked archetype, then the process works just fine, andtsc
completes a build.So the indefinite spawning (or fork bomb) happens only when I try to run the
tsc
command via a builder script.Reproduction:
Note that all builder commands are prefixed with
LOCAL_DEV=true
, otherwise the symlinks cause builder not to find any package.json files, and thus it can't begin to run any scripts.After that last bit of output, it will be stuck continuously spawning new processes.
While it is doing that, from another terminal you can run the following repeatedly to see the number of processes growing over time (which thankfully is not happening so rapidly and the system will be responsive for a while instead of crashing right away):
Replace
<USERNAME>
with your username.For example, this is what I see in my terminal:
You can also list all of these processes:
and the list will get longer and longer by a few processes every second. It is growing by 3-5 processes or more per second (depending on your CPU speed I imagine).