From d95bb1a511e34bc7bb643e882ba334acc7c5f720 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Fri, 2 Dec 2022 12:59:07 -0500 Subject: [PATCH] Significant cleanup thanks to @AmyShackles on Twitter. --- commands/version.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/commands/version.js b/commands/version.js index 253eb03..5116c5f 100644 --- a/commands/version.js +++ b/commands/version.js @@ -7,9 +7,7 @@ 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 pkgfile = new URL("../package.json", import.meta.url); const info = JSON.parse(await fs.readFile(pkgfile)); console.log(info.version); }