You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add enumify:refactor command for scanning and detection
Key capabilities:
- **Scan & Detect**: Finds hardcoded enum values in `where` clauses, array assignments, comparisons, and validation rules.
- **Auto-Fix**: Refactors hardcoded strings to proper Enum references with `--fix`.
- **Key Normalization**: Converts enum keys to UPPERCASE (e.g. `case Active` -> `case ACTIVE`) and updates all references in the codebase via `--normalize-keys`.
- **Interactive Mode**: Guided prompts for safe refactoring with `--interactive`.
Changes:
- Added `RefactorCommand` with support for scanning, fixing, and reporting (JSON/CSV/MD).
- Added `refactor` configuration to \[config/enumify.php\](cci:7://file:///Users/iqbal/Sites/Open%20Source/laravel-enumify/config/enumify.php:0:0-0:0).
- Registered command in `EnumifyServiceProvider`.
- Added feature tests covering all modes.
- Updated README with detailed usage documentation.
**Auto-generate TypeScript enums and maps from Laravel PHP enums, with Vite integration.**
9
+
**Auto-generate TypeScript enums from Laravel PHP enums. Refactor hardcoded values and normalize enum keys.**
10
10
11
-
Laravel Enumify keeps frontend TypeScript enums in sync with backend PHP enums automatically. It generates files before Vite compiles, so imports never fail and no runtime fetching is needed.
11
+
Laravel Enumify keeps frontend TypeScript enums in sync with backend PHP enums automatically. It also scans your codebase for hardcoded enum values and can refactor them to use proper enum references. Includes tools for normalizing enum case names to UPPERCASE.
12
12
13
13
## Features
14
14
15
-
- 🔄 **Automatic Sync** – Runs during `npm run dev` and `npm run build` via the Vite plugin
16
-
- 🧭 **Wayfinder-Level DX** – One install command to scaffold everything
17
-
- 🏷️ **Labels Support** – `label()` or static `labels()` become TS maps
18
-
- 🎨 **Custom Methods** – Public zero-arg scalar methods become TS maps
19
-
- 📦 **Barrel Exports** – Optional `index.ts` for clean imports
20
-
- ⚡ **Smart Caching** – Only regenerate changed files using hashes
21
-
- 🔒 **Git-Friendly** – `.gitkeep` and strict `.gitignore` patterns supported
15
+
- 🔄 **Automatic Sync** – Runs during `npm run dev` and `npm run build` via the Vite plugin
16
+
- 🧭 **Wayfinder-Level DX** – One install command to scaffold everything
17
+
- 🏷️ **Labels Support** – `label()` or static `labels()` become TS maps
18
+
- 🎨 **Custom Methods** – Public zero-arg scalar methods become TS maps
19
+
- 📦 **Barrel Exports** – Optional `index.ts` for clean imports
20
+
- ⚡ **Smart Caching** – Only regenerate changed files using hashes
21
+
- 🔒 **Git-Friendly** – `.gitkeep` and strict `.gitignore` patterns supported
22
+
- 🔧 **Refactor Command** – Scan and fix hardcoded enum values in your codebase
23
+
- 🔠 **Key Normalization** – Convert enum keys to UPPERCASE and update all references
Scan your codebase for hardcoded enum values and refactor them to use proper enum references. This command also supports normalizing enum case names to UPPERCASE and updating all references throughout your application.
0 commit comments