Skip to content

Commit

Permalink
Added a dev run script
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Mays <maysale01@gmail.com>
  • Loading branch information
Alexander Mays committed Feb 9, 2016
1 parent 244febf commit 18f9e53
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
26 changes: 26 additions & 0 deletions bin/dev
Original file line number Diff line number Diff line change
@@ -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);
});
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 18f9e53

Please sign in to comment.