Skip to content

Commit

Permalink
Added separate build task and few logging
Browse files Browse the repository at this point in the history
  • Loading branch information
pgmanutd committed Oct 4, 2016
1 parent ce47a80 commit 65e3a83
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
6 changes: 4 additions & 2 deletions gulp-tasks/server.js
Expand Up @@ -13,8 +13,10 @@ gulp.task('forever', 'Run Express Server', () => {
};

PLUGINS.foreverMonitor(pkg.config.main, foreverMonitorOptions)
.on('watch:restart', () => {
log('Server Restarted! Get a cup of coffee!');
.on('start', () => {
log('************');
log('Server Starting..!!');
log('************');
})
.on('exit', () => {
log('Server down!');
Expand Down
24 changes: 15 additions & 9 deletions gulpfile.babel.js
Expand Up @@ -20,6 +20,21 @@ gulp.task('set-prod-node-env', () => {

requireDir('./gulp-tasks');

// Build Task
gulp.task('build', 'Script building Task', (done) => {
const allTasks = ['scripts'];

if (IS_PRODUCTION) {
allTasks.unshift('set-prod-node-env');
} else {
allTasks.unshift('set-dev-node-env');
}

runSequence(...allTasks, () => {
done();
});
});

// Default Task
gulp.task('default', 'Default Task', (done) => {
const allTasks = ['clean', 'scripts'];
Expand All @@ -35,7 +50,6 @@ gulp.task('default', 'Default Task', (done) => {
}

runSequence(...allTasks, () => {
readyMessage();
done();
});
}, {
Expand All @@ -44,11 +58,3 @@ gulp.task('default', 'Default Task', (done) => {
'type=production': 'Run on production, Default is development'
}
});

/////////////////////

function readyMessage() {
log('************');
log('Ready! Let the hacking begin!');
log('************');
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -48,7 +48,7 @@
"flow": "gulp flow",
"check": "gulp test && gulp eslint && gulp flow",
"coveralls": "cat ./coverage*/*/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
"build": "gulp clean && gulp set-dev-node-env && gulp scripts --unwatch && gulp set-prod-node-env && gulp scripts --type=production && gulp copy",
"build": "gulp clean && gulp build && gulp build --type=production && gulp copy",
"patch": "gulp version:patch && npm run build && gulp year:version && npm publish",
"minor": "gulp version:minor && npm run build && gulp year:version && npm publish",
"major": "gulp version:major && npm run build && gulp year:version && npm publish"
Expand Down
1 change: 1 addition & 0 deletions server.babel.js
Expand Up @@ -15,6 +15,7 @@ if (process.env.NODE_ENV === prod) {
res.sendFile(`${__dirname}/${dest}/index.html`);
});
} else {
console.log('\nPlease wait for webpack bundle....\n');
useWebpackMiddlewareWithWatch(app);
}

Expand Down

0 comments on commit 65e3a83

Please sign in to comment.