Priority recommendation
P1 / tech-debt. The published migrate binary imports pg directly, but the package manifest does not install pg for consumers.
Problem
@croco/migration-runner publishes a migrate CLI at dist/cli.js. That CLI imports Pool from pg at module load time and currently only supports the postgres dialect in createDbClient. However pg is listed in devDependencies, not dependencies or peerDependencies.
An isolated consumer installing @croco/migration-runner can therefore receive a CLI binary that fails before running any migration command because the Postgres driver is not resolvable.
Evidence
packages/migration-runner/package.json:4-5 defines the local migrate bin.
packages/migration-runner/package.json:13-30 publishes the bin and CLI export from dist/cli.js / dist/cli.mjs.
packages/migration-runner/src/cli.ts:3-4 imports drizzle-orm/node-postgres and Pool from pg.
packages/migration-runner/src/cli.ts:160-173 creates a pg Pool for the postgres dialect.
packages/migration-runner/package.json:40-49 lists drizzle-orm in dependencies but puts pg in devDependencies.
Desired outcome
The published migration CLI has a correct database-driver contract:
- either
pg is installed with @croco/migration-runner for the currently supported Postgres CLI path;
- or
pg is an explicit peer/optional peer with a clear runtime diagnostic before attempting Postgres operations.
Implementation path
- Decide whether Postgres is the built-in driver for this package or an externally supplied peer.
- Move
pg to the appropriate dependency section and include any required type/runtime companion packages.
- If the driver is optional, replace top-level
pg import with a lazy import inside the Postgres branch and throw a Croco Problem with installation guidance when missing.
- Add a packed-consumer CLI smoke test that installs the package into an isolated fixture and runs
migrate --help or imports the CLI without relying on monorepo hoisting.
- If additional dialects are planned, document how each driver is declared and loaded.
Acceptance criteria
migrate --help from a packed install does not fail due to missing pg.
- A Postgres migration command either has
pg available or fails with an intentional Croco diagnostic explaining the missing peer.
- The manifest no longer relies on
devDependencies for runtime CLI imports.
- Tests cover the published CLI entrypoint, not only source-level monorepo execution.
Validation
pnpm --filter @croco/migration-runner test
pnpm --filter @croco/migration-runner typecheck
- Packed install smoke test for the
migrate binary in an isolated temp project.
Scope boundaries
- Do not change migration checkpoint semantics here.
- Do not add new dialect support unless needed to clarify the driver-loading contract.
Priority recommendation
P1 / tech-debt. The published
migratebinary importspgdirectly, but the package manifest does not installpgfor consumers.Problem
@croco/migration-runnerpublishes amigrateCLI atdist/cli.js. That CLI importsPoolfrompgat module load time and currently only supports thepostgresdialect increateDbClient. Howeverpgis listed indevDependencies, notdependenciesorpeerDependencies.An isolated consumer installing
@croco/migration-runnercan therefore receive a CLI binary that fails before running any migration command because the Postgres driver is not resolvable.Evidence
packages/migration-runner/package.json:4-5defines the localmigratebin.packages/migration-runner/package.json:13-30publishes the bin and CLI export fromdist/cli.js/dist/cli.mjs.packages/migration-runner/src/cli.ts:3-4importsdrizzle-orm/node-postgresandPoolfrompg.packages/migration-runner/src/cli.ts:160-173creates apgPool for thepostgresdialect.packages/migration-runner/package.json:40-49listsdrizzle-ormin dependencies but putspgindevDependencies.Desired outcome
The published migration CLI has a correct database-driver contract:
pgis installed with@croco/migration-runnerfor the currently supported Postgres CLI path;pgis an explicit peer/optional peer with a clear runtime diagnostic before attempting Postgres operations.Implementation path
pgto the appropriate dependency section and include any required type/runtime companion packages.pgimport with a lazy import inside the Postgres branch and throw a Croco Problem with installation guidance when missing.migrate --helpor imports the CLI without relying on monorepo hoisting.Acceptance criteria
migrate --helpfrom a packed install does not fail due to missingpg.pgavailable or fails with an intentional Croco diagnostic explaining the missing peer.devDependenciesfor runtime CLI imports.Validation
pnpm --filter @croco/migration-runner testpnpm --filter @croco/migration-runner typecheckmigratebinary in an isolated temp project.Scope boundaries