From a0fef1ef76632537bfa7d0a95128178427ffa7ea Mon Sep 17 00:00:00 2001 From: User user Date: Wed, 28 Apr 2021 12:20:30 +0200 Subject: [PATCH] Improve upgrade script --- cli/commands/upgrade.ts | 34 +++++++++++++++++++++++----------- cli/meta.json | 2 +- cli/version.ts | 2 +- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/cli/commands/upgrade.ts b/cli/commands/upgrade.ts index 896cb9c..7d25d4d 100644 --- a/cli/commands/upgrade.ts +++ b/cli/commands/upgrade.ts @@ -25,27 +25,39 @@ export default async function upgrade() { }); if (res) { - const cmd = [ - "deno", - "install", - "-A", - "--unstable", - "-f", + const cmd_base = ["deno", "install", "-A", "--unstable", "-f"]; + + const cmd1 = [ + ...cmd_base, `https://deno.hibas123.de/raw/@denreg-cli@${meta.version}/denreg.ts`, ]; + const cmd2 = [ + ...cmd_base, + `https://deno.hibas123.de/raw/@denreg-cli@${meta.version}/dpm.ts`, + ]; + await requestPermOrExit( "run", "Run permission required to install new version. Or run it manually: " + - cmd.join(" ") + cmd1.join(" ") ); - const process = Deno.run({ - cmd, + const process1 = Deno.run({ + cmd: cmd1, }); - const s = await process.status(); - if (!s) { + const s1 = await process1.status(); + if (!s1) { + console.log(Colors.red("Upgrade failed!")); + } + + const process2 = Deno.run({ + cmd: cmd2, + }); + + const s2 = await process2.status(); + if (!s2) { console.log(Colors.red("Upgrade failed!")); } } diff --git a/cli/meta.json b/cli/meta.json index 7a3a969..14c52b7 100644 --- a/cli/meta.json +++ b/cli/meta.json @@ -1,6 +1,6 @@ { "name": "@denreg-cli", - "version": "0.3.2", + "version": "0.3.3", "description": "CLI for the DenReg package registry", "author": "Fabian Stamm ", "contributors": [], diff --git a/cli/version.ts b/cli/version.ts index 9df321f..1a7f98a 100644 --- a/cli/version.ts +++ b/cli/version.ts @@ -1 +1 @@ -export const version = "0.3.2" \ No newline at end of file +export const version = "0.3.3" \ No newline at end of file