Create a new IndexGenerator instance
The application root directory path
Logger instance for CLI output
Set the logger instance used for CLI output
Updates the CLI logger instance for this index generator and all registered sources to use the new logger for output.
New logger instance to use
Add a new index generator source
Unique name for the source
Configuration for the index generator source
This IndexGenerator instance for method chaining
Add a file to all registered index generator sources
This method propagates the file addition to all registered sources, allowing them to regenerate their index files if the new file matches their glob patterns.
Absolute path of the file to add
Remove a file from all registered index generator sources
This method propagates the file removal to all registered sources, allowing them to regenerate their index files if the removed file was previously tracked.
Absolute path of the file to remove
Generate all registered index files
Iterates through all registered sources and generates their corresponding index files.
IndexGenerator manages the generation of index files for AdonisJS applications.
This class provides a way to configure multiple sources and generate index files that export collections of modules, typically used for barrel exports or auto-discovery patterns in AdonisJS applications.
Example