File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change 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+ try {
14+ fs . writeFile ( file . replace ( / \/ s r c \/ / , "/lib/" ) , babel . transformFileSync ( file ) . code ) ;
15+ } catch ( e ) {
16+ console . error ( e . message , e . stack ) ;
17+ }
18+ } ) ;
19+ } ) ;
20+
21+ try {
22+ // Run and watch dist
23+ nodemon ( {
24+ script : 'bin/parse-server' ,
25+ ext : 'js json' ,
26+ watch : 'lib'
27+ } ) ;
28+ } catch ( e ) {
29+ console . error ( e . message , e . stack ) ;
30+ }
31+
32+ process . once ( 'SIGINT' , function ( ) {
33+ process . exit ( 0 ) ;
34+ } ) ;
Original file line number Diff line number Diff line change 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 && 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" ,
You can’t perform that action at this time.
0 commit comments