My package.json
has a script in it like this:
"buildTslint": "node_modules/typescript/bin/tsc node_modules/awesomeLibrary_node_tslint/{,helpers/}*.ts",
Note the {,helpers/}*.ts
part, this is called Brace Expansion and is only possible in bash
, not sh
.
When running yarn buildTslint
I get the following output:
# yarn buildTslint
yarn buildTslint v0.22.0
$ node_modules/typescript/bin/tsc node_modules/awesomeLibrary_node_tslint/{,helpers/}*.ts
error TS6053: File 'node_modules/awesomeLibrary_node_tslint/{,helpers/}*.ts' not found.
error Command failed with exit code 2.
It seems that Yarn uses sh
to execute these scripts, but I'd like to use bash
for this, to be able to use brace expansion.
yarn version 1.19 added support for a new config parameter script-shell
. You can now do the following:
yarn config set script-shell /bin/bash
It may launch the command using system
function see also man 3 system
.
To see which system call is used :
strace yarn ...
system
uses fork
+exec
+wait
and the exec family functions uses shell /bin/sh
to use bash the command can be changed to bash -c 'command ..'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With