Skip to content

fix(scripts): ship generate-* shims at package root for tsx drop-in#168

Open
tlgimenes wants to merge 1 commit into
mainfrom
tlgimenes/add-scripts-shims
Open

fix(scripts): ship generate-* shims at package root for tsx drop-in#168
tlgimenes wants to merge 1 commit into
mainfrom
tlgimenes/add-scripts-shims

Conversation

@tlgimenes

@tlgimenes tlgimenes commented May 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • 5.1.1 only ships dist/scripts/*.cjs, so existing sites running tsx node_modules/@decocms/start/scripts/generate-X.ts from their build script throw ERR_MODULE_NOT_FOUND. This restores drop-in compatibility with the 5.0.x build command.
  • Generator sources moved to scripts/_impl/ (build-only); 5 thin shims now live at scripts/generate-{blocks,sections,loaders,schema,invoke}.ts and `createRequire` the bundled dist/scripts/*.cjs. `tsup.config.ts` switched to named entries so output paths stay at `dist/scripts/.cjs`, and `package.json` `files` ships the 5 shim files.

Test plan

  • `bun run build:js` produces `dist/scripts/generate-*.cjs` at original paths
  • `bun run typecheck` clean
  • `bunx tsx scripts/check-tier-boundaries.ts` clean
  • `bun run test --run scripts/` — 298 tests pass
  • End-to-end smoke test from a fake `node_modules/@decocms/start` layout: `tsx node_modules/@decocms/start/scripts/generate-blocks.ts ...` resolves the shim and executes the bundled CJS
  • `npm pack --dry-run` confirms 5 shim files are in the tarball at `scripts/generate-*.ts`

🤖 Generated with Claude Code


Summary by cubic

Restores drop-in tsx execution of generator scripts from node_modules/@decocms/start/scripts/generate-*.ts by shipping thin shims at the package root. Fixes ERR_MODULE_NOT_FOUND introduced in 5.1.1 while keeping outputs at dist/scripts/*.cjs.

  • Bug Fixes
    • Add five shims at scripts/generate-{blocks,sections,loaders,schema,invoke}.ts that createRequire the bundled CJS, matching 5.0.x commands like tsx node_modules/@decocms/start/scripts/generate-blocks.ts.
    • Move implementations to scripts/_impl/ and switch tsup to named entries so outputs stay dist/scripts/<name>.cjs; include the shims in package.json#files for publish.

Written for commit c30af54. Summary will update on new commits.

Existing storefronts run `tsx node_modules/@decocms/start/scripts/generate-X.ts`
from their package.json build script. 5.1.1 only shipped `dist/scripts/*.cjs`,
breaking the path. Move the generator sources to `scripts/_impl/` (build-only)
and ship 5 thin tsx shims at `scripts/generate-{blocks,sections,loaders,schema,invoke}.ts`
that createRequire the bundled CJS. Verified end-to-end against a fake consumer
layout.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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