Repository navigation
build(registry): move to TypeScript 7 and replace ts-node with tsx - #738
Merged
Merged
Conversation
m2broth
approved these changes
Oct 27, 2026
b1ff
approved these changes
Oct 27, 2026
stas-nc
force-pushed
the
refactor/registry-typescript-7
branch
from
October 27, 2026 17:07
33d04ee to
7c5d437
Compare
wRLSS
approved these changes
Oct 27, 2026
TypeScript 7 has no JavaScript compiler API, so ts-node cannot run on it. tsx now runs the mocha specs, the local OAuth server and the knex migrate:make / seed:make commands. It does not type-check, so the test scripts run `tsc -p tsconfig.spec.json` first. TypeScript configs follow the Nx layout at the repository root, so ilc and the registry client can join later: tsconfig.base.json (from `tsc --init`) holds the shared options, tsconfig.json references the packages, and registry/tsconfig.json references its app and spec projects. The registry image copies the base config one level above /codebase, as in the repository. New compiler flags are the ones that cost a small diff: noImplicitReturns, noImplicitOverride, noUnusedLocals, noFallthroughCasesInSwitch, isolatedModules, noUncheckedSideEffectImports. noUncheckedIndexedAccess and verbatimModuleSyntax stay off. tsx compiles like native ESM, which exposed code that only worked with tsc's CommonJS output: - two specs stubbed module exports, which are read-only now; they check behaviour instead - chai 6 has no default export; it is imported as a namespace - knexfile set NODE_CONFIG_DIR before `import config`, but imports run first; the assignment moved to config/configDir.ts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nyc counted the branches of the CommonJS helpers esbuild adds to every file under tsx: branch coverage fell from 84.99% to 79.86% and failed the PR coverage report. c8 maps V8 coverage onto the original source and leaves out generated code, which gives 84.67% for the same files. The report stays in .nyc_output/coverage, because CI moves that folder for the base branch too, and it still runs nyc. The coverage job no longer re-runs `nyc report` in the images: test:ci already writes the summary into the uploaded artifact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The server ran from the registry folder without NODE_CONFIG_DIR, so node-config read the TypeScript sources in config/ and registered ts-node to transpile them. Production depended on a dev dependency for it: in the published image, loading the config took about 300 ms and 20 MB of heap for the TypeScript compiler. TypeScript 7 has no compiler API for ts-node, so after the upgrade the registry failed to start. The server and the assets discovery runner import server/preload.ts first. It sets NODE_CONFIG_DIR to the compiled build/config unless it is already set, then loads New Relic, whose newrelic.js reads the config. The knexfile keeps importing config/configDir.ts. The variable is set in code rather than in package scripts, because images built on top of the registry image start node directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
stas-nc
force-pushed
the
refactor/registry-typescript-7
branch
from
October 27, 2026 17:15
7c5d437 to
ac7f101
Compare
Coverage ReportIlc/serverCommit SHA:5d9936a3ecfe17584203de8dcceb65c4f2b8feb7 Test coverage results 🧪File details
Ilc/clientCommit SHA:5d9936a3ecfe17584203de8dcceb65c4f2b8feb7 Test coverage results 🧪File details
RegistryCommit SHA:5d9936a3ecfe17584203de8dcceb65c4f2b8feb7 Test coverage results 🧪File details
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tscover the specs first.tsconfig.base.json(fromtsc --init) holds the shared options, and each package'stsconfig.jsonextends it and references its app and spec projects.noImplicitReturns,noImplicitOverride,noUnusedLocals,noFallthroughCasesInSwitch,isolatedModulesandnoUncheckedSideEffectImports.noUncheckedIndexedAccess(149 errors) andverbatimModuleSyntax(needs ESM) are left for later.The registry loaded ts-node in production
The server and the assets discovery runner start from the registry folder without
NODE_CONFIG_DIR. node-config then reads the TypeScript sources inconfig/and registers ts-node to transpile them, which works only because the image keeps its dev dependencies. Measured in the published imagenamecheap/ilc_registry:8b4db9b:config/*.tsthrough ts-nodebuild/configWith TypeScript 7, ts-node finds no compiler API and the registry fails to start. Both entry points now import
server/preload.tsfirst: it points node-config at the compiledbuild/configunlessNODE_CONFIG_DIRis already set, then loads New Relic, whosenewrelic.jsreads the config. The knex CLI gets the same folder through the knexfile.The folder is set in code because images built on top of the registry image start
node build/server/index.jsdirectly, without the package scripts. Config files such an image adds toconfig/as.tsare compiled intobuild/configby itspnpm build.Found by tsx
tsx compiles each file the way native ESM runs it, which exposed code that worked only with tsc's CommonJS output:
.nyc_output/coveragefolder, because CI also runs the base branch, which uses nyc.Verification
node, as images built on top of the registry image do, with an extraconfig/production.tscompiled in. The server served its port from that file, and New Relic started.🤖 Generated with Claude Code