Add upgrade command

This commit is contained in:
Fabian Stamm 2020-08-16 19:28:27 +02:00
parent 438cee6bed
commit c78f6822e1
5 changed files with 37 additions and 2 deletions

View File

@ -9,6 +9,7 @@ Since the cli requires access to:
- reading and writing files
- access to environment variables
- network access
- run programs
The -A flag is the easiest way to install. You can however manually grant the required permissions.
@ -18,3 +19,4 @@ The -A flag is the easiest way to install. You can however manually grant the re
| --allow-write | Write configuration file while using setup and init as well as during publish for temporary files |
| --allow-net | Access to network for uploading to the registry (can be exclusive to the registry) |
| --allow-env | Required to get config file path relative to user home directory |
| --allow-run | Required to run hook scripts |

View File

@ -6,7 +6,7 @@ export default async function deprecate(options: any) {
const meta = await getMeta();
const res = await Cliffy.Confirm.prompt(
"Are you shure you want to deprecat this package?"
"Are you sure you want to deprecat this package?"
);
if (res) {

26
cli/commands/upgrade.ts Normal file
View File

@ -0,0 +1,26 @@
import { Cliffy, Colors } from "../deps.ts";
export default async function upgrade() {
const res = await Cliffy.Confirm.prompt({
message: "Are you sure you want to upgrade the denreg cli?",
default: true,
});
if (res) {
const process = Deno.run({
cmd: [
"deno",
"install",
"-A",
"--unstable",
"-f",
"https://deno.hibas123.de/raw/@denreg-cli/denreg.ts",
],
});
const s = await process.status();
if (!s) {
console.log(Colors.red("Upgrade failed!"));
}
}
}

View File

@ -6,6 +6,7 @@ import initCMD from "./commands/init.ts";
import bumpCMD from "./commands/bump.ts";
import publishCMD from "./commands/publish.ts";
import deprecateCMD from "./commands/deprecate.ts";
import upgradeCMD from "./commands/upgrade.ts";
const HOME_FOLDER = Deno.env.get("HOME") || Deno.env.get("USERPROFILE") || "";
@ -74,6 +75,12 @@ const flags = await new Cliffy.Command()
.description("Deprecate package")
.action(commandWrapper(deprecateCMD))
)
.command(
"upgrade",
new Cliffy.Command()
.description("Upgrade to latest version of denreg cli")
.action(commandWrapper(upgradeCMD))
)
.command("completions", new Cliffy.CompletionsCommand())
.parse(Deno.args);

View File

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