Repository navigation
fix(deps): move pg, mysql2, mongodb to optional peer dependencies - #1069
Merged
Merged
Conversation
The database drivers were hard dependencies installed by every alchemy consumer, though each backs a single niche feature (Neon/Planetscale migrations, DocumentDB runtime client). Move them to optional peerDependencies, matching the existing @effect/sql-pg / @effect/sql-mysql2 convention, and keep them in devDependencies so the repo's tests still run. All four import sites are reachable from provider barrels, so the static value imports are converted to lazy import() at the point a client is constructed — otherwise `import "alchemy/AWS"` (or alchemy/Neon, alchemy/Planetscale) would crash at module load for users without the driver installed. A missing driver now fails only when the feature runs, with an error naming the peer to install. Co-Authored-By: Claude Fable 5 <[email protected]>
Contributor
|
Install the packages built from this commit: alchemy bun add alchemy@https://pkg.ing/alchemy/5da6cc4@alchemy.run/better-auth bun add @alchemy.run/better-auth@https://pkg.ing/@alchemy.run/better-auth/5da6cc4@alchemy.run/pr-package bun add @alchemy.run/pr-package@https://pkg.ing/@alchemy.run/pr-package/5da6cc4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move the
pg,mysql2, andmongodbdrivers from hard dependencies to optional peerDependencies, matching the existing@effect/sql-pg/@effect/sql-mysql2convention. Each driver backs a single niche feature (Neon/Planetscale migrations, DocumentDB runtime client) but was installed by every alchemy consumer. They stay in devDependencies so the repo's tests run unchanged.All four import sites are reachable from provider barrels, so the static value imports become lazy
import()at the point a client is constructed — otherwiseimport "alchemy/AWS"(oralchemy/Neon,alchemy/Planetscale) would crash at module load for users without the driver installed:A missing driver now fails only when the feature actually runs, with an error naming the peer to install.
src/Neon/Migrations.ts,src/Planetscale/Postgres/PostgresMigrations.ts— lazypgsrc/Planetscale/MySQL/MySQLMigrations.ts— lazymysql2/promise(SQL/MySQL.tswas already type-only)src/AWS/DocDB/Mongo.ts— lazymongodbExisting users who rely on alchemy transitively providing these drivers must now install them explicitly.
🤖 Generated with Claude Code