0

I want to use yarn commands sequentially and run it in a node script, in the intermediate steps, and mix it with js as needed. For example

yarn audit > out.json

//some file reading, processing, and storage

for(i = 0; i < libs.length; i++) {

    yarn add lib1@v1.1.1 //need to run this in a loop
    //print the console output as this is being done
}

Is the above possible in node js or any other script that can be used in a node project?

Ganga
  • 597
  • 2
  • 9
  • 23
  • i had tried suggestion from this https://stackoverflow.com/questions/54250231/how-to-run-yarn-tag-programmatically-from-node-js, but does not work well, exits soon or errors – Ganga May 31 '21 at 17:10
  • 1
    https://stackoverflow.com/questions/4443597/node-js-execute-system-command-synchronously You can execute commands using `child_process` – Hamza Jadid May 31 '21 at 17:11

0 Answers0