mirror of https://github.com/embarklabs/embark.git
31 lines
874 B
JavaScript
31 lines
874 B
JavaScript
/* 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')
|
|
);
|
|
|
|
const npmCmd = process.platform === 'win32' ? 'npm.cmd': 'npm';
|
|
process.chdir(embarkCollectivePath);
|
|
spawn(npmCmd, ['run', '--', ...cliArgs], {stdio: 'inherit'});
|
|
};
|