Skip to content

Commit

Permalink
Setup concurrently script with wait-on
Browse files Browse the repository at this point in the history
- Using concurrently to launch electron once react is running
- "start-react" script launches react with BROWSER=none to prevent default opening of a browser tab at launch
- "start-electron" script launches electron once wait-on received http 200 status code from http://127.0.0.1:3000
- Had to use 127.0.0.1 instead of "localhost" in the wait-on url, as wait-on can hang trying to resolve localhost. see wait-on github issues for further details (jeffbski/wait-on#109)
- Updated start script in package.json
- running npm start now launches react with BROWSER=none using cross-env, then launches electron-start to launch electron after the wait-on is successful
  • Loading branch information
hewhodevs committed Aug 10, 2022
1 parent 25ab1ce commit a3ed1b6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"start": "concurrently \"npm run start-react\" \"npm run start-electron\"",
"start-react": "cross-env BROWSER=none react-scripts start",
"start-electron": "wait-on http-get://127.0.0.1:3000 && electron .",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"start-electron": "electron ."
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
Expand Down

0 comments on commit a3ed1b6

Please sign in to comment.