Created
February 6, 2017 19:55
-
-
Save shrunyan/f218fe7dd3678fd8d93279cb8d8f774f to your computer and use it in GitHub Desktop.
npm prestart script for triggering sub-app builds
This file contains 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
// @see https://strongloop.com/strongblog/modular-node-js-express/ | |
var fs = require('fs') | |
var resolve = require('path').resolve | |
var join = require('path').join | |
var cp = require('child_process') | |
// get library path | |
var src = resolve(__dirname, '../src/') | |
fs.readdirSync(src) | |
.forEach((app) => { | |
var appPath = join(src, app) | |
// ensure path has package.json | |
if (!fs.existsSync(join(appPath, 'package.json'))) return | |
// install folder | |
cp.spawn('npm', ['run', 'build'], { | |
env: process.env, | |
cwd: appPath, | |
stdio: 'inherit' | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment