Skip to content

Commit 569578e

Browse files
author
Diego Gadola
committed
Add npm command to build and run
1 parent f981f83 commit 569578e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

nuclear-test/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"description": "A nuclearjs test",
55
"main": "client/index.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"build": "$(npm bin)/webpack",
9+
"run": "sh run.sh"
810
},
911
"author": "Diego Gadola <[email protected]>",
1012
"license": "ISC",
@@ -20,6 +22,7 @@
2022
"css-loader": "^0.15.1",
2123
"file-loader": "^0.8.4",
2224
"jquery": "^2.1.4",
25+
"json-server": "^0.7.25",
2326
"node-libs-browser": "^0.5.2",
2427
"node-sass": "^3.2.0",
2528
"nuclear-js": "^1.0.5",

nuclear-test/run.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
echo 'Starting contacts API ...'
2+
$(npm bin)/json-server -w db.json &> /dev/null &
3+
export JS_PID=$!
4+
echo 'API started'
5+
echo 'Starting frontend server ...'
6+
cd build
7+
python -m SimpleHTTPServer &> /dev/null &
8+
export HTTP_PID=$!
9+
echo 'frontend started'
10+
trap 'kill -2 $JS_PID && kill -9 $HTTP_PID && echo API and frontend stopped.' SIGINT
11+
trap 'kill -9 $JS_PID && kill -9 $HTTP_PID && echo API and frontend stopped.' SIGKILL
12+
wait

0 commit comments

Comments
 (0)