Skip to content

Build and publish JS and TS defaults from one TypeScript source - #320

Open
bcomnes wants to merge 2 commits into
masterfrom
feat/typescript-default-eject
Open

Build and publish JS and TS defaults from one TypeScript source#320
bcomnes wants to merge 2 commits into
masterfrom
feat/typescript-default-eject

Conversation

@bcomnes

@bcomnes bcomnes commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Summary

Maintain one canonical TypeScript default layout, generate its JavaScript counterpart at build time, and publish both formats for language-aware eject.

  • Runtime imports the generated JavaScript directly; no runtime stripping or loader hook.
  • Eject copies the selected published format using --language js|ts (default js); --yes supports automation.
  • TypeScript eject uses public type-only imports.
  • Generated JavaScript is checked in and covered by source/output parity tests.

Versioning and packaging

  • build:defaults uses the existing esbuild dependency to generate JavaScript from the canonical TypeScript.
  • The version hook generates and explicitly stages the JS and version-dependent manifest schema with releasearoni version --add before npm creates the version commit/tag.
  • Build generates the JS before runtime-dependent tasks.
  • prepack regenerates JS and declarations so npm pack and npm publish include both languages and types.
  • Cleanup preserves versioned JS.
  • A disposable-repository lifecycle test verifies missing/stale output regeneration, version commits/tags, idempotence, and a clean build → pack → postpublish cycle without versioning the working checkout.

Validation

  • All 221 Node tests passed.
  • ESLint, TypeScript, installed-dependency checks, full build, and git diff --check passed.
  • Packed installation tests verify both eject modes, both layout files, declarations, public imports, and runtime rendering without installed TS source.
  • Packed type checks passed with Node typings 22, 24, and 26.
  • Version/build lifecycle tests passed.
  • Playwright: 11/13 passed; two documentation-navigation timeouts reproduced on unchanged prior commit 4b89976 and were left untouched.

Downstream

Unblocks bcomnes/create-domstack-app#2.
Publish this upstream change first, then update the generator dependency range before releasing create-app.

@coveralls

coveralls commented Sep 13, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 34790038278

Coverage increased (+1.1%) to 95.294%

Details

  • Coverage increased (+1.1%) from the base build.
  • Patch coverage: 113 of 113 lines across 5 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 9169
Covered Lines: 8889
Line Coverage: 96.95%
Relevant Branches: 2115
Covered Branches: 1864
Branch Coverage: 88.13%
Branches in Coverage %: Yes
Coverage Strength: 302.51 hits per line

💛 - Coveralls

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The fallback warning still inaccurately refers to root.layout.js instead of the canonical TypeScript layout.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR makes the bundled TypeScript layout canonical and adds language-aware, non-interactive layout ejection.

Changes:

  • Adds scoped TypeScript loading and packages the canonical layout.
  • Adds --language js|ts and --yes ejection options.
  • Updates runtime discovery, documentation, and validation tests.
File summaries
File Summary
test-cases/cli-errors/eject.test.js Tests ejection formats, prompts, and validation.
scripts/test-packed-types.js Validates packed layouts and generated TypeScript consumers.
package.json Packages the canonical TypeScript layout.
lib/identify-pages.js Discovers the TypeScript fallback layout; warning text still references root.layout.js.
lib/defaults/load-layout.js Loads the packaged TypeScript layout with scoped stripping.
lib/defaults/default.root.layout.ts Defines the canonical typed layout.
lib/defaults/default.root.layout.test.js Tests the canonical layout directly.
lib/build-pages/page-data.js Uses the specialized layout loader.
docs/layouts/README.md Documents layout loading and ejection.
docs/cli/README.md Documents ejection options and formats.
bin.js Implements language-aware ejection and confirmation bypass.
Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/identify-pages.js Outdated
defaultLayout = true

const defaultLayoutBasename = 'default.root.layout.js'
const defaultLayoutBasename = 'default.root.layout.ts'
@bcomnes bcomnes changed the title Use a canonical TypeScript default layout and language-aware eject Build and publish JS and TS defaults from one TypeScript source Sep 13, 2026
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.

3 participants