From 6278e4730874f9476790b07f2bbe2e2321d381c8 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Thu, 1 Dec 2022 22:23:44 -0500 Subject: [PATCH] Drop the version to something more realistic, then make the version command. --- commands/version.js | 15 +++++++++++++++ package.json | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 commands/version.js diff --git a/commands/version.js b/commands/version.js new file mode 100644 index 0000000..253eb03 --- /dev/null +++ b/commands/version.js @@ -0,0 +1,15 @@ +import fs from "fs/promises"; +import path from "path"; +import url from "url"; + +export const description = "Prints out the version of the tool."; + +export const options = []; + +export const main = async (opts) => { + const pkgurl = url.parse(import.meta.url); + const pkgpath = path.parse(pkgurl.path); + const pkgfile = path.join(pkgpath.dir, "../package.json"); + const info = JSON.parse(await fs.readFile(pkgfile)); + console.log(info.version); +} diff --git a/package.json b/package.json index 05e36ea..2c44ae7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ljsthw-bandolier", - "version": "1.0.1", + "version": "0.1.1", "description": "Generates projects using the Bandolier educational framework.", "main": "bando.js", "bin": {