Added a dev run script

Signed-off-by: Alexander Mays <maysale01@gmail.com>
This commit is contained in:
Alexander Mays
2016-02-09 06:36:36 -05:00
parent 244febf4a9
commit 18f9e53405
2 changed files with 30 additions and 1 deletions

26
bin/dev Normal file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env node
var nodemon = require('nodemon');
var babel = require("babel-core");
var gaze = require('gaze');
var fs = require('fs');
// Watch the src and transpile when changed
gaze('src/**/*', function(err, watcher) {
if (err) throw err;
watcher.on('changed', function(file) {
console.log(file + " has changed");
fs.writeFile(file.replace(/\/src\//, "/lib/"), babel.transformFileSync(file).code);
});
});
// Run and watch dist
nodemon({
script: 'bin/parse-server',
ext: 'js json',
watch: 'lib'
});
process.once('SIGINT', function() {
process.exit(0);
});

View File

@@ -33,10 +33,13 @@
"babel-register": "^6.5.1",
"codecov": "^1.0.1",
"deep-diff": "^0.3.3",
"gaze": "^0.5.2",
"jasmine": "^2.3.2",
"mongodb-runner": "^3.1.15"
"mongodb-runner": "^3.1.15",
"nodemon": "^1.8.1"
},
"scripts": {
"dev": "npm run build && node bin/dev",
"build": "./node_modules/.bin/babel src/ -d lib/",
"pretest": "MONGODB_VERSION=${MONGODB_VERSION:=3.0.8} mongodb-runner start",
"test": "NODE_ENV=test TESTING=1 ./node_modules/.bin/babel-node ./node_modules/.bin/babel-istanbul cover -x **/spec/** ./node_modules/.bin/jasmine",