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
Markdown
# ๐ฆ 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) โญ