@@ -2,18 +2,37 @@ const { getPromptModules } = require('@vue/cli-global-utils/lib/util/createTools
2
2
const PromptModuleAPI = require ( '@vue/cli-global-utils/lib/PromptModuleAPI' )
3
3
const { getPresets } = require ( '@vue/cli-global-utils/lib/util/getPresets' )
4
4
const { getFeatures } = require ( '@vue/cli-global-utils/lib/util/features' )
5
- const { toShortPluginId } = require ( '@vue/cli-shared-utils' )
5
+ const {
6
+ toShortPluginId,
7
+ isPlugin,
8
+ isOfficialPlugin,
9
+ getPluginLink
10
+ } = require ( '@vue/cli-shared-utils' )
6
11
const { createProject } = require ( './create-project' )
7
12
13
+ const CLI_SERVICE = '@vue/cli-service'
14
+
8
15
module . exports = api => {
9
16
api . addProjectType ( 'vue' , 'Vue CLI' , projectType => {
10
17
projectType . logo = '/_plugin/@vue%2Fcli-guijs-plugin/vue-project.png'
11
18
12
19
// Detect Vue CLI project
13
- projectType . filterProject ( ( { pkg } ) => ( { ...pkg . dependencies , ...pkg . devDependencies } ) [ '@vue/cli-service' ] )
20
+ projectType . filterProject = ( { pkg } ) => ( { ...pkg . dependencies , ...pkg . devDependencies } ) [ '@vue/cli-service' ]
14
21
15
22
// Project creation
16
23
projectType . onCreate ( onCreate )
24
+
25
+ // Plugins
26
+ projectType . hasPlugins ( config => {
27
+ config . filterPlugin = ( { pkg } ) => isPlugin ( pkg . name ) || pkg . name === CLI_SERVICE
28
+ config . isOfficial = ( { pkg } ) => isOfficialPlugin ( pkg . name ) || pkg . name === CLI_SERVICE
29
+ config . getLink = ( { pkg } ) => {
30
+ if ( pkg . name === CLI_SERVICE ) {
31
+ return 'https://cli.vuejs.org/'
32
+ }
33
+ return getPluginLink ( pkg . name )
34
+ }
35
+ } )
17
36
} )
18
37
}
19
38
0 commit comments