Repository navigation
Replies: 1 comment
|
I'm not sure why we don't have it as a peer dependency actually! |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
@emdash-cms/cloudflarelistsemdashas a regular dependency with an exact version (workspace:*, published as e.g."emdash": "1.0.1"). When a site upgradesemdashbut not the adapter, or the other way round, the package manager installs a second copy ofemdashjust for the adapter. Nothing warns about it, andastro buildsucceeds.I reproduced this in an empty project with
emdash@1.1.0and@emdash-cms/cloudflare@1.0.1:node_modules/.pnpmthen contains bothemdash@1.0.1andemdash@1.1.0.The adapter imports more than the public API. It uses
emdash/migrations, the migration lock, the plugin host wire,emdash/request-contextand the database instrumentation. With two copies, these come from the older version while the site runs the newer one. I haven't traced a concrete failure from this yet, but it is the kind of drift that only shows up as an odd production bug.Use case
Any Cloudflare site that upgrades with
pnpm update emdashornpm install emdash@latestwithout touching the adapter. The templates use caret ranges for both packages (^1.0.1), so it is easy to end up with mismatched versions. I ran into it while testing the 1.0.1 to 1.1.0 upgrade.All core packages are released in a changesets
fixedgroup, so the adapter andemdashalways share a version number. The rule users need is simple: both must be the same version.Current workarounds
Upgrade both packages together, for example
pnpm add emdash@latest @emdash-cms/cloudflare@latest. A separate fix PR adds a build warning when the two versions differ, so the mismatch is at least visible. The warning does not remove the second copy.Options for a structural fix:
emdashtopeerDependencieswith an exact version (workspace:*), keeping it as a dev dependency for local builds. The site then has a singleemdash. pnpm and Yarn warn on a mismatch; npm 7+ stops the install withERESOLVEunless--legacy-peer-depsis used. That stops the bad state where it happens, but projects that already have a mismatch would fail to install on npm, so this needs a clear changeset and probably a minor release.workspace:^). I would not choose this one: it only flags an adapter that is newer thanemdash, while the reported case isemdashbeing newer.Does option 1 match how the project wants to treat the adapter, and should it wait for a minor release?
Drafted with help from Claude Opus 5.5; I reviewed and edited it.
Your involvement
All reactions