From 2e64c9c306d4051cd564f72035e0dac825c7b964 Mon Sep 17 00:00:00 2001 From: Ryan Zimmerman Date: Thu, 30 Sep 2021 10:16:21 -0400 Subject: [PATCH 1/2] Workaround yargs bug with --version Fixes #405 --- lib/args.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/args.js b/lib/args.js index 35f0e83..1b8c412 100644 --- a/lib/args.js +++ b/lib/args.js @@ -1,4 +1,5 @@ import yargs from 'yargs' +import fs from 'fs-extra' const { argv } = yargs(process.argv.slice(2)) .usage( @@ -94,6 +95,8 @@ const { argv } = yargs(process.argv.slice(2)) type: 'string', }) .alias('h', 'help') + // HACK: Workaround for https://github.com/yargs/yargs/issues/1934 + .version(fs.readJSONSync(new URL('../package.json', import.meta.url).pathname).version) .example('$0 input.css -o output.css', 'Basic usage') .example('$0 src/**/*.css --base src --dir build', 'Glob Pattern & output') .example( From b225b9726274804dbb751b2920584139ae4d444d Mon Sep 17 00:00:00 2001 From: Ryan Zimmerman Date: Thu, 30 Sep 2021 10:27:49 -0400 Subject: [PATCH 2/2] prettier --- lib/args.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/args.js b/lib/args.js index 1b8c412..ac5388c 100644 --- a/lib/args.js +++ b/lib/args.js @@ -96,7 +96,10 @@ const { argv } = yargs(process.argv.slice(2)) }) .alias('h', 'help') // HACK: Workaround for https://github.com/yargs/yargs/issues/1934 - .version(fs.readJSONSync(new URL('../package.json', import.meta.url).pathname).version) + .version( + fs.readJSONSync(new URL('../package.json', import.meta.url).pathname) + .version + ) .example('$0 input.css -o output.css', 'Basic usage') .example('$0 src/**/*.css --base src --dir build', 'Glob Pattern & output') .example(