UNPKG

ae-channel-manager

Version:

A javascript library for managing AEternity payment channels for Pay-per-API call protocol

32 lines (23 loc) 918 B
const fs = require('fs') const resolve = require('path').resolve const path = require('path') const join = require('path').join const cp = require('child_process') const os = require('os') // TODO: there is small bug in this const setup = (folder) => { fs.readdirSync(folder) .forEach(function (mod) { var modPath = join(folder, mod) if(!fs.lstatSync(modPath).isDirectory()) return // ensure path has package.json if(!fs.existsSync(join(modPath, 'package.json'))) return //npm binary based on OS const npmCmd = os.platform().startsWith('win') ? 'npm.cmd' : 'npm' //install folder cp.spawn(npmCmd, ['i'], { env: process.env, cwd: modPath, stdio: 'inherit' }) cp.spawn(npmCmd, ['run', 'build'], { env: process.env, cwd: modPath, stdio: 'inherit' }) }) } let dir = resolve(__dirname, 'libs') setup(dir)