UNPKG

alwaysai

Version:

The alwaysAI command-line interface (CLI)

47 lines 1.93 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const alwayscli_1 = require("@alwaysai/alwayscli"); const app_config_file_1 = require("../../util/app-config-file"); const target_config_file_1 = require("../../util/target-config-file"); const app_installer_1 = require("../../app-installer"); exports.appStartCliLeaf = alwayscli_1.createLeaf({ name: 'start', options: {}, description: 'Run this application "start" script on the target', async action() { const appConfig = app_config_file_1.appConfigFile.read(); const script = appConfig.scripts && appConfig.scripts.start; if (!script) { throw new alwayscli_1.TerseError('This application does not define a "start" script'); } const spawner = target_config_file_1.targetConfigFile.readSpawner(); const targetConfig = target_config_file_1.targetConfigFile.read(); switch (targetConfig.protocol) { case 'docker:': { await spawner.runForeground({ exe: '/bin/bash', args: ['-t', '-c', `. ${app_installer_1.ACTIVATE} && ${script}`], tty: true, cwd: '.', expose5000: true, }); return; } // This case differs from "docker:"" only in the extra single quotes around the command case 'ssh+docker:': { await spawner.runForeground({ exe: '/bin/bash', args: ['-t', '-c', `'. ${app_installer_1.ACTIVATE} && ${script}'`], tty: true, cwd: '.', expose5000: true, }); return; } default: { throw new Error('Unsupported protocol'); } } }, }); //# sourceMappingURL=start.js.map