Skip to content

Commit 18f9e53

Browse files
author
Alexander Mays
committed
Added a dev run script
Signed-off-by: Alexander Mays <[email protected]>
1 parent 244febf commit 18f9e53

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

Diff for: bin/dev

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env node
2+
3+
var nodemon = require('nodemon');
4+
var babel = require("babel-core");
5+
var gaze = require('gaze');
6+
var fs = require('fs');
7+
8+
// Watch the src and transpile when changed
9+
gaze('src/**/*', function(err, watcher) {
10+
if (err) throw err;
11+
watcher.on('changed', function(file) {
12+
console.log(file + " has changed");
13+
fs.writeFile(file.replace(/\/src\//, "/lib/"), babel.transformFileSync(file).code);
14+
});
15+
});
16+
17+
// Run and watch dist
18+
nodemon({
19+
script: 'bin/parse-server',
20+
ext: 'js json',
21+
watch: 'lib'
22+
});
23+
24+
process.once('SIGINT', function() {
25+
process.exit(0);
26+
});

Diff for: package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@
3333
"babel-register": "^6.5.1",
3434
"codecov": "^1.0.1",
3535
"deep-diff": "^0.3.3",
36+
"gaze": "^0.5.2",
3637
"jasmine": "^2.3.2",
37-
"mongodb-runner": "^3.1.15"
38+
"mongodb-runner": "^3.1.15",
39+
"nodemon": "^1.8.1"
3840
},
3941
"scripts": {
42+
"dev": "npm run build && node bin/dev",
4043
"build": "./node_modules/.bin/babel src/ -d lib/",
4144
"pretest": "MONGODB_VERSION=${MONGODB_VERSION:=3.0.8} mongodb-runner start",
4245
"test": "NODE_ENV=test TESTING=1 ./node_modules/.bin/babel-node ./node_modules/.bin/babel-istanbul cover -x **/spec/** ./node_modules/.bin/jasmine",

0 commit comments

Comments
 (0)