You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
392 B

3 months ago
  1. const { semver, loadModule } = require('@vue/cli-shared-utils')
  2. /**
  3. * Get the major Vue version that the user project uses
  4. * @param {string} cwd the user project root
  5. * @returns {2|3}
  6. */
  7. module.exports = function getVueMajor (cwd) {
  8. const vue = loadModule('vue', cwd)
  9. // TODO: make Vue 3 the default version
  10. const vueMajor = vue ? semver.major(vue.version) : 2
  11. return vueMajor
  12. }