Skip to content

build(nx): key the version target defaults by the version target - #7134

Merged
overbalance merged 3 commits into
open-telemetry:mainfrom
embrace-io:overbalance/nx-version-target-defaults
Sep 29, 2026
Merged

overbalance merged 3 commits into
open-telemetry:mainfrom
embrace-io:overbalance/nx-version-target-defaults

Conversation

@overbalance

Copy link
Copy Markdown
Contributor

Summary

nx.json sets the inputs and outputs of the version generator under targetDefaults["version:update"]. version:update is the root npm script. The per-package target it runs, and that compile depends on, is version, so no target ever used these defaults.

version is listed in cacheableOperations. Without declared outputs, a cache hit replays the terminal output but does not restore src/version.ts. That file is gitignored, so if it is deleted while .nx/cache survives, npm run compile gets a cache hit for version and then fails on the missing ./version import.

This PR renames the key to version, so nx caches and restores {projectRoot}/src/version.ts. The cache key now comes from package.json only, instead of every file in the project.

How Has This Been Tested?

On main:

npm run version:update
rm packages/opentelemetry-core/src/version.ts
npm run version:update   # 38/38 read from cache
ls packages/opentelemetry-core/src/version.ts   # No such file or directory

With this change, the same steps show @opentelemetry/core:version [local cache] and the file is restored.

@overbalance
overbalance requested a review from a team as a code owner September 29, 2026 00:07
@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.04%. Comparing base (08a73b7) to head (3167afa).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7134   +/-   ##
=======================================
  Coverage   95.04%   95.04%           
=======================================
  Files         383      383           
  Lines       13455    13455           
  Branches     3094     3094           
=======================================
  Hits        12788    12788           
  Misses        667      667           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-09-29 00:49 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@trentm
trentm added this pull request to the merge queue Sep 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Sep 29, 2026
@overbalance overbalance changed the title fix(nx): key the version target defaults by the version target build(nx): key the version target defaults by the version target Sep 29, 2026
@overbalance
overbalance added this pull request to the merge queue Sep 29, 2026
Merged via the queue into open-telemetry:main with commit 95454a6 Sep 29, 2026
25 checks passed
@overbalance
overbalance deleted the overbalance/nx-version-target-defaults branch September 29, 2026 00:46
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.

2 participants