Skip to content

Commit 2142e1f

Browse files
committed
fix: add getVueMajor util
1 parent 37f16cc commit 2142e1f

File tree

1 file changed

+13
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)