From 5059f1789e562ec9819fc3de85bfd6a5dd97458f Mon Sep 17 00:00:00 2001 From: Brian Richter Date: Fri, 6 Oct 2023 11:52:03 -0700 Subject: [PATCH] binary name changes --- package.json | 11 ++++++----- src/Run.ts | 16 +++++++++++++--- tsconfig.json | 2 +- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 1f4312c..26971f4 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,18 @@ { "name": "@aviarytech/tev2-hrgt", - "version": "0.0.3", + "version": "0.0.4", "description": "Human Readable Glossary Tool (HRGT)", "main": "lib/Run.js", "types": "lib/Run.d.ts", "bin": { - "hrgt": "./lib/Run.js" + "tev2-hrgt": "./lib/Run.js" }, "type": "module", "scripts": { "build": "rm -rf lib && tsc -p .", - "rebuild": "npm uninstall @aviarytech/tev2-hrgt -g && rm lib -rf && npm run build && npm i -g", - "test": "npm run build && mocha __tests__/**/*.test.js" + "rebuild": "npm uninstall @aviarytech/tev2-hrgt -g && rm -rf lib && npm run build && npm i -g", + "test": "npm run build && mocha __tests__/**/*.test.js", + "postbuild": "cp package.json lib/" }, "repository": { "type": "git", @@ -45,4 +46,4 @@ "files": [ "lib/**/*" ] -} \ No newline at end of file +} diff --git a/src/Run.ts b/src/Run.ts index 3126533..943263f 100644 --- a/src/Run.ts +++ b/src/Run.ts @@ -6,18 +6,28 @@ import { Command } from "commander"; import { readFileSync } from "fs"; import { resolve } from "path"; import { report, log } from "./Report.js"; +import { fileURLToPath } from "url"; +import fs from "fs"; +import path from "path"; import yaml from "js-yaml"; import chalk from "chalk"; import figlet from "figlet"; +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const packageJson = JSON.parse( + fs.readFileSync(path.resolve(__dirname, "package.json"), "utf8") +); +const version = packageJson.version; + export let generator: Generator; export let glossary: Glossary; const program = new Command(); program - .name("hrgt") - .version("0.0.1") + .name("tev2-hrgt") + .version(version) .usage( "[ ] [ ]\n" + "- (optional) is a list of key-value pairs\n" + @@ -58,7 +68,7 @@ async function main(): Promise { } console.log( - chalk.red(figlet.textSync("hrgt-cli", { horizontalLayout: "full" })) + chalk.red(figlet.textSync("TEv2 HRGT", { horizontalLayout: "full" })) ); if (options.config) { diff --git a/tsconfig.json b/tsconfig.json index 18cec84..647fe32 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,5 +12,5 @@ "esModuleInterop": true, "resolveJsonModule": true }, - "exclude": ["node_modules", "**/*.test.ts"] + "exclude": ["node_modules", "**/*.test.ts", "lib/*"] } \ No newline at end of file