File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010
1111For a steady stream of TILs, [ sign up for my newsletter] ( https://crafty-builder-6996.ck.page/e169c61186 ) .
1212
13- _ 1359 TILs and counting..._
13+ _ 1360 TILs and counting..._
1414
1515---
1616
@@ -467,6 +467,7 @@ _1359 TILs and counting..._
467467- [ Reach Into An Object For Nested Data With Get] ( javascript/reach-into-an-object-for-nested-data-with-get.md )
468468- [ Render An Array Of Elements With React 16] ( javascript/render-an-array-of-elements-with-react-16.md )
469469- [ Resolve And Pass Multiple Values From A Then] ( javascript/resolve-and-pass-multiple-values-from-a-then.md )
470+ - [ Run Multiple Node Scripts Concurrently] ( javascript/run-multiple-node-scripts-concurrently.md )
470471- [ Running ES6 Specs With Mocha] ( javascript/running-es6-specs-with-mocha.md )
471472- [ Scoping Variables With A Block Statement] ( javascript/scoping-variables-with-a-block-statement.md )
472473- [ Sleep For A Bit In Async Code] ( javascript/sleep-for-a-bit-in-async-code.md )
Original file line number Diff line number Diff line change 1+ # Run Multiple Node Scripts Concurrently
2+
3+ The [ ` concurrently ` npm
4+ package] ( https://github.com/open-cli-tools/concurrently ) is a CLI for
5+ concurrently running multiple commands or scripts. This is great for working in
6+ the context of a web server development where you often need several pieces of
7+ infrastructure running locally at once.
8+
9+ Assuming you have the ` concurrently ` package installed and there are several
10+ dev scripts in your ` package.json ` , here is one way this could look:
11+
12+ ``` json
13+ {
14+ "scripts" : {
15+ "dev" : " concurrently \" npm run dev:next\" \" npm run dev:inngest\" \" npm run dev:mailhog\" " ,
16+ "dev:next" : " next dev" ,
17+ "dev:inngest" : " pnpx inngest-cli@latest dev" ,
18+ "dev:mailhog" : " mailhog" ,
19+ }
20+ }
21+ ```
22+
23+ Running ` npm run dev ` would start a process that runs all three commands and
24+ combines their output.
25+
26+ A shorthand way of writing this since these commands all have the same prefix
27+ is:
28+
29+ ``` json
30+ {
31+ "scripts" : {
32+ "dev" : " concurrently \" npm:dev:*\" " ,
33+ "dev:next" : " next dev" ,
34+ "dev:inngest" : " pnpx inngest-cli@latest dev" ,
35+ "dev:mailhog" : " mailhog" ,
36+ }
37+ }
38+ ```
You can’t perform that action at this time.
0 commit comments