You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
801 B

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