@@ -5,25 +5,12 @@ const globby = require('globby')
55const isBinary = require ( 'isbinaryfile' )
66const yaml = require ( 'yaml-front-matter' )
77const mergeDeps = require ( './util/mergeDeps' )
8- const { isOfficialPlugin , toShortPluginId } = require ( '@vue/cli-shared-utils' )
8+ const { getPluginLink , toShortPluginId } = require ( '@vue/cli-shared-utils' )
99
1010const isString = val => typeof val === 'string'
1111const isFunction = val => typeof val === 'function'
1212const isObject = val => val && typeof val === 'object'
1313
14- // get link for a 3rd party plugin.
15- function getLink ( id ) {
16- let pkg = { }
17- try {
18- pkg = require ( `${ id } /package.json` )
19- } catch ( e ) { }
20- return (
21- pkg . homepage ||
22- ( pkg . repository && pkg . repository . url ) ||
23- `https://www.npmjs.com/package/${ id . replace ( `/` , `%2F` ) } `
24- )
25- }
26-
2714class GeneratorAPI {
2815 /**
2916 * @param {string } id - Id of the owner plugin
@@ -39,15 +26,10 @@ class GeneratorAPI {
3926
4027 this . pluginsData = generator . plugins
4128 . filter ( ( { id } ) => id !== `@vue/cli-service` )
42- . map ( ( { id } ) => {
43- const name = toShortPluginId ( id )
44- return {
45- name : name ,
46- link : isOfficialPlugin ( id )
47- ? `https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-${ name } `
48- : getLink ( id )
49- }
50- } )
29+ . map ( ( { id } ) => ( {
30+ name : toShortPluginId ( id ) ,
31+ link : getPluginLink ( id )
32+ } ) )
5133 }
5234
5335 /**
0 commit comments