We are using yarn
in this project and we don't want to write our package.json
scripts with a mix of npm
/yarn
commands.
I have a root directory which contains a few subfolders.
Each holds a different service.
I want to create a script in the root folder that npm install
each of the services, one by one.
Do you know what would be the yarn alternative to npm install <folder>
?
I'm looking for something like this psuedo command: yarn <folder>
You can specify versions using one of these: yarn add package-name installs the “latest” version of the package. yarn add [email protected] installs a specific version of a package from the registry. yarn add package-name@tag installs a specific “tag” (e.g. beta , next , or latest ).
The output directory can be changed by running yarn with the command line option --modules-folder . For example, if you wanted to install packages into a web/vendor directory instead of node_modules , you would add the modules-folder option on all yarn commands like yarn install --modules-folder web/vendor .
yarn will ensure all global packages will have their executables installed to ~/. yarn/bin . yarn global dir will print the output of the global installation folder that houses the global node_modules . By default that will be: ~/.
You could use --cwd there is a git issue about this :
yarn --cwd "your/path" script
You can also use cd :
cd "your/path" && yarn script
To run multiple commands in a single subfolder:
cd your/path && yarn && yarn some-script
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