diff --git a/CLAUDE.md b/CLAUDE.md index 67d41b8..075a0a1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -35,7 +35,7 @@ composer install 2. `generateApplicationKey()` — skips if `APP_KEY` already set 3. `setupDatabase()` — runs `migrate` (or `migrate:fresh` with `--fresh`) with seed 4. `runStack()` — calls `saucebase:stack` with the selected framework -5. `setupModules()` — fetches available modules from Packagist, `composer require`s selected ones, then: `dump-autoload` → `applyModulePatches()` → `modules:sync` → per-module `modules:migrate` + `modules:seed` +5. `setupModules()` — fetches available modules from Packagist, batches all selected into one `composer require` call, then: `applyModulePatches()` → `modules:sync` → `migrate --force` (auto-discovered via InterNACHI/modular) → `db:seed --module={name} --force` per module 6. `createStorageLink()` + `clearCaches()` **Docker flow** (`DockerEnvironment::run()`): @@ -48,7 +48,7 @@ composer install 7. `startDocker()` — `docker compose restart` + `docker compose up -d --wait --build` (30 min timeout, streaming output) 8. `runComposerInContainer()` — `composer install` in the `app` container 9. `generateAppKey()` → `runMigrations()` → `runStack()` — artisan steps in the container via `execInContainer()` -10. `installModules()` — per module: `composer require` in container → `applyModulePatches()` on host → `modules:sync` → `modules:migrate` → `modules:seed` in container +10. `installModules()` — single batched `composer require` for all modules in container → `applyModulePatches()` on host → `modules:sync` → `migrate --force` → `db:seed --module={name} --force` per module in container 11. `createStorageLink()` + `clearCaches()` in container 12. `reloadDocker()` — `docker compose up -d --wait` diff --git a/README.md b/README.md index 0b39107..84b1722 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Prompts for the frontend stack (Vue or React) and the environment driver (Docker 4. Patches `.env` with Docker-appropriate defaults — MySQL credentials, `MAIL_MAILER=smtp` for Mailpit, and `APP_URL` matching the SSL choice 5. Starts `docker compose` and installs PHP dependencies inside the container 6. Generates `APP_KEY`, runs migrations, wires up the frontend stack -7. Installs any selected modules (`composer require` → patches → `modules:sync` → `modules:migrate` → `modules:seed` per module) +7. Installs any selected modules (single `composer require` for all → patches → `modules:sync` → `migrate` → `db:seed --module` per module) 8. Creates the storage symlink and clears caches **Native driver** (`--driver=native`): diff --git a/src/Console/Commands/InstallCommand.php b/src/Console/Commands/InstallCommand.php index 78739b4..7059e3b 100644 --- a/src/Console/Commands/InstallCommand.php +++ b/src/Console/Commands/InstallCommand.php @@ -342,16 +342,16 @@ protected function setupModules(): void return $process->isSuccessful(); }); - foreach ($selected as $package) { - $name = Str::after($package, '/'); + $this->components->task('Running module migrations', function () { + $process = new Process([PHP_BINARY, base_path('artisan'), 'migrate', '--force']); + $process->setTimeout(300); + $process->run(); - $this->components->task("Migrating {$name}", function () use ($name) { - $process = new Process([PHP_BINARY, base_path('artisan'), 'modules:migrate', "--module={$name}", '--force']); - $process->setTimeout(120); - $process->run(); + return $process->isSuccessful(); + }); - return $process->isSuccessful(); - }); + foreach ($selected as $package) { + $name = Str::after($package, '/'); $this->components->task("Seeding {$name}", function () use ($name) { $process = new Process([PHP_BINARY, base_path('artisan'), 'db:seed', "--module={$name}", '--force']); diff --git a/src/Environments/DockerEnvironment.php b/src/Environments/DockerEnvironment.php index 2d8d832..c0ef0bb 100644 --- a/src/Environments/DockerEnvironment.php +++ b/src/Environments/DockerEnvironment.php @@ -250,10 +250,10 @@ protected function installModules(InstallCommand $command): void $command->applyModulePatches($modules); $this->execInContainer($command, ['php', 'artisan', 'modules:sync']); + $this->execInContainer($command, ['php', 'artisan', 'migrate', '--force'], timeout: 300); foreach ($modules as $package) { $name = Str::after($package, '/'); - $this->execInContainer($command, ['php', 'artisan', 'modules:migrate', "--module={$name}", '--force'], timeout: 120); $this->execInContainer($command, ['php', 'artisan', 'db:seed', "--module={$name}", '--force']); } }