Skip to content

Conversation

@Zangetsu101
Copy link
Contributor

After switching to the incremental build mode of tsc, it improved build times quite significantly, but this introduced the issue of stale build artifacts not being cleaned up when switching between branches. The --watch mode of tsc does not have any support for cleaning stale build files. This PR introduces wireit into the build pipeline which supports cleaning up stale build when some file has been removed.

  • The build command is now controlled via wireit. When new files are added or existing files are changed, we still get the benefits of incremental builds. But when some existing file is deleted, the build folder gets cleaned up.
  • The build:watch command uses the build command with wireit's watch mode.
  • The test:compilation command is similarly controlled via wireit as there are build artifacts which need to be cleaned up due to using tsc -b command.

N.B.: Currently wireit is giving the following warning when running the build:watch command

Wireit could not find the script name in the "npm_config_argv" environment variable. Arguments may not be interpreted correctly. See yarnpkg/yarn#8905, and please consider upgrading to yarn 3.x or switching to npm.

We can ignore that as it does not affect us and should get removed with the pnpm migration #9658

After switching to the incremental build mode of `tsc`, it improved
build times quite significantly, but this introduced the issue of
stale build artifacts not being cleaned up when switching between
branches. The `--watch` mode of `tsc` does not have any support for
cleaning stale build files. This PR introduces `wireit` into the
build pipeline which supports cleaning up stale build when some
file has been removed.

- The `build` command is now controlled via `wireit`. When new
files are added or existing files are changed, we still get the
benefits of incremental builds. But when some existing file is
deleted, the build folder gets cleaned up.
- The `build:watch` command uses the `build` command with wireit's
watch mode.
- The `test:compilation` command is similarly controlled via
`wireit` as there are build artifacts which need to be cleaned up
due to using `tsc -b` command.
@github-actions
Copy link

github-actions bot commented Sep 8, 2025

Oops! Looks like you forgot to update the changelog. When updating CHANGELOG.md, please consider the following:

  • Changelog is read by country implementors who might not always be familiar with all technical details of OpenCRVS. Keep language high-level, user friendly and avoid technical references to internals.
  • Answer "What's new?", "Why was the change made?" and "Why should I care?" for each change.
  • If it's a breaking change, include a migration guide answering "What do I need to do to upgrade?".

@ocrvs-bot
Copy link
Contributor

Your environment is deployed to https://clear-build-on-file-removal.opencrvs.dev

Copy link
Contributor

@makelicious makelicious left a comment

Choose a reason for hiding this comment

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

👍 Thanks for updating. Works on my machine.

@Zangetsu101 Zangetsu101 enabled auto-merge (squash) September 8, 2025 11:35
@Zangetsu101 Zangetsu101 merged commit f51c654 into develop Sep 8, 2025
100 checks passed
@Zangetsu101 Zangetsu101 deleted the clear-build-on-file-removal branch September 8, 2025 13:32
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.

4 participants