Created
September 13, 2017 04:23
-
-
Save matyb/249eac58d2aba51e4c60c037f5043eea to your computer and use it in GitHub Desktop.
Multi Module Node Gulpfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const gulp = require('gulp'); | |
const { spawn } = require('child_process'); | |
const { join } = require('path'); | |
const gulpmodules = ['./src_modules/common', | |
'./src_modules/client', | |
'./src_modules/server']; | |
const moduleTasks = ['default', 'clean', 'build', 'test'] | |
function moduleTask(taskNames) { | |
return () => { | |
gulpmodules.forEach((dir) => { | |
process.chdir(join(__dirname, dir)); | |
const gulpCmd = /^win/.test(process.platform) ? 'gulp.cmd' : 'gulp'; | |
const child = spawn(gulpCmd, taskNames, { customFds: [0,1,2] }); | |
child.on('exit', console.log); | |
}); | |
}; | |
}; | |
moduleTasks.forEach((task) => { gulp.task(task, moduleTask([task]));} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment