Skip to content

Commit

Permalink
feat: add warning about node version on startup (close #51)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 15, 2018
1 parent 67c758e commit 1118327
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
13 changes: 12 additions & 1 deletion bin/vuepress.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
#!/usr/bin/env node

const path = require('path')
const chalk = require('chalk')
const semver = require('semver')
const requiredVersion = require('../package.json').engines.node

if (!semver.satisfies(process.version, requiredVersion)) {
console.log(chalk.red(
`You are using Node ${process.version}, but VuePress ` +
`requires Node ${requiredVersion}.\nPlease upgrade your Node version.`
))
process.exit(1)
}

const path = require('path')
const { dev, build } = require('../lib')

const program = require('commander')
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"prismjs": "^1.13.0",
"register-service-worker": "^1.2.0",
"rimraf": "^2.6.2",
"semver": "^5.5.0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2",
"url-loader": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5077,7 +5077,7 @@ semver-diff@^2.0.0:
dependencies:
semver "^5.0.3"

"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0:
"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.5.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"

Expand Down

0 comments on commit 1118327

Please sign in to comment.