Search code examples
npm-installsubdirectoryyarnpkg

Is there's a command for yarn to install a subfolder?


Background:

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.

Question:

Do you know what would be the yarn alternative to npm install <folder>?

I'm looking for something like this psuedo command: yarn <folder>


Solution

  • 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