Open marklawlor opened 2 years ago
_Update: Using bare double-dash for this no longer works since #1405 (v1.3.0
release), which changes the behaviour to pass arguments after the double-dash through to the command run by npm
in each workspace rather than npm
itself - probably the more useful behaviour in any case. Alternative method using npm_config_loglevel
posted in new comment below._
~~Appears to achieve the desired effect by passing --silent
after a bare double-dash
(thus passing the --silent
flag through to the npm run command rather than interpreting as a flag for turbo
) -~~
turbo run test -- --silent
Agree it would be pleasing to have this feature natively in Turborepo config to avoid the need for shell jitsu.
Turns out npm
supports passing config via environment variables using the npm_config_
prefix, so e.g. this does the trick:
npm_config_loglevel=silent turbo run test
https://docs.npmjs.com/cli/v8/using-npm/config#environment-variables https://docs.npmjs.com/cli/v8/using-npm/config#loglevel
Has anybody found a solution that works for pnpm
?
As I sometimes run turbo via npm it may be helpful to know you can chain the double dash. Example:
npm run xy -- -- --flag
What happens npm run xy -- -- --flag
-> turbo run xy -- --flag
-> xy --flag
For pnpm add
reporter=silent
to your .npmrc
(https://pnpm.io/npmrc).
This setting is undocumented, but it's equivalent to --silent
: https://github.com/pnpm/pnpm/blob/main/pnpm/src/shorthands.ts#L8
Unfortunately this silences all pnpm commands (including pnpm i
).
Describe the feature you'd like to request
Current output:
Output I'd like
Describe the solution you'd like
npm run
has a--silent
option that removes the extra lines added bynpm
when running a script. I would like an option inturbo.json
to pass this flag tonpm run
.Describe alternatives you've considered
Have an environment variable
NPM_OPTIONS
to pass extra command line flags tonpm
(similar toNODE_OPTIONS
for node), or annpm-options
attribute inturbo.json