fix: support semver ranges in tsp init template compilerVersion - #11467
Draft
timotheeguerin with Copilot wants to merge 2 commits into
Draft
fix: support semver ranges in tsp init template compilerVersion#11467timotheeguerin with Copilot wants to merge 2 commits into
compilerVersion#11467timotheeguerin with Copilot wants to merge 2 commits into
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Templates can now specify compilerVersion as a semver range (e.g., ^0.50.0) instead of crashing with TypeError: Invalid Version. - Plain versions like `1.2.3` continue to work as `>=1.2.3` (backward compat) - Semver ranges like `^1.0.0`, `>=1.0.0` are now properly handled via semver.satisfies() - Updated built-in templates to use `^1.14.0` format - Added unit tests for isTemplateCompatibleWithTspVersion Closes #2743 Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix template with a compilerVersion semver range
fix: support semver ranges in tsp init template Jul 30, 2026
compilerVersion
commit: |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Setting
compilerVersionto a semver range like^0.50.0in a template index crashed withTypeError: Invalid Versionbecause the check unconditionally calledsemver.gte(), which requires exact versions.Changes
init.ts:isTemplateCompatibleWithTspVersionnow detects whethercompilerVersionis a plain version or a range:x.y.z→ treated as>=x.y.z(backward compat preserved)^x.y.z,>=x.y.z, etc.) → evaluated withsemver.satisfies()templates/scaffolding.json: Updated built-in templates from"1.14.0"to"^1.14.0"test/cli/init.test.ts: Added unit tests covering plain versions, ranges that satisfy, and ranges that don't{ "compilerVersion": "^0.50.0" }Previously crashed; now correctly evaluates the current compiler version against the range.