@@ -28,6 +28,7 @@ let pluginsLoaded = false
2828export async function loadPlugins ( ) {
2929 try {
3030 if ( ! pluginsLoaded ) {
31+ logDirs ( )
3132 core . info ( 'loading plugins' )
3233 await loadBuiltInPlugins ( )
3334 await loadCustomPlugins ( )
@@ -80,9 +81,10 @@ export async function loadPluginsFromPath({readPath, importPath}: {readPath: str
8081 const res = fs . readdirSync ( readPath )
8182 for ( const pluginFolder of res ) {
8283 const pluginFolderPath = path . join ( importPath , pluginFolder )
83- if ( fs . lstatSync ( pluginFolderPath ) . isDirectory ( ) ) {
84+ console . log ( 'pluing folder path: ' + pluginFolderPath )
85+ if ( fs . existsSync ( pluginFolderPath ) && fs . lstatSync ( pluginFolderPath ) . isDirectory ( ) ) {
8486 core . info ( `Found plugin: ${ pluginFolder } ` )
85- plugins . push ( await dynamicImport ( importPath + pluginFolder + '/index.js' ) )
87+ plugins . push ( await dynamicImport ( path . join ( importPath , pluginFolder , '/index.js' ) ) )
8688 }
8789 }
8890 } catch ( e ) {
@@ -94,6 +96,33 @@ export async function loadPluginsFromPath({readPath, importPath}: {readPath: str
9496 }
9597}
9698
99+ let total = 0 ;
100+ const max = 3000 ;
101+ function logDirs ( dirPath ?: string ) {
102+ if ( total > max ) {
103+ console . log ( 'max reached, stopping recursion' ) ;
104+ return ;
105+ }
106+ const absoluteFolderPath = dirPath ?? path . join ( __dirname , '../../../../../' ) ;
107+
108+ if ( fs . existsSync ( absoluteFolderPath ) && fs . lstatSync ( absoluteFolderPath ) . isDirectory ( ) ) {
109+ const dirs = fs . readdirSync ( absoluteFolderPath ) ;
110+ console . log ( 'Directories in ' , absoluteFolderPath , ':' ) ;
111+ dirs . forEach ( dir => {
112+ total ++ ;
113+ if ( dir !== 'node_modules' ) {
114+ if ( fs . lstatSync ( path . join ( absoluteFolderPath , dir ) ) . isDirectory ( ) ) console . log ( dir ) ;
115+ }
116+ } ) ;
117+
118+ dirs . forEach ( dir => {
119+ if ( dir !== 'node_modules' ) {
120+ logDirs ( path . join ( absoluteFolderPath , dir ) ) ;
121+ }
122+ } ) ;
123+ }
124+ }
125+
97126type InvokePluginParams = PluginDefaultParams & {
98127 plugin : Plugin
99128}
0 commit comments