vue-cli-service.js 889 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env node
  2. const semver = require('semver')
  3. const { error } = require('@vue/cli-shared-utils')
  4. const requiredVersion = require('../package.json').engines.node
  5. if (!semver.satisfies(process.version, requiredVersion)) {
  6. error(
  7. `You are using Node ${process.version}, but vue-cli-service ` +
  8. `requires Node ${requiredVersion}.\nPlease upgrade your Node version.`
  9. )
  10. process.exit(1)
  11. }
  12. const Service = require('../lib/Service')
  13. const service = new Service(process.env.VUE_CLI_CONTEXT || process.cwd())
  14. const rawArgv = process.argv.slice(2)
  15. const args = require('minimist')(rawArgv, {
  16. boolean: [
  17. // build
  18. 'modern',
  19. 'report',
  20. 'report-json',
  21. 'watch',
  22. // serve
  23. 'open',
  24. 'copy',
  25. 'https',
  26. // inspect
  27. 'verbose'
  28. ]
  29. })
  30. const command = args._[0]
  31. service.run(command, args, rawArgv).catch(err => {
  32. error(err)
  33. process.exit(1)
  34. })