From 450eec17c6f5328520b46b1811bc8d6fa1885e79 Mon Sep 17 00:00:00 2001 From: Zane Starr Date: Tue, 5 Jan 2021 15:18:13 -0800 Subject: [PATCH] feat: add nobuild support for install command --- src/cli/commands/machine.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cli/commands/machine.ts b/src/cli/commands/machine.ts index f6782ff..6b90eee 100644 --- a/src/cli/commands/machine.ts +++ b/src/cli/commands/machine.ts @@ -81,8 +81,9 @@ export const addMachineCommand = (config: Config): program.Command => { machineCommand.command("install ") - .description("Install a cartesi machine, resolving bundles and building a stored machine from a uri or file path specified carti-machine-package.json") - .action(async (uri) => handleInstall(config, uri)) + .description("Install a cartesi machine, installing bundles and optionally building a stored machine from a uri or file path specified carti-machine-package.json") + .option("--nobuild", "install remote machine bundles but do not build stored machine") + .action(async (uri,options) => handleInstall(config, uri,options.nobuild)) return machineCommand } @@ -109,7 +110,7 @@ async function getPackageFile(uri: string): Promise { } -async function handleInstall(config: Config, uri: string): Promise { +async function handleInstall(config: Config, uri: string, nobuild:boolean): Promise { //TODO add error handling here const packageConfig: machineConfigPackage.CartiPackage = JSON.parse(await fromStreamToStr(await getPackageFile(uri))) //check packages can all be resolved @@ -125,6 +126,9 @@ async function handleInstall(config: Config, uri: string): Promise { const path = await config.bundleStorage.path(CID.parse(bundles[0].id)) await config.localConfigStorage.add(path, [bundles[0]]) } + if(nobuild) + return + return buildMachine(config, packageConfig) }