Skip to content

Commit

Permalink
fix(cli): explicitly set the version so --version works (#11461)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Josh-Walker-GM authored Sep 6, 2024
1 parent aa1e039 commit b8ebfc8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/cli/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b8ebfc8

Please sign in to comment.