# Changelog - Module Manager

All notable changes to the Module Manager package.

---

## [1.1.0] - 2025-01-31

### Bug Fixes

#### Critical

- **Fixed view-index.stub placeholder format** — View template used `{!! '$MODULE_NAME$' !!}` placeholders which were never replaced by the stub engine. Generated views displayed literal `$MODULE_NAME$` text instead of the actual module name. Replaced with `{{ name }}` and `{{ lowerName }}` format.

- **Fixed double route registration** — `provider.stub` contained a `registerRoutes()` method that loaded routes directly, while the command also generated a separate `RouteServiceProvider.php`. This caused all routes to be registered twice. Removed `registerRoutes()` from provider stub and added proper `RouteServiceProvider::class` registration in the `register()` method.

- **Fixed wrong PSR-4 namespace in composer.stub** — Generated `composer.json` used `App\\Modules\\` namespace prefix instead of `Modules\\`. Autoloading would fail because the actual module classes live under the `Modules\\` namespace.

#### High

- **Wired unused route-provider.stub into stub system** — `route-provider.stub` existed in the stubs directory but was never mapped in `getStub()`. The command used an inline HEREDOC instead. Refactored `createRouteServiceProvider()` to use the stub file and added it to the `$stubFiles` array.

- **Fixed PascalCase route prefixes** — Route prefixes used PascalCase (`/MyModule/`) instead of kebab-case (`/my-module/`). Added `kebabName` replacement variable. Routes now generate as `/my-module/` with names like `my-module.index`.

- **Fixed readme.stub JS ternary** — Template contained `{{ type === 'core' ? 'Cannot be deactivated' : 'Can be activated' }}` which is JavaScript syntax that PHP `str_replace` cannot evaluate. Replaced with pre-computed `{{ typeDescription }}` variable.

#### Medium

- **Replaced Vue plugin with laravel-vite-plugin in vite.stub** — Generated `vite.config.js` imported `@vitejs/plugin-vue` which is incompatible with the TALL stack (Tailwind, Alpine.js, Livewire, Laravel). Replaced with `laravel-vite-plugin` configuration.

- **Removed Vue dependencies from package.stub** — Generated `package.json` included `vue` and `@vitejs/plugin-vue` as devDependencies. Replaced with `laravel-vite-plugin` and updated Vite to `^5.0.0`.

- **Removed dead commented code from vite.stub** — Bottom of the generated `vite.config.js` had leftover commented-out code blocks.

#### Low

- **Fixed built-in vite stub placeholder** — Fallback vite stub used `$LOWER_NAME$` placeholder format instead of `{{ kebabName }}`.

- **Fixed route-provider.stub path resolution** — Changed `base_path('Modules/...')` to `module_path()` helper for consistent path resolution.

- **Removed leading blank line from module.stub** — Generated module class file had an empty line before `<?php`.

### Changes

- **Default module type changed to `custom`** — Running `php artisan module:make ModuleName` without `--type` now creates a `custom` module instead of `addon`.

- **Added Envato credential prompts for addon type** — When using `--type=addon`, the command now interactively asks for the Envato author username and product ID, and writes license validation fields to `module.json`.

### Files Modified

- `ModuleMakeCommand.php` — Replacement variables, stub wiring, built-in stub fixes, default type, Envato prompts
- `provider.stub` — Removed route loading, added RouteServiceProvider registration
- `view-index.stub` — Fixed all placeholder formats
- `route-provider.stub` — Changed to `module_path()` helper
- `composer.stub` — Fixed namespace from `App\\Modules` to `Modules`
- `routes-web.stub` — Kebab-case prefix and route names
- `routes-api.stub` — Kebab-case prefix
- `readme.stub` — Replaced JS ternary with computed variable
- `vite.stub` — Rewritten for laravel-vite-plugin
- `package.stub` — Aligned dependencies with TALL stack
- `module.stub` — Removed leading blank line
