-
Notifications
You must be signed in to change notification settings - Fork 43
refactor: Detach tsconfigs for Jest from the build #3301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Let it have its own small area in the corner of the room but don't allow it close to the main playground. ;) But seriously, this is an attempt to satisfy eslint's project service and keep build and tests separated.
We'll address it separately as some of them cause trouble.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the TypeScript configuration structure across the monorepo to streamline the build and test processes. The main goal is to detach Jest configuration from the build pipeline by consolidating tsconfig.node.json files into main tsconfig.json files and ensuring Jest configs explicitly disable code emission.
Key changes:
- Renamed
tsconfig.node.jsontotsconfig.jsonin each package, making it the primary configuration entry point - Added explicit
noEmit,declaration:false,composite:false, andincremental:falsesettings to roottsconfig.jest.jsonto prevent accidental code emission - Simplified build scripts to
tsc -band check scripts totsc -p tsconfig.jest.jsonacross all packages - Created dedicated
test/tsconfig.jsonfiles that extend from parenttsconfig.jest.jsonfor proper test file resolution - Updated TypeScript project references to point to package directories instead of specific config files
- Removed
referencesfields fromtsconfig.jest.jsonfiles as they are no longer needed for the check-only workflow
Reviewed changes
Copilot reviewed 62 out of 63 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.jest.json | Added compiler options to properly disable emission (noEmit, declaration, composite, incremental, sourceMap) |
| packages/*/tsconfig.node.json | Removed - merged into main tsconfig.json |
| packages/*/tsconfig.json | Consolidated from tsconfig.node.json, updated references to use directory paths instead of explicit config file paths |
| packages/*/tsconfig.jest.json | Removed references field, updated include paths |
| packages/*/test/tsconfig.json | Added new configs extending parent jest config for test directories |
| packages/*/package.json | Simplified build to tsc -b and check to tsc -p tsconfig.jest.json |
| packages/sdk/webpack-karma.config.ts | Changed from namespace import to default import for webpack config |
| packages/trackerless-network/tsconfig.karma.json | Removed "generated" from include array |
| packages/cdn-location/tsconfig.data-generation.json | Removed - replaced with data-generation/tsconfig.json |
| packages/dht/scripts/postbuild.sh | Removed explicit -P tsconfig.node.json flag from ts-node command |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I'll merge this in and let's see how it behaves! |
This pull request refactors TypeScript configuration across several packages to simplify project structure and build scripts. It removes redundant or legacy
tsconfig.node.jsonand related files, consolidates configuration into maintsconfig.jsonfiles, and updates references and build scripts accordingly. The changes aim to reduce duplication, streamline TypeScript project references, and make the build and test processes more maintainable.Note
In essence, this PR
build–tsc -bacross the board.check–tsc -p tsconfig.jest.jsontsconfig.jsonfiles.💡
test/dirs have their owntsconfig.jsonfiles that satisfy eslint's project service resolver.tsconfig.node.jsontotsconfig.jsonmaking it the main entrypoint of each package.referencesfield fromtsconfig.jest.jsonfiles as these produce a lot of unnecessary noise and we don't "build" through these.tsconfig.jest.jsondisable emitting properly – we *don't* reference jest tsconfigs anymore!💡 Although tsc does not complain, previously this behaviour was against the rules of
compositetsconfig setup – makes it hard to predict what the outcome is (will it emit, or it won't?).It also covers a lot of what the following PRs offer:
dhtpackage #3271geoip-locationpackage #3272nodepackage #3273proto-rpcpackage #3274sdkpackage #3275test-utilspackage #3276trackerless-networkpackage #3277Changes
TypeScript configuration consolidation:
Removed
tsconfig.node.jsonand related files from multiple packages (autocertifier-server,cdn-location,cli-tools), consolidating configuration into maintsconfig.jsonfiles and updating theirextends,include, andreferencesfields for clarity and maintainability. [1] [2] [3] [4] [5] [6] [7] [8]Updated
tsconfig.jest.jsonfiles to directly include relevant source, test, and config files, and removed obsolete project references. [1] [2] [3]Build and check script simplification:
Simplified
checkandbuildscripts inpackage.jsonfiles to use the consolidated TypeScript configs, removing redundant or chained TypeScript invocations. [1] [2] [3] [4]Updated shell scripts and build commands to no longer rely on removed config files.
Test configuration improvements:
test/tsconfig.jsonfiles in several packages to ensure test files are properly included and configured for TypeScript and Jest. [1] [2]Overall, these changes make the TypeScript setup across packages more consistent, easier to understand, and less error-prone.