lerna run uses npm even with "npmClient": "yarn"

Created on 6 Oct 2017  路  3Comments  路  Source: lerna/lerna

Expected Behavior

When using "npmClient": "yarn", we expect all npm-related tasks to use yarn instead, including lerna run.

Current Behavior

lerna run uses npm, as seen here:

https://github.com/lerna/lerna/blob/master/src/NpmUtilities.js#L132-L153

Some unexpected consequences is that npm's run logging output is more verbose, always outputting extra noise in the log, and we can't pass --silent to it.

> @scope/[email protected] deploy /home/jenkins/workspace/_package-name_PR-917-DVIENVU5LI2MDCVW7HMFTLAJ5QZFKT4IRPA2XDKLB2TTU46VAJLQ/web/modules
> cli run-deploy

Possible Solution

Replace "npm" with

const cmd = npmClient || "npm";

And then each run instance, use cmd instead.

ChildProcessUtilities.spawnStreaming(
    cmd, ["run", script, ...args], opts, pkg.name, callback
);
help wanted

Most helpful comment

Indeed, that makes sense! If someone wants to pick this up, it would involve porting over the --npm-client from BootstrapCommand:
https://github.com/lerna/lerna/blob/7dde757d9f788f49ae605f9a7e187326518ae63e/src/commands/BootstrapCommand.js#L39-L44

and then passing to the various runScript* utilities:
https://github.com/lerna/lerna/blob/7dde757d9f788f49ae605f9a7e187326518ae63e/src/NpmUtilities.js#L125-L146

(switching to an options block for those utilities would be preferable to adding Yet Another Function Parameter)

All 3 comments

Indeed, that makes sense! If someone wants to pick this up, it would involve porting over the --npm-client from BootstrapCommand:
https://github.com/lerna/lerna/blob/7dde757d9f788f49ae605f9a7e187326518ae63e/src/commands/BootstrapCommand.js#L39-L44

and then passing to the various runScript* utilities:
https://github.com/lerna/lerna/blob/7dde757d9f788f49ae605f9a7e187326518ae63e/src/NpmUtilities.js#L125-L146

(switching to an options block for those utilities would be preferable to adding Yet Another Function Parameter)

I'm working on PR, should be finished soon

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nicolasrenon picture nicolasrenon  路  3Comments

rohyadav picture rohyadav  路  3Comments

lazd picture lazd  路  3Comments

kirill-konshin picture kirill-konshin  路  3Comments

rheaditi picture rheaditi  路  3Comments