mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-04-22 20:38:55 -05:00
feat: hasPlugin matches router or vuex
This commit is contained in:
@@ -41,6 +41,11 @@ class PluginAPI {
|
||||
* @return {boolean}
|
||||
*/
|
||||
hasPlugin (id) {
|
||||
if (id === 'router') id = 'vue-router'
|
||||
if (['vue-router', 'vuex'].includes(id)) {
|
||||
const pkg = this.service.pkg
|
||||
return ((pkg.dependencies && pkg.dependencies[id]) || (pkg.devDependencies && pkg.devDependencies[id]))
|
||||
}
|
||||
return this.service.plugins.some(p => matchesPluginId(id, p.id))
|
||||
}
|
||||
|
||||
|
||||
@@ -374,6 +374,7 @@ class PluginApi {
|
||||
* @param {string} id Plugin id or short id
|
||||
*/
|
||||
hasPlugin (id) {
|
||||
if (id === 'router') id = 'vue-router'
|
||||
if (['vue-router', 'vuex'].includes(id)) {
|
||||
const pkg = folders.readPackage(this.cwd, this.context, true)
|
||||
return ((pkg.dependencies && pkg.dependencies[id]) || (pkg.devDependencies && pkg.devDependencies[id]))
|
||||
|
||||
@@ -213,6 +213,11 @@ module.exports = class Generator {
|
||||
}
|
||||
|
||||
hasPlugin (_id) {
|
||||
if (_id === 'router') _id = 'vue-router'
|
||||
if (['vue-router', 'vuex'].includes(_id)) {
|
||||
const pkg = this.pkg
|
||||
return ((pkg.dependencies && pkg.dependencies[_id]) || (pkg.devDependencies && pkg.devDependencies[_id]))
|
||||
}
|
||||
return [
|
||||
...this.plugins.map(p => p.id),
|
||||
...Object.keys(this.pkg.devDependencies || {}),
|
||||
|
||||
Reference in New Issue
Block a user