From 22a447604b16f79b0faf88a43bbca89805b9f205 Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Thu, 15 Apr 2021 17:20:09 +0200 Subject: [PATCH] Update to work with newer deno versions --- cli/denreg.ts | 3 ++- cli/deps.ts | 10 +++++----- cli/global.ts | 10 ++++++---- cli/meta.json | 8 ++------ cli/pre.ts | 2 +- cli/version.ts | 2 +- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/cli/denreg.ts b/cli/denreg.ts index 9076548..ba2670b 100644 --- a/cli/denreg.ts +++ b/cli/denreg.ts @@ -84,6 +84,7 @@ const flags = await new Cliffy.Command() .action(commandWrapper(upgradeCMD)) ) .command("completions", new Cliffy.CompletionsCommand()) + .command("help", new Cliffy.HelpCommand().global()) .parse(Deno.args); await init(flags.options); @@ -95,5 +96,5 @@ if (command) { console.log(Colors.bold(Colors.red("An error occured:")), err.message); } } else { - flags.cmd.help(); + flags.cmd.showHelp(); } diff --git a/cli/deps.ts b/cli/deps.ts index 5de8173..1e3bc74 100644 --- a/cli/deps.ts +++ b/cli/deps.ts @@ -1,7 +1,7 @@ export * as Compress from "https://deno.hibas123.de/raw/@denreg-tar/mod.ts"; export * as Ini from "https://deno.land/x/ini@v2.1.0/mod.ts"; -export * as Cliffy from "https://deno.land/x/cliffy@v0.16.0/mod.ts"; -export * as Base64 from "https://deno.land/std@0.65.0/encoding/base64.ts"; -export * as FS from "https://deno.land/std@0.65.0/fs/mod.ts"; -export * as Colors from "https://deno.land/std@0.65.0/fmt/colors.ts"; -export * as Path from "https://deno.land/std@0.65.0/path/mod.ts"; +export * as Cliffy from "https://deno.land/x/cliffy@v0.18.2/mod.ts"; +export * as Base64 from "https://deno.land/std@0.91.0/encoding/base64.ts"; +export * as FS from "https://deno.land/std@0.91.0/fs/mod.ts"; +export * as Colors from "https://deno.land/std@0.91.0/fmt/colors.ts"; +export * as Path from "https://deno.land/std@0.91.0/path/mod.ts"; diff --git a/cli/global.ts b/cli/global.ts index 8fcf6a9..6243f57 100644 --- a/cli/global.ts +++ b/cli/global.ts @@ -42,16 +42,18 @@ export async function setConfig(name: string, value: string) { }); } +const readJson = (name: string) => Deno.readTextFile(name).then(JSON.parse); +const writeJson = (name: string, value: any, spaces?: string) => + Deno.writeTextFile(name, JSON.stringify(value, null, spaces)); + export async function getMeta() { log("Reading meta.json"); - return (await FS.readJson("meta.json")) as IMeta; + return (await readJson("meta.json")) as IMeta; } export async function setMeta(meta: IMeta): Promise { log("Saving meta.json"); - return FS.writeJson("meta.json", meta, { - spaces: " ", - }); + return writeJson("meta.json", meta, " "); } let interactive = true; diff --git a/cli/meta.json b/cli/meta.json index f4f5c1b..f82f94a 100644 --- a/cli/meta.json +++ b/cli/meta.json @@ -1,14 +1,10 @@ { "name": "@denreg-cli", - "version": "0.2.10", + "version": "0.2.11", "description": "CLI for the DenReg package registry", "author": "Fabian Stamm ", "contributors": [], - "files": [ - "**/*.ts", - "**/*.js", - "README.md" - ], + "files": ["**/*.ts", "**/*.js", "README.md"], "hooks": { "prepublish": "pre.ts" } diff --git a/cli/pre.ts b/cli/pre.ts index a872ab7..415113c 100644 --- a/cli/pre.ts +++ b/cli/pre.ts @@ -1,6 +1,6 @@ import { FS } from "./deps.ts"; -const meta = (await FS.readJson("./meta.json")) as any; +const meta = (await Deno.readTextFile("./meta.json").then(JSON.parse)) as any; await Deno.writeTextFile( "version.ts", diff --git a/cli/version.ts b/cli/version.ts index eb10c2b..0336e56 100644 --- a/cli/version.ts +++ b/cli/version.ts @@ -1 +1 @@ -export const version = "0.2.10" \ No newline at end of file +export const version = "0.2.11" \ No newline at end of file