Skip to content

Conversation

@mondoreale
Copy link
Contributor

@mondoreale mondoreale commented Dec 15, 2025

This pull request refactors TypeScript configuration across several packages to simplify project structure and build scripts. It removes redundant or legacy tsconfig.node.json and related files, consolidates configuration into main tsconfig.json files, 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

  • Simplifies buildtsc -b across the board.
  • Simplifies checktsc -p tsconfig.jest.json
  • Drops the Eslint-driven requirement of test files being in package-level tsconfig.json files.
    💡 test/ dirs have their own tsconfig.json files that satisfy eslint's project service resolver.
  • Renames tsconfig.node.json to tsconfig.json making it the main entrypoint of each package.
  • Drop references field from tsconfig.jest.json files as these produce a lot of unnecessary noise and we don't "build" through these.
  • Make the root tsconfig.jest.json disable emitting properly – we *don't* reference jest tsconfigs anymore!
    💡 Although tsc does not complain, previously this behaviour was against the rules of composite tsconfig 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:

Changes

TypeScript configuration consolidation:

  • Removed tsconfig.node.json and related files from multiple packages (autocertifier-server, cdn-location, cli-tools), consolidating configuration into main tsconfig.json files and updating their extends, include, and references fields for clarity and maintainability. [1] [2] [3] [4] [5] [6] [7] [8]

  • Updated tsconfig.jest.json files to directly include relevant source, test, and config files, and removed obsolete project references. [1] [2] [3]

Build and check script simplification:

  • Simplified check and build scripts in package.json files 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:

  • Added dedicated test/tsconfig.json files 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.

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.
@github-actions github-actions bot added network Related to Network Package test-utils Related to Test Utils Package cli-tools Related to CLI Tools Package dht Related to DHT package utils proto-rpc sdk node labels Dec 15, 2025
@mondoreale mondoreale requested a review from Copilot December 15, 2025 13:45
@mondoreale mondoreale marked this pull request as ready for review December 15, 2025 13:56
Copy link
Contributor

Copilot AI left a 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.json to tsconfig.json in each package, making it the primary configuration entry point
  • Added explicit noEmit, declaration:false, composite:false, and incremental:false settings to root tsconfig.jest.json to prevent accidental code emission
  • Simplified build scripts to tsc -b and check scripts to tsc -p tsconfig.jest.json across all packages
  • Created dedicated test/tsconfig.json files that extend from parent tsconfig.jest.json for proper test file resolution
  • Updated TypeScript project references to point to package directories instead of specific config files
  • Removed references fields from tsconfig.jest.json files 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.

@mondoreale
Copy link
Contributor Author

I'll merge this in and let's see how it behaves!

@mondoreale mondoreale merged commit 3413fb3 into main Dec 16, 2025
42 of 43 checks passed
@mondoreale mondoreale deleted the detach-jest-tsconfigs-from-build branch December 16, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli-tools Related to CLI Tools Package dht Related to DHT package network Related to Network Package node proto-rpc sdk test-utils Related to Test Utils Package utils

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants