From d56f0bcbea9288edb3f55dc337e09f56307dfa7f Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Sun, 2 Aug 2020 23:37:59 +0200 Subject: [PATCH] Add deprecate command to CLI --- cli/commands/bump.ts | 3 ++- cli/commands/deprecate.ts | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 cli/commands/deprecate.ts diff --git a/cli/commands/bump.ts b/cli/commands/bump.ts index 43050e9..d80515a 100644 --- a/cli/commands/bump.ts +++ b/cli/commands/bump.ts @@ -1,6 +1,6 @@ import { Colors } from "../deps.ts"; -import { getMeta, setMeta } from "../global.ts"; +import { getMeta, setMeta, log } from "../global.ts"; export default async function bump( options: any, @@ -26,6 +26,7 @@ export default async function bump( default: throw new Error("type must be either major, minor or patch"); } + log(major, minor, patch); const newVersion = [major, minor, patch].join("."); console.log( "Bumping version from", diff --git a/cli/commands/deprecate.ts b/cli/commands/deprecate.ts new file mode 100644 index 0000000..2e3be83 --- /dev/null +++ b/cli/commands/deprecate.ts @@ -0,0 +1,20 @@ +import { Colors, Cliffy } from "../deps.ts"; + +import { getMeta, setMeta, log } from "../global.ts"; + +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?" + ); + + if (res) { + meta.deprecated = true; + console.log(Colors.yellow("Package marked as deprecated!")); + } else { + console.log("Deprecation canceled"); + } + + await setMeta(meta); +}