mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
24 lines
569 B
JavaScript
24 lines
569 B
JavaScript
var fs = require('fs');
|
|
var path = require('path');
|
|
var spawnSync = require('child_process').spawnSync;
|
|
|
|
function runNpmCommand(dir, args) {
|
|
const result = spawnSync('npm', args, {
|
|
cwd: path.join(__dirname, dir),
|
|
stdio: 'inherit'
|
|
});
|
|
if (result.status !== 0) {
|
|
process.exit('npm test exited with non-zero code.');
|
|
}
|
|
}
|
|
|
|
fs
|
|
.readdirSync(__dirname)
|
|
.filter(file => {
|
|
return fs.statSync(path.join(__dirname, file)).isDirectory();
|
|
})
|
|
.forEach(dir => {
|
|
runNpmCommand(dir, ['install']);
|
|
runNpmCommand(dir, ['run', 'prepublish']);
|
|
});
|