const fs = require ( 'fs' ) ; const { resolve , join } = require ( 'path' ) ; const cp = require ( 'child_process' ) ; const os = require ( 'os' ) ; const lib = resolve ( __dirname , './packages/' ) ; fs . readdirSync ( lib ) . forEach ( ( mod ) => { const modPath = join ( lib , mod ) ; if ( ! fs . existsSync ( join ( modPath , 'package.json' ) ) ) return ; const npmCmd = os . platform ( ) . startsWith ( 'win' ) ? 'npm.cmd' : 'npm' ; cp . spawnSync ( npmCmd , [ 'i' ] , { env : process . env , cwd : modPath , stdio : 'inherit' } ) ; cp . spawnSync ( npmCmd , [ 'run' , 'build' ] , { env : process . env , cwd : modPath , stdio : 'inherit' } ) ; } ) ;