Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run gulp as child process with logging #303

Merged
merged 1 commit into from
Nov 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"node": ">=4.0 <6.7"
},
"scripts": {
"start": "if [ -d \"node_modules\" ]; then gulp; else echo 'gulp is missing - try running npm install' ; fi",
"start": "node start.js",
"lint": "standard",
"test": "npm run lint"
},
Expand Down
23 changes: 23 additions & 0 deletions start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Check for `node_modules` folder and warn if missing

var path = require('path')
var fs = require('fs')

if (!fs.existsSync(path.join(__dirname, '/node_modules'))) {
console.error('ERROR: Node module folder missing. Try running `npm install`')
process.exit(0)
}

// run gulp

var child = require('child_process')

process.env['FORCE_COLOR'] = 1
var gulp = child.spawn('gulp')
gulp.stdout.pipe(process.stdout)
gulp.stderr.pipe(process.stderr)
process.stdin.pipe(gulp.stdin)

gulp.on('exit', function (code) {
console.log('gulp exited with code ' + code.toString())
})