Skip to content

Run tests from source, persist the ttsc cache in CI, and export only the root entry - #103

Merged
samchon merged 3 commits into
masterfrom
chore/ttsx-runtime-cleanup
Sep 22, 2026
Merged

samchon merged 3 commits into
masterfrom
chore/ttsx-runtime-cleanup

Conversation

@samchon

@samchon samchon commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Follow-up review of #102. Everything here came out of a "review until dry" pass over that PR's toolchain changes, with the goal that nothing depends on cwd, execution mode, or duplicated configuration.

Tests run from source only

ttsx injects its loader into NODE_OPTIONS, so child_process.fork() and worker_threads.Worker children execute .ts files directly (verified for both). That removes the need for:

  • test/node/runtime.ts, which rewrote test/**/*.ts to bin/test/**/*.js based on process.cwd();
  • the __filename.endsWith(".ts") / process.cwd() branches in TestBundler and test_worker_compiler;
  • the .ts/.js extension switch in test/node/index.ts.

test:browser now runs through ttsx --project test/tsconfig.json too, so both suites share one execution mode and every path is __dirname-relative. build:test remains because browserify consumes the emitted JavaScript.

Also fixed while there: the test runner built paths with "/" on Windows, so location === __filename never matched; it now uses path.join. A leftover debug console.log in the runner is gone, as is the unused source-map-support dependency.

ttsc cache in CI

Per the ttsc build-cache docs: actions/cache after pnpm install, path plugins/ only (28 MB; the 1.6 GB go-build accelerator is skipped), key os-arch-ttsc-<lockfile hash> with restore-keys, then ttsc prepare before the build.

TTSC_CACHE_DIR is pinned to one workspace path. This works around samchon/ttsc#1469: ttsx creates test/node_modules/.cache/ttsc/ttsx under the nested tsconfig, which makes the plugin cache resolve to test/node_modules/... and rebuilds the Go plugin cold a second time. With the env var set, ttsc prepare → ttsx was verified locally to reuse the warmed binary (no building linked plugin host line). Once the upstream fix lands the env line can be removed.

CI hygiene in the same files: the pnpm version duplicated from packageManager is dropped, action majors are aligned (checkout@v7, setup-node@v7, pnpm/action-setup@v6, cache@v5), and build.yml now also triggers on tsconfig*.json, rollup.config.js, and itself.

Exports

./node and ./browser subpaths and the typesVersions block are removed. The API is identical across platforms and the browser / react-native / node conditions on "." already select the right build; the subpaths only widened the surface. They have not been published (npm still has 1.2.1 with the old exports). Resolution verified for node/browser × CJS/ESM.

Validation

  • pnpm build, pnpm run test:node (18 tests), pnpm run test:browser (3 pages) locally on Windows
  • TTSC_CACHE_DIR warm/reuse cycle verified locally from an empty directory

🤖 Generated with Claude Code

https://claude.ai/code/session_01PYz2NPPRFDMR6CMoCeArb9

samchon and others added 3 commits September 22, 2026 18:29
ttsx propagates its source loader to child processes via NODE_OPTIONS, so
forked and threaded workers can execute .ts files directly. Drop the
test/node/runtime.ts shim that mapped source paths onto emitted JavaScript
and the cwd-dependent path branches in TestBundler, and run the browser
harness through ttsx as well so both suites share one execution mode.
Normalize test runner paths with path.join so the entry file comparison
holds on Windows, and remove the now unused source-map-support dependency.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PYz2NPPRFDMR6CMoCeArb9
Restore and save node_modules-independent ttsc plugin binaries with
actions/cache after installation, keyed by OS, architecture, and lockfile
hash per the ttsc documentation, and warm them with ttsc prepare before
building. Pin TTSC_CACHE_DIR to one workspace path so ttsc, ttsx, and the
rollup plugin share a single cache, working around samchon/ttsc#1469 where
ttsx's runtime directory under test/ redirects the cache root. Drop the
pnpm version duplicated from packageManager, align action majors, and
trigger builds on tsconfig, rollup, and workflow changes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PYz2NPPRFDMR6CMoCeArb9
The public API is identical on every platform; the browser, react-native,
and node conditions on "." already select the matching build, so the
./node and ./browser subpaths and the typesVersions block that existed
only to type them add surface without purpose. Nothing has shipped with
them yet.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PYz2NPPRFDMR6CMoCeArb9
@samchon
samchon merged commit 9f69548 into master Sep 22, 2026
4 checks passed
@samchon
samchon deleted the chore/ttsx-runtime-cleanup branch September 22, 2026 09:37
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