Managing imports and exports in JavaScript/TypeScript projects can quickly become messy — especially as your codebase scales. That’s where Zakaz comes in.
Zakaz is a lightweight CLI tool that automatically creates index.ts or index.js files for each folder in your project, streamlining the way you import and export modules. It helps you avoid repetitive and error-prone manual exports, making your code cleaner and more maintainable.
🔧 What Does Zakaz Do?
Zakaz recursively walks through your project directories, identifies all eligible files (typically .ts, .tsx, .js, or .jsx), and generates corresponding index.ts or index.js files that re-export them. This allows you to simply import a folder instead of specifying each file individually.
✅ Before Zakaz
import Button from './components/ui/Button';
import Input from './components/ui/Input';
✅ After Zakaz
import { Button, Input } from './components';
🚀 Installation
To install Zakaz globally or as a dev dependency:
npm install @navidmnzh/zakaz-cli
To run it instantly using npx:
npx zakaz
🛠️ CLI Options
Zakaz supports several useful flags:
+-------------------------------------------------------------------------+------+
| Description | Flag |
+-------------------------------------------------------------------------+------+
| Base path to start scanning from (default is .) | -b |
| Comma-separated list of directories to ignore (e.g., node_modules,dist) | -d |
| Show detailed logs during the generation process | -l |
+-------------------------------------------------------------------------+------+
Example:
npx zakaz -b . -d node_modules,build -l
📁 Project Structure
Zakaz’s repository is cleanly organized:
- src/: Contains the core logic (directory walker, export generator)
- bin/: Command-line entry point
- tsconfig.json: TypeScript configuration
- package.json: Metadata and dependencies
💡 Why Use Zakaz?
- Reduces boilerplate : No more repetitive export statements in every folder.
- Prevents human error : Automatically manages module exports, reducing mistakes.
- Improves scalability : Keeps your import paths consistent and clean as the project grows.
- Cross-compatible : Works with both JavaScript and TypeScript.
🚧 A Few Considerations
- The tool is actively maintained and may receive additional features in future.
- Documentation is minimal but the codebase is readable and well-structured.
🧠 Final Thoughts
Zakaz might be small, but its impact is significant — especially for growing codebases. If you’re tired of managing index.ts files manually or want to enforce cleaner architecture in your project, give Zakaz a shot.
You can check out the GitHub repository here:
🙏 Credits
Special thanks to Navid Madannezhad for creating and sharing this useful tool with the developer community. Zakaz is a great example of how small utilities can make a big difference in day-to-day development.
Top comments (0)