chore(util-user-agent-node): read typescript package.json version from process.cwd() - #7802
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Updates TypeScript version detection for the Node user-agent helper by trying multiple candidate typescript/package.json locations, including one derived from process.cwd(), and adjusts tests accordingly.
Changes:
- Replace single-path TypeScript
package.jsonresolution with multi-path lookup (process.cwd()+ path derived from__dirname). - Add
getTypeScriptPackageJsonPathshelper (and unit tests) and remove the old single-path helper. - Expand
getTypeScriptUserAgentPairunit tests to cover multi-path and caching behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages-internal/util-user-agent-node/src/getTypeScriptUserAgentPair.ts | Tries multiple typescript/package.json paths and caches the resolved version (or failure). |
| packages-internal/util-user-agent-node/src/getTypeScriptUserAgentPair.spec.ts | Adds coverage for multi-path success/failure and caching semantics. |
| packages-internal/util-user-agent-node/src/getTypeScriptPackageJsonPaths.ts | New helper that returns candidate typescript/package.json paths (cwd + derived-from-dirname). |
| packages-internal/util-user-agent-node/src/getTypeScriptPackageJsonPaths.spec.ts | New unit tests for the path derivation logic and deduping behavior. |
| packages-internal/util-user-agent-node/src/getTypeScriptPackageJsonPath.ts | Removed in favor of the new multi-path helper. |
| packages-internal/util-user-agent-node/src/getTypeScriptPackageJsonPath.spec.ts | Removed alongside the deprecated helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment was marked as outdated.
This comment was marked as outdated.
trivikr
commented
Mar 2, 2026
kuhe
approved these changes
Mar 3, 2026
smilkuri
approved these changes
Mar 3, 2026
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Issue
Internal JS-6675
Description
If version can't be derived from typescript package.json path from current directory, attempt to read is from typescript package.json version derived from process.cwd()
Testing
CI
Checklist
*.integ.spec.ts) or E2E tests.@public,@internaltags and enabled doc generation on the package. Remember that access level annotations go below the description, not above.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.