Skip to content

Refactor environment handling with abstract Environment class#13

Merged
roble merged 2 commits into
mainfrom
dev
Jun 27, 2026
Merged

Refactor environment handling with abstract Environment class#13
roble merged 2 commits into
mainfrom
dev

Conversation

@roble

@roble roble commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

This pull request refactors and enhances the Saucebase installation workflow, focusing on improving module installation, Docker environment handling, and code organization. The main changes include moving and generalizing cross-module import rewriting, streamlining module installation (with better handling of fully qualified names and seeders), and refactoring the environment abstraction for better extensibility and error handling.

Installer Workflow and Module Management Improvements:

  • The logic for rewriting cross-module imports in JS files has been extracted and generalized into a public rewriteCrossModuleImports method in InstallCommand, supporting multiple frameworks and used after module installation. (src/Console/Commands/InstallCommand.php, src/Console/Commands/StackCommand.php) [1] [2] [3]
  • Module installation now supports a "fast path" for fully qualified module names, skipping unnecessary discovery, and only runs seeders if present (using the new moduleHasSeeder method). (src/Console/Commands/InstallCommand.php) [1] [2] [3]
  • The displaySuccess method now optionally lists next steps, supporting dynamic instructions from environments. (src/Console/Commands/InstallCommand.php)

Environment Abstraction and Docker Flow Refactor:

  • The Environment interface is now an abstract class, moved out of Contracts, and inherited by environment implementations. (src/Environments/Contracts/Environment.php, src/Environments/DockerEnvironment.php, src/Console/Commands/InstallCommand.php) [1] [2] [3]
  • The Docker environment has been refactored for better modularity and error handling:
    • Prerequisite checks and prompts are separated into beforePrompts, with improved SSL/mkcert guidance.
    • Module installation is now a return-value method (bool), and only proceeds if successful.
    • Next steps are dynamically generated based on environment state (e.g., app URL, SSL). (src/Environments/DockerEnvironment.php) [1] [2] [3]

Code Cleanup and Robustness:

  • Removed unused or redundant methods (e.g., reloadDocker, commandExists in Docker), improved error/warning messages, and added checks for existing app keys and file operations. (src/Environments/DockerEnvironment.php) [1] [2] [3] [4] [5]

These changes collectively make the installation process more robust, maintainable, and user-friendly, especially when using Docker and managing modules.

roble and others added 2 commits June 27, 2026 15:17
@roble roble merged commit 799e97f into main Jun 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant