fuzzify-modules
v0.0.5-2
Published
A CLI tool to refactor modules named as index.tsx(/.jsx) in React projects to use the component's name as the file name and index.ts(/.js) to export.
Downloads
576
Readme
fuzzify-modules
A CLI tool to refactor modules named as index.tsx(/.jsx) in React projects to use the component's name as the file name and index.ts(/.js) to export.
Features
- Automatically renames index.tsx files to the component's name.
- Creates a new index.ts(/.js) file to import from the named module and export from the directory.
- Supports TypeScript projects.
- Simple, fast, and easy to use.
Installation
Run using NPM or Yarn:
npx fuzzify-modules [relative-path-to-directory] ([verbose])
- verbose (Optional): the flag prints lots of diagnostic information regarding how each file is being processed.
How It Works
- Finds all index.tsx(/.jsx) files with functional declarations and and copies them to a file with the default export name (or the first named export if no default export exists).
- Creates a new index.ts(/.js) file importing all exports from the named file and exporting them from the directory root.
Why Use This?
- Avoid ambiguity in file names.
- Easier debugging when you know the exact file name the log is generated from.
- Improved editor experience when working with multiple tabs.
- Better alignment with common TypeScript and React patterns.
- Maintain all of the above with a single bash command.
Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Acknowledgements
Special thanks to the open-source community for inspiration and contributions!