UNPKG

dev-add

Version:

A CLI tool to scaffold components or utility files with optional templates and automated index exports.

136 lines (81 loc) โ€ข 2.73 kB
# ๐Ÿ“ฆ dev add > A powerful CLI tool to scaffold components or utility files with templates and maintain consistent exports across JavaScript/TypeScript projects. --- ## โœจ Features - ๐Ÿš€ Scaffold components/utilities with a single command - ๐Ÿ“‚ Supports batch file creation using shorthand like `[Comp1,Comp2]` - ๐Ÿ“ฆ Automatically updates or creates `index.js` for streamlined exports - ๐ŸŽฏ Supports React-style templates and named exports - ๐Ÿงช Dry-run mode for previewing actions - ๐Ÿง  Intelligent resolution of alias paths via `tsconfig.json`/`jsconfig.json` --- ## ๐Ÿ“ฆ Installation ```bash npm install -g dev-add ``` ## ๐Ÿ”ง Usage ```bash dev add <filePath> [options] ``` ### Example: ```bash dev add src/components/[Header,Footer] --template react-component --ext tsx ``` This will: - Create `Header.tsx` and `Footer.tsx` inside `src/components` - Insert default React component templates - Update or create `index.js` in the same directory --- ## โš™ Options | Option | Description | | --- | --- | | `--ext` | File extension (e.g., `tsx`, `js`, default: `tsx`) | | `--template` | Template type (e.g., `react-component`) | | `--named` | Use named exports instead of default | | `--dry` | Run without writing files (simulation only) | | `--verbose` | Print detailed logs | | `--nocomp` | Skip updating or creating `index.js` | --- ## ๐Ÿ“ Template Support - React Component (`--template react-component`) ```tsx const ComponentName = () => { return <div>ComponentName</div>; }; export default ComponentName; ``` - With `--named`: ```tsx export const ComponentName = () => { return null; }; ``` --- ## ๐Ÿ” Path Alias Resolution ย ย ย ย ย ย ย ย If your project uses path aliases in `tsconfig.json` or `jsconfig.json` (e.g., ย ย ย ย ย ย ย ย `@components/*`), the CLI internally resolves it for correct file generation. --- ## ๐Ÿงช Development ```bash # Run locally npm install npm run dev add src/utils/[math,parser] --ext ts ``` --- ## ๐Ÿ“Œ Requirements - Node.js โ‰ฅ 14.x - A valid `package.json` in the project root --- ## ๐Ÿ“ƒ License Licensed under the MIT License. --- ## ๐Ÿค Contributing Contributions, issues, and feature requests are welcome! Feel free to open an [issue](https://github.com/iamevs/dev-add/issues) or submit a PR. --- ## ๐Ÿ“ˆ Future Plans - Custom template support - Plugin architecture - In-place file updating --- ## โญ Star This Project If you find this project useful, please consider starring it on [GitHub](https://github.com/iamevs/dev-add) โญ