Skip to content

refactor(server-manager): extract server helpers and modularize PHP stack manager - #7

Merged
fomadev-admin merged 2 commits into
mainfrom
mod
Aug 4, 2026
Merged

refactor(server-manager): extract server helpers and modularize PHP stack manager#7
fomadev-admin merged 2 commits into
mainfrom
mod

Conversation

@fordimalanda

Copy link
Copy Markdown
Member

Summary

This PR refactors PHPStackManager to reduce complexity and improve maintainability within src/serverManager.ts. Responsibilities such as logging, router generation, and workspace file visibility management have been decoupled and extracted into dedicated helper modules under src/serverHelpers/.

Key Changes

  • Extracted ServerLogger (src/serverHelpers/serverLogger.ts):
    • Isolated OutputChannel logging, request counting, and HTTP status code formatting.
  • Extracted RouterBuilder (src/serverHelpers/routerBuilder.ts):
    • Moved buildRouterContent and getRouterFilePath logic out of serverManager.ts to streamline router script template handling.
  • Extracted FileVisibility Helper (src/serverHelpers/fileVisibility.ts):
    • Created a standalone helper to manage VS Code workspace file exclusions (files.exclude).
  • Streamlined PHPStackManager (src/serverManager.ts):
    • Refactored PHPStackManager to focus strictly on process lifecycle management (start, stop, restartServer).
    • Converted _cleanup() and stop() methods to async to guarantee clean resolution of file visibility changes prior to resource teardown.

Verification

  • Tested PHP development server startup, routing, and termination to confirm feature parity.
  • Verified that HTTP status log formatting and request counting function as expected through ServerLogger.
  • Confirmed that toggling workspace file visibility resolves asynchronously without race conditions on process exit.

@fomadev-admin
fomadev-admin merged commit fd62289 into main Aug 4, 2026
1 check 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.

2 participants