From 7919339edc9ceff0e06fc1fcbd151cc0f8a85eb2 Mon Sep 17 00:00:00 2001 From: "James C. Davis" Date: Mon, 9 May 2022 13:02:55 -0400 Subject: [PATCH] grab version from package.json rather than rely on yargs --- lib/helpers/cli.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/helpers/cli.js b/lib/helpers/cli.js index 5bc938d48..140863d4c 100644 --- a/lib/helpers/cli.js +++ b/lib/helpers/cli.js @@ -5,12 +5,14 @@ import { globbySync } from 'globby'; import isGlob from 'is-glob'; import micromatch from 'micromatch'; import fs from 'node:fs'; +import { createRequire } from 'node:module'; import path from 'node:path'; import yargs from 'yargs'; import camelize from './camelize.js'; const STDIN = '/dev/stdin'; +const require = createRequire(import.meta.url); class NoMatchingFilesError extends Error { constructor(...params) { @@ -130,7 +132,7 @@ export function parseArgv(_argv) { .usage('$0 [options] [files..]') .options(specifiedOptions) .help() - .version(); + .version(require('../../package.json').version); parser.parserConfiguration({ 'greedy-arrays': false,