File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed
Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -52,15 +52,29 @@ async function fetchPackagePlugins(dirctory: string): Promise<InitxPluginInfo[]>
5252 const packageJson = fs . readJsonSync ( packageJsonPath )
5353 const { dependencies = { } , devDependencies = { } } = packageJson
5454
55- return Object . keys ( {
55+ const plugins : InitxPluginInfo [ ] = [ ]
56+
57+ Object . keys ( {
5658 ...dependencies ,
5759 ...devDependencies
58- } )
59- . filter ( name => regexps . plugin . test ( name ) && ! regexps . exclude . test ( name ) )
60- . map ( name => ( {
60+ } ) . forEach ( ( name ) => {
61+ if ( ! regexps . plugin . test ( name ) || regexps . exclude . test ( name ) ) {
62+ return
63+ }
64+
65+ const root = pathe . resolve ( dirctory , 'node_modules' , name )
66+
67+ if ( ! fs . existsSync ( root ) ) {
68+ return
69+ }
70+
71+ plugins . push ( {
6172 name,
62- root : pathe . resolve ( dirctory , 'node_modules' , name )
63- } ) )
73+ root
74+ } )
75+ } )
76+
77+ return plugins
6478}
6579
6680async function fetchProjectPlugins ( ) : Promise < InitxPluginInfo [ ] > {
You can’t perform that action at this time.
0 commit comments