UNPKG

@arc-fusion/cli

Version:

CLI for running Arc Fusion on your local machine

44 lines (34 loc) 988 B
'use strict' const path = require('path') const { FUSION_RELEASE, PROJECT_ROOT } = require('../environment') const { dockerList } = require('../utils/docker') const spawn = require('../utils/spawn') async function rebuild20 () { const engineProcess = (await dockerList('ps')) .find((ps) => ps.includes(':9010->')) if (engineProcess) { const engineProcessId = engineProcess.split(/\s+/g)[0] return spawn('docker', ['exec', engineProcessId, 'npm', 'run', 'build:all'], { stdio: 'inherit' }) } } async function rebuild (options = {}) { const { compose } = options const command = compose === 'v2' ? 'docker' : 'docker-compose' const args = ['-f', path.join('.fusion', 'docker-compose.yml'), 'restart', 'webpack'] return spawn( command, compose === 'v2' ? ['compose'].concat(...args) : args, { cwd: PROJECT_ROOT, stdio: 'inherit' } ) } module.exports = (/^(2\.0\.|2\.0$)/i.test(FUSION_RELEASE)) ? rebuild20 : rebuild