1 | const fs = require('fs');
|
2 | const { resolve, join } = require('path');
|
3 | const cp = require('child_process');
|
4 | const os = require('os');
|
5 |
|
6 |
|
7 | const lib = resolve(__dirname, './packages/');
|
8 |
|
9 | fs.readdirSync(lib)
|
10 | .forEach((mod) => {
|
11 | const modPath = join(lib, mod);
|
12 |
|
13 | if (!fs.existsSync(join(modPath, 'package.json'))) return;
|
14 |
|
15 |
|
16 | const npmCmd = os.platform().startsWith('win') ? 'npm.cmd' : 'npm';
|
17 |
|
18 |
|
19 | cp.spawnSync(npmCmd, ['i'], { env: process.env, cwd: modPath, stdio: 'inherit' });
|
20 | cp.spawnSync(npmCmd, ['run', 'build'], { env: process.env, cwd: modPath, stdio: 'inherit' });
|
21 | });
|