Skip to content

Instantly share code, notes, and snippets.

@Whitecx
Last active October 29, 2021 18:56
Show Gist options
  • Save Whitecx/7d6994aacdef751d94c5603a9b630d56 to your computer and use it in GitHub Desktop.
Save Whitecx/7d6994aacdef751d94c5603a9b630d56 to your computer and use it in GitHub Desktop.
An NPM script for starting both the main server with npm start, and a react local server with npm start in separate windows. (Assumes folder structure: root->client, server
"scripts":{
"predualStart": "echo \"DIR=\"$0\"; cd \"$DIR\"; echo \"Launching React Client in New Window\"; echo \"Current directory: \"$PWD\"\"; npm --prefix \"$PWD\"/../client start;\" > clientStarter.sh && chmod +x clientStarter.sh && open -a Terminal clientStarter.sh",
"dualStart": "trap 'rm clientStarter.sh' SIGINT && nodemon --inspect -r dotenv/config -i index.js",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment