2019-09-18 19:30:41 +00:00
|
|
|
/* global __dirname module process require */
|
|
|
|
|
|
|
|
const {spawn} = require('child_process');
|
|
|
|
const {sync: findUp} = require('find-up');
|
|
|
|
const {readJsonSync, realpathSync} = require('fs-extra');
|
|
|
|
const {join} = require('path');
|
|
|
|
|
|
|
|
module.exports = function (cliArgs) {
|
|
|
|
process.env.EMBARK_SOLO='t';
|
|
|
|
|
|
|
|
const pkgName = readJsonSync(findUp('package.json')).name;
|
|
|
|
|
|
|
|
const options = {
|
|
|
|
scope: pkgName
|
|
|
|
};
|
|
|
|
|
|
|
|
process.env.EMBARK_COLLECTIVE_OPTIONS = JSON.stringify(options);
|
|
|
|
|
|
|
|
const embarkCollectivePath = realpathSync(findUp(
|
|
|
|
'node_modules/embark-collective', {cwd: __dirname, type: 'directory'}
|
|
|
|
));
|
|
|
|
|
|
|
|
const embarkCollectivePkgJson = readJsonSync(
|
|
|
|
join(embarkCollectivePath, 'package.json')
|
|
|
|
);
|
|
|
|
|
2019-10-22 13:27:28 +00:00
|
|
|
const npmCmd = process.platform === 'win32' ? 'npm.cmd': 'npm';
|
2019-09-18 19:30:41 +00:00
|
|
|
process.chdir(embarkCollectivePath);
|
2019-10-22 13:27:28 +00:00
|
|
|
spawn(npmCmd, ['run', '--', ...cliArgs], {stdio: 'inherit'});
|
2019-09-18 19:30:41 +00:00
|
|
|
};
|