-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.js
33 lines (26 loc) · 954 Bytes
/
start.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Check for `node_modules` folder and warn if missing
var path = require('path')
var fs = require('fs')
// Check if node_modules folder exists
const nodeModulesExists = fs.existsSync(path.join(__dirname, '/node_modules'))
if (!nodeModulesExists) {
console.error('ERROR: Node module folder missing. Try running `npm install`')
process.exit(0)
}
// Create template .env file if it doesn't exist
const envExists = fs.existsSync(path.join(__dirname, '/.env'))
if (!envExists) {
console.log('Creating template .env file')
fs.createReadStream(path.join(__dirname, '/lib/template.env'))
.pipe(fs.createWriteStream(path.join(__dirname, '/.env')))
}
// run gulp
var spawn = require('cross-spawn')
process.env['FORCE_COLOR'] = 1
var gulp = 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())
})