1.1.2 • Published 10 months ago

@iwmywn/generate-index v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
10 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

10 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago