1 | let fs = require('fs/promises')
|
2 | let { spawn } = require('child_process')
|
3 | let path = require('path')
|
4 | let root = process.cwd()
|
5 |
|
6 | function npmInstall(cwd) {
|
7 | return new Promise((resolve) => {
|
8 | let childProcess = spawn('npm', ['install'], { cwd })
|
9 | childProcess.on('exit', resolve)
|
10 | })
|
11 | }
|
12 |
|
13 | async function install() {
|
14 | let base = path.resolve(root, 'integrations')
|
15 | let ignoreFolders = ['node_modules']
|
16 | let integrations = (await fs.readdir(base, { withFileTypes: true }))
|
17 | .filter((integration) => integration.isDirectory())
|
18 | .filter((integration) => !ignoreFolders.includes(integration.name))
|
19 | .map((folder) => path.resolve(base, folder.name))
|
20 | .concat([base])
|
21 | .map((integration) => npmInstall(integration))
|
22 |
|
23 | await Promise.all(integrations)
|
24 | console.log('Done!')
|
25 | }
|
26 |
|
27 | install()
|