2018-09-26 05:49:14 +08:00
|
|
|
const path = require('path');
|
|
|
|
const child_process = require('child_process');
|
|
|
|
|
|
|
|
const moduleName = process.argv[2];
|
|
|
|
if (!moduleName) {
|
|
|
|
console.error("Expected module name");
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
const argString = process.argv.length > 3 ? process.argv.slice(3).join(" ") : "";
|
|
|
|
if (!argString) {
|
2019-03-12 19:06:57 +08:00
|
|
|
console.error("Expected an yarn argument string to use");
|
2018-09-26 05:49:14 +08:00
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
const modulePath = path.dirname(require.resolve(`${moduleName}/package.json`));
|
|
|
|
|
2019-03-12 19:06:57 +08:00
|
|
|
child_process.execSync("yarn " + argString, {
|
2018-09-26 05:49:14 +08:00
|
|
|
env: process.env,
|
|
|
|
cwd: modulePath,
|
2018-09-26 05:54:38 +08:00
|
|
|
stdio: ['inherit', 'inherit', 'inherit'],
|
2018-09-26 05:49:14 +08:00
|
|
|
});
|