Skip to content

Using learn with a reasonml/bucklescript monorepo is impossible in development #1745

@MoOx

Description

@MoOx

I have a monorepo when I am introducing more an more reasonml (to replace slowly js+flow).
I am currently using babel watch mode in development to transpile and use the code almost instantly (for unit test and/or tool itself that is using itself to built its doc website).
In addition to babel, I also now need bsb (reasonml -> javascript "transpiler" to make it short) and it's watch mode, for the same reason I transpile modern ES.

tl;dr

lerna exec --parallel -- bsb -make-world -w

is impossible to use.

According to my investigation, it's probably due to something in bsb itself, looking for stdin or crashing but in practice, changing this line

options.stdio = ["ignore", "pipe", "pipe"];

with "inherit", "pipe", "pipe" or "pipe" (just NOT using ignore for stdin), bsb watch mode (bsb -make-world -w) works with lerna exec --parallel (or --stream I guess, according to the codebase).

Expected Behavior

I would expect that lerna exec --parallel -- bsb -make-world -w works like lerna exec --parallel -- babel -w src --optional runtime --out-dir lib

Current Behavior

Currently, as soon as I use --parallel or --stream, one of the first bsb process crash

~/Sync/Development/phenomic master* ⇡ 10slerna exec --parallel -- bsb -make-world -w
lerna notice cli v3.4.3
lerna info filter [ '!website', '!@phenomic/example-*' ]
lerna info Executing command in 16 packages: "bsb -make-world -w"
@phenomic/api-client: >>>> Start compiling
@phenomic/api-client: Rebuilding since just got started
@phenomic/api-client: ninja: Entering directory `lib/bs'
@phenomic/babel-preset: >>>> Start compiling
@phenomic/babel-preset: Rebuilding since just got started
@phenomic/api-client: [1/2] Building src/phenomicApiClient.mlast
@phenomic/api-client: [2/2] Building src/phenomicApiClient.mlast.d
@phenomic/cli: >>>> Start compiling
@phenomic/cli: Rebuilding since just got started
@phenomic/core: ninja: no work to do.
@phenomic/babel-preset: ninja: Entering directory `lib/bs'
@phenomic/babel-preset: ninja: no work to do.
@phenomic/api-client: [1/1] Building src/phenomicApiClient.cmj
lerna ERR! bsb -make-world -w exited 2 in '@phenomic/api-client'
lerna ERR! bsb -make-world -w stdout:
>>>> Start compiling
Rebuilding since just got started
ninja: Entering directory `lib/bs'
[1/2] Building src/phenomicApiClient.mlast
[2/2] Building src/phenomicApiClient.mlast.d
[1/1] Building src/phenomicApiClient.cmj

lerna ERR! bsb -make-world -w exited 2 in '@phenomic/api-client'
lerna WARN complete Waiting for 15 child processes to exit. CTRL-C to exit immediately.

Possible Solution

I am not sure if not ignoring stdin for streamed spawned process is a good thing or not, but if that's an option that would fix my issue.

Steps to Reproduce (for bugs)

git clone https://github.com/phenomic/phenomic
cd phenomic
yarn
lerna exec --parallel -- bsb -make-world
lerna exec --parallel -- bsb -make-world -w

The last line will fail

Context

You got enough with the previous informations.

Your Environment

Executable Version
lerna --version 3.4.3
npm --version 6.1.0
yarn --version 1.10.1
node --version v10.7.0
OS Version
macOS 10.14

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions