1.1.2 • Published 7 months ago
@iwmywn/generate-index v1.1.2
@iwmywn/generate-index
This CLI tool auto-generates index.ts or index.js files to import and export modules in a folder structure. It's helpful for simplifying the process of managing imports and exports in larger projects.
Features
- Recursively scans the specified directories for 
.ts,.tsx,.js,.jsxfiles. - Generates an 
index.tsorindex.jsfile that imports and exports all modules. - Supports default and named exports.
 - Prompts for the type of index file to create if none exists.
 
Without installation
npx @iwmywn/generate-index <folder-path-1> <folder-path-2> ...Example:
npx @iwmywn/generate-index src/components src/pagesWith installation
npm i -D @iwmywn/generate-indexIn your package.json, add a script like this:
"scripts": {
  "generate:index": "iwmywn-generate-index <folder-path-1> <folder-path-2> ..."
}Example:
"scripts": {
  "generate:index": "iwmywn-generate-index src/components src/pages"
}Then run:
npm run generate:indexExample of Generated index.ts
// ⚠️ This file is auto-generated. Do not edit manually.
// For more info: https://github.com/iwmywn/iwmywn-generate-index#readme
import { SomeComponent } from "./SomeComponent";
import { AnotherComponent } from "./AnotherComponent";
import type { SomeType } from "./SomeType";
export { SomeComponent, AnotherComponent };
export type { SomeType };License
MIT License © 2025-Present Hoang Anh Tuan