1.1.2 • Published 7 months ago

@iwmywn/generate-index v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

@iwmywn/generate-index

npm version npm downloads bundle JSDocs License

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, .jsx files.
  • Generates an index.ts or index.js file 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/pages

With installation

npm i -D @iwmywn/generate-index

In 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:index

Example 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

1.1.2

7 months ago

1.1.1

7 months ago

1.1.0

7 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago