Skip to content

Upgrade emdash 0.6#12

Merged
cavewebs merged 2 commits intomainfrom
upgrade-emdash-0.6
Apr 21, 2026
Merged

Upgrade emdash 0.6#12
cavewebs merged 2 commits intomainfrom
upgrade-emdash-0.6

Conversation

@cavewebs
Copy link
Copy Markdown
Contributor

Summary

  • Bumps emdash + @emdash-cms/cloudflare to ^0.6.0
  • Widens core's emdash peer range to >=0.5.0 <0.7.0
  • Regenerates the Stripe webhook body-clone patch for 0.6
  • Changeset: core patch, starter minor

Two bugs conflated in the old cf:d1:seed that made every CF D1 deploy fall over:

1. The grep filter missed 'INSERT INTO sqlite_schema' — which is how sqlite3's .dump represents FTS5 virtual tables. D1 rejects any sqlite_schema write with 'table sqlite_master may not be modified'. Error reported as an emdash/CF adapter bug was in our own plumbing.

2. wrangler auto-add (via 'Would you like Wrangler to add it on your behalf?' during 'wrangler d1 create') names bindings dashcommerce_demo / dashcommerce_demo_media, but our astro.config.mjs + emdash both expect DB / MEDIA / SESSION. Bindings drifted, runtime failed to find them.

Fixes:

scripts/cf-d1-dump.mjs — operates on a throwaway copy of data.db, drops FTS5 virtual tables + their triggers, then dumps. Filter rewrite catches sqlite_* / sqlite_schema / multiple statement-head patterns. Local dev + search stay intact because the live data.db is untouched.

scripts/cf-d1-seed.mjs — orchestrates the whole flow: bootstrap → dump → temp-patch wrangler.jsonc with CF_D1_DATABASE_ID env var → drop existing D1 tables (avoids PK collisions on rerun) → import. Always restores the template wrangler.jsonc on exit (including SIGINT). Multi-tenant-safe: the committed file stays a template, deployers bring their own id via env.

package.json cf:d1:seed — now just 'node scripts/cf-d1-seed.mjs'.

wrangler.jsonc — bindings back to canonical DB / MEDIA / SESSION, ids wiped to placeholder. Duplicate r2_buckets entry removed.

Usage:
  wrangler d1 create dashcommerce-demo
  export CF_D1_DATABASE_ID=<uuid>
  bun run cf:d1:seed

Full-text search won't work on D1 yet — FTS5 virtual tables are stripped. That's an upstream emdash/cloudflare adapter gap, separate from what this commit fixes.
0.6.0 ships the upstream fix for syncSearchState attempting first-time FTS enablement during field creation (emdash PR #595). That was the root cause of two independent pain points we spent most of a session working around:

1. Cloudflare D1 admin setup endpoint created only the first 3 of N user fields per collection and then silently stopped — the FTS enablement step crashed partway through field-creation loop. Pattern reproduced cleanly on ec_site_text (3 of 7 fields) and ec_products.
2. Postgres seed on Railway threw 'Full-text search is only available with SQLite databases' from applySeed because the same syncSearchState code path hit Postgres and bailed hard rather than skipping.

Both disappear on 0.6.

Changes:
- packages/starter: bump emdash and @emdash-cms/cloudflare to ^0.6.0
- packages/core: widen emdash peer range to '>=0.5.0 <0.7.0'; bump devDeps @emdash-cms/admin + emdash to ^0.6.0
- Regenerated the Stripe webhook body-clone patch for 0.6 (request.clone().json() x4 + plugin-route Response passthrough). Removed the stale 0.5 patch from patches/ and patchedDependencies.
- Added a changeset (core patch, starter minor) so the release pipeline handles the next publish.

Verified locally with the full CI sequence:
  rm -rf node_modules packages/*/node_modules
  bun install --frozen-lockfile
  bun run --filter '*' typecheck

All three packages exit 0 with zero errors. Unlike 0.4 -> 0.5, no storefront port needed — schemas are unchanged.
@cavewebs cavewebs merged commit e3903e5 into main Apr 21, 2026
1 check passed
@github-actions github-actions Bot mentioned this pull request Apr 21, 2026
cavewebs added a commit that referenced this pull request Apr 21, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @dashcommerce/core@0.1.4

### Patch Changes

- [#12](#12)
[`321e810`](321e810)
Thanks [@cavewebs](https://github.com/cavewebs)! - Upgrade to emdash
0.6.0.

- `@dashcommerce/core`: widen `emdash` peer range to `>=0.5.0 <0.7.0`.
Bump the bundled devDeps (`emdash`, `@emdash-cms/admin`) to `^0.6.0` so
the package builds against current types. No public API changes.
- `@dashcommerce/starter`: bump `emdash` and `@emdash-cms/cloudflare` to
`^0.6.0`. 0.6's [release fix for `syncSearchState`
FTS-during-field-creation](emdash-cms/emdash#595)
eliminates the partial-DDL issue that was truncating collection schemas
on Cloudflare D1 setup and throwing mid-seed on Postgres. Storefront
surfaced zero typecheck errors on the upgrade — no porting required.

Stripe webhook body-clone patch regenerated for 0.6
(`patches/emdash@0.6.0.patch`) since the upstream
`request.clone().json()` fix still isn't in place.

All notable changes to this package are documented here and in the
[monorepo CHANGELOG.md](../../CHANGELOG.md).

The format follows [Keep a
Changelog](https://keepachangelog.com/en/1.1.0/), and this project
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## @dashcommerce/starter@0.3.0

### Minor Changes

- [#12](#12)
[`321e810`](321e810)
Thanks [@cavewebs](https://github.com/cavewebs)! - Upgrade to emdash
0.6.0.

- `@dashcommerce/core`: widen `emdash` peer range to `>=0.5.0 <0.7.0`.
Bump the bundled devDeps (`emdash`, `@emdash-cms/admin`) to `^0.6.0` so
the package builds against current types. No public API changes.
- `@dashcommerce/starter`: bump `emdash` and `@emdash-cms/cloudflare` to
`^0.6.0`. 0.6's [release fix for `syncSearchState`
FTS-during-field-creation](emdash-cms/emdash#595)
eliminates the partial-DDL issue that was truncating collection schemas
on Cloudflare D1 setup and throwing mid-seed on Postgres. Storefront
surfaced zero typecheck errors on the upgrade — no porting required.

Stripe webhook body-clone patch regenerated for 0.6
(`patches/emdash@0.6.0.patch`) since the upstream
`request.clone().json()` fix still isn't in place.

### Patch Changes

- Updated dependencies
\[[`321e810`](321e810)]:
    -   @dashcommerce/core@0.1.4
@cavewebs cavewebs deleted the upgrade-emdash-0.6 branch April 22, 2026 06:59
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.

1 participant