Skip to content

Commit

Permalink
feat(gatsby-dev-cli): Add --version (#19459)
Browse files Browse the repository at this point in the history
* Support -v arg in gatsby-dev-cli

* Remove gatsby-site version info

* Update messages
  • Loading branch information
pjeziorowski authored and GatsbyJS Bot committed Nov 14, 2019
1 parent 2aae4e6 commit 38af21a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/gatsby-dev-cli/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const _ = require(`lodash`)
const path = require(`path`)
const os = require(`os`)
const watch = require(`./watch`)

const { getVersionInfo } = require(`./utils/version`)
const argv = require(`yargs`)
.usage(`Usage: gatsby-dev [options]`)
.alias(`q`, `quiet`)
Expand Down Expand Up @@ -36,7 +36,15 @@ You typically only need to configure this once.`
.array(`packages`)
.describe(`packages`, `Explicitly specify packages to copy`)
.help(`h`)
.alias(`h`, `help`).argv
.alias(`h`, `help`)
.nargs(`v`, 0)
.alias(`v`, `version`)
.describe(`v`, `Print the currently installed version of Gatsby Dev CLI`).argv

if (argv.version) {
console.log(getVersionInfo())
process.exit()
}

const conf = new Configstore(pkg.name)

Expand Down
4 changes: 4 additions & 0 deletions packages/gatsby-dev-cli/src/utils/version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
exports.getVersionInfo = () => {
const { version: devCliVersion } = require(`../../package.json`)
return `Gatsby Dev CLI version: ${devCliVersion}`
}

0 comments on commit 38af21a

Please sign in to comment.