Improving update support
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Fabian Stamm 2020-10-14 22:04:18 +02:00
parent 252bf4aac3
commit ed1ce0cc0f
3 changed files with 17 additions and 4 deletions

View File

@ -1,8 +1,21 @@
import { Cliffy, Colors } from "../deps.ts";
import { version } from "../version.ts";
export default async function upgrade() {
const meta = await fetch(
"https://deno.hibas123.de/raw/@denreg-cli/meta.json"
).then((e) => e.json());
if (meta.version === version) {
const res = await Cliffy.Confirm.prompt({
message: Colors.yellow("No update available!") + " Continue?",
default: false,
});
if (!res) return;
}
const res = await Cliffy.Confirm.prompt({
message: "Are you sure you want to upgrade the denreg cli?",
message: "Are you sure you want to upgrade?",
default: true,
});
@ -14,7 +27,7 @@ export default async function upgrade() {
"-A",
"--unstable",
"-f",
"https://deno.hibas123.de/raw/@denreg-cli/denreg.ts",
`https://deno.hibas123.de/raw/@denreg-cli@${meta.version}/denreg.ts`,
],
});

View File

@ -1,6 +1,6 @@
{
"name": "@denreg-cli",
"version": "0.2.7",
"version": "0.2.9",
"description": "CLI for the DenReg package registry",
"author": "Fabian Stamm <dev@fabianstamm.de>",
"contributors": [],

View File

@ -1 +1 @@
export const version = "0.2.7"
export const version = "0.2.9"