ekomat-mobilnoe-prilozhenie/scripts/mobile-sync.js

12 lines
522 B
JavaScript

import { spawnSync } from 'node:child_process'
if (!process.env.PUBLIC_API_ORIGIN) {
throw new Error('Set PUBLIC_API_ORIGIN to the HTTPS address of the Ekomat server.')
}
for (const command of [['npm', 'run', 'build'], ['npx', '--no', 'cap', 'sync', ...process.argv.slice(2)]]) {
const [program, ...args] = command
const result = spawnSync(program, args, { stdio: 'inherit', shell: process.platform === 'win32' })
if (result.error) throw result.error
if (result.status !== 0) process.exit(result.status ?? 1)
}