Add automatic version reading
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c78f6822e1
commit
2ee628544e
@ -8,6 +8,13 @@ import publishCMD from "./commands/publish.ts";
|
||||
import deprecateCMD from "./commands/deprecate.ts";
|
||||
import upgradeCMD from "./commands/upgrade.ts";
|
||||
|
||||
let version = "unknown";
|
||||
|
||||
try {
|
||||
const v = await import("./version.ts");
|
||||
version = v.version;
|
||||
} catch (err) {}
|
||||
|
||||
const HOME_FOLDER = Deno.env.get("HOME") || Deno.env.get("USERPROFILE") || "";
|
||||
|
||||
type CommandHandler = (...opts: any[]) => void | Promise<void>;
|
||||
@ -26,7 +33,7 @@ const commandWrapper = (cmd: CommandHandler) => {
|
||||
};
|
||||
const flags = await new Cliffy.Command()
|
||||
.name("denreg")
|
||||
.version("1.1.9")
|
||||
.version(version)
|
||||
.description("CLI for the Open Source DenReg package registry")
|
||||
.option("-i, --interactive [interactive:boolean]", "Interactive mode", {
|
||||
default: true,
|
||||
|
@ -1,8 +1,11 @@
|
||||
{
|
||||
"name": "@denreg-cli",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.3",
|
||||
"description": "CLI for the DenReg package registry",
|
||||
"author": "Fabian Stamm <dev@fabianstamm.de>",
|
||||
"contributors": [],
|
||||
"files": ["**/*.ts", "**/*.js", "README.md"]
|
||||
"files": ["**/*.ts", "**/*.js", "README.md"],
|
||||
"hooks": {
|
||||
"prepublish": "pre.ts"
|
||||
}
|
||||
}
|
||||
|
8
cli/pre.ts
Normal file
8
cli/pre.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { FS } from "./deps.ts";
|
||||
|
||||
const meta = (await FS.readJson("./meta.json")) as any;
|
||||
|
||||
await Deno.writeTextFile(
|
||||
"version.ts",
|
||||
`export const version = "${meta.version}"`
|
||||
);
|
1
cli/version.ts
Normal file
1
cli/version.ts
Normal file
@ -0,0 +1 @@
|
||||
export const version = "0.2.3"
|
Loading…
Reference in New Issue
Block a user