From the course: Building Your First CLI App in Node
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Run multiple npm commands
From the course: Building Your First CLI App in Node
Run multiple npm commands
- So all of your functionality is now working in your program. Right now a user has to call each of your commander commands separately though. What we really want is for them to all run one after the other. To do that, open your package.json file and look for scripts. There should be a test listed in there as a script, so create a new line immediately after this test script. Here write start to define your start script. This start means that when a user runs npm start in your app, then these commands following start will run. Start should run all three of the commands that have been set in the index.js file. So begin with node index.js init, and after that, write in a double ampersand to make sure the next script runs after this. The next script is octocheck, and we have to write node index.js again, octocheck, one more double ampersand, and then this final one is going to be node index.js create_repo. So let's save this and go back into your terminal and now let's just try and run…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.