refactor(worker): restructure src into infrastructure/ + strategies/ - #37
Conversation
- db: unknown/any → PostgresJsDatabase<Record<string, unknown>> - app: Record<string, any> → App from @shipyard/shared/schema - env: any → Env from config/env - Remove all (db as any) casts and biome-ignore noExplicitAny - Suppress noExplicitAny in test files via biome overrides Closes #30
There was a problem hiding this comment.
Pull request overview
Pure refactor of packages/worker/src/ that restructures files into infrastructure/ (cross-cutting infra) and deployments/strategies/ (build packs), splits shared.ts into env-vars.ts and events.ts, renames orchestrator.ts/process-deployment.ts to pipeline.ts/processor.ts, removes the trivial jobs/deploy.ts re-export, and tightens types by replacing many any casts with App, Env, and a DB alias for PostgresJsDatabase. Test files are moved to mirror the new source layout, and a Biome override disables noExplicitAny under packages/worker/test/**.
Changes:
- Moved caddy/, docker/, log-buffer, retry into
infrastructure/; static & dockerfile deploys intodeployments/strategies/; splitshared.ts. - Replaced
anycasts in pipeline/strategies/events with properApp/Env/DBtypes. - Mirrored tests under
test/unit/infrastructure/andtest/unit/deployments/, consolidating the dockerfile test intopipeline.test.ts.
Reviewed changes
Copilot reviewed 25 out of 29 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| biome.json | Adds override disabling noExplicitAny for worker tests |
| packages/worker/src/index.ts | Updates imports to new infrastructure/processor paths |
| packages/worker/src/jobs/deploy.ts | Removed re-export module |
| packages/worker/src/infrastructure/caddy/{client,config-builder}.ts | Moved from deployments/caddy |
| packages/worker/src/infrastructure/docker/docker-runner.ts | Moved from deployments/docker |
| packages/worker/src/infrastructure/{log-buffer,retry}.ts | Moved from deployments/logs and deployments/utils |
| packages/worker/src/deployments/pipeline.ts | Renamed from orchestrator.ts; typed db and app |
| packages/worker/src/deployments/processor.ts | Renamed from process-deployment.ts; new import paths |
| packages/worker/src/deployments/{env-vars,events}.ts | Split out from shared.ts with proper DB types |
| packages/worker/src/deployments/shared.ts | Deleted (split into env-vars/events) |
| packages/worker/src/deployments/strategies/{static,dockerfile}.ts | Moved from deploy-static/deploy-dockerfile; typed params |
| packages/worker/src/deployments/steps/{build,clone,install,verify}-step.ts | Updated import paths to infrastructure/ |
| packages/worker/test/unit/infrastructure/{caddy-config,log-buffer,retry}.test.ts | Test files mirroring new layout |
| packages/worker/test/unit/deployments/{pipeline,classify-error,steps/verify-step}.test.ts | Test files mirroring new layout |
| packages/worker/test/unit/{orchestrator,deploy-dockerfile,verify-step,caddy-config}.test.ts | Old test files removed |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
closes #30