How to use the @vuepress/core/package.json.engines function in @vuepress/core

To help you get started, we’ve selected a few @vuepress/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vuejs / vuepress / packages / @vuepress / cli / index.js View on Github external
const { chalk } = require('@vuepress/shared-utils')
const semver = require('semver')

try {
  require.resolve('@vuepress/core')
} catch (err) {
  console.log(chalk.red(
    `\n[vuepress] @vuepress/cli ` +
    `requires @vuepress/core to be installed.\n`
  ))
  process.exit(1)
}

const pkg = require('@vuepress/core/package.json')
const requiredVersion = pkg.engines.node

if (!semver.satisfies(process.version, requiredVersion)) {
  console.log(chalk.red(
    `\n[vuepress] minimum Node version not met:` +
    `\nYou are using Node ${process.version}, but VuePress ` +
    `requires Node ${requiredVersion}.\nPlease upgrade your Node version.\n`
  ))
  process.exit(1)
}

const cli = require('cac')()

exports.cli = cli
exports.bootstrap = function ({
  plugins,
  theme