(name, dir)
| 75 | } |
| 76 | |
| 77 | async function installLib(name, dir) { |
| 78 | return new Promise((res, rej) => { |
| 79 | const child = spawn('npm', ['i'], {cwd: dir}) |
| 80 | |
| 81 | process.stdout.write(`Installing library "${name}" at ${dir}\n`) |
| 82 | |
| 83 | child.on('error', e => { |
| 84 | process.stdout.write(`${e.stack ?? String(e)}\n`) |
| 85 | }) |
| 86 | child.on('exit', (code, signal) => { |
| 87 | code || signal ? rej(code) : res() |
| 88 | }) |
| 89 | }) |
| 90 | } |
| 91 | |
| 92 | async function buildLib(name, dir) { |
| 93 | const {globals} = JSON.parse(await fs.readFile(`${dir}/package.json`)) |