From 6de29a4550073dc8a90cdfe20a429a54133186bf Mon Sep 17 00:00:00 2001 From: Josh GM Walker <56300765+Josh-Walker-GM@users.noreply.github.com> Date: Fri, 6 Sep 2024 23:10:29 +0100 Subject: [PATCH] fix(cli): explicitly set the version so `--version` works (#11461) For whatever reason the `--version` flag broke in v8. The code to explicitly set the version for yargs is 2 lines so we may as well be explicit and in doing so we fix the problem. --- packages/cli/src/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/cli/src/index.js b/packages/cli/src/index.js index cd2dc2502650..e91c0b3d8d03 100644 --- a/packages/cli/src/index.js +++ b/packages/cli/src/index.js @@ -227,6 +227,10 @@ async function runYargs() { // Load any CLI plugins await loadPlugins(yarg) + // We explicitly set the version here so that it's always available + const pkgJson = require('../package.json') + yarg.version(pkgJson['version']) + // Run await yarg.parse(process.argv.slice(2), {}, (err, _argv, output) => { // Configuring yargs with `strict` makes it error on unknown args;