[typespec-ts] Fix missing config/ tsconfig files when updating existing packages#3967
Open
maorleger wants to merge 1 commit into
Open
[typespec-ts] Fix missing config/ tsconfig files when updating existing packages#3967maorleger wants to merge 1 commit into
maorleger wants to merge 1 commit into
Conversation
86ab49e to
ee8e6cb
Compare
…p.config.yml The update path (existing package with package.json) was generating warp.config.yml with ./config/tsconfig.src.*.json references but not generating the config/ directory or tsconfig.json with the matching references. This caused warp build failures for all TypeSpec-based SDK validation runs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ee8e6cb to
f573a24
Compare
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.
Problem
Since the 0.53.0 release (which included #3938), SDK Validation is broken for all TypeSpec-based PRs in azure-rest-api-specs. The error looks like:
Root Cause
There are two code paths in
packages/typespec-ts/src/index.tsfor metadata generation:shouldGenerateMetadata = true) — generateswarp.config.ymlAND theconfig/tsconfig files ✅shouldGenerateMetadata = false, i.e.package.jsonalready exists andgenerate-metadatais not explicitlytrue) — generateswarp.config.ymlbut not theconfig/tsconfig files ortsconfig.json❌SDK automation always hits path (2) since the packages already exist in azure-sdk-for-js. So
warp.config.ymlgets written with./config/tsconfig.src.browser.jsonreferences, but theconfig/directory is never created. Maybe it assumes all existing packages in the repo would have been migrated already but that ended up not being the case?Fix
I added the missing
buildTsConfig,buildTsSrcEsmConfig,buildTsSrcBrowserConfig,buildTsSrcReactNativeConfig, andbuildTsSrcCjsConfigbuilders to the update path, matching what the new-package path already does. Also added a consistency test to make sure every tsconfig path referenced inwarp.config.ymlhas a corresponding builder.Validation
I repro'd the bug e2e with a minimal ARM TypeSpec spec with
azure-sdk-for-js: trueand a pre-existingpackage.json(to trigger the update path), then verified the fix by applying the same process:Before fix:
warp.config.yml./config/tsconfig.src.*.json)config/tsconfig.src.browser.jsonconfig/tsconfig.src.esm.jsonconfig/tsconfig.src.cjs.jsonconfig/tsconfig.src.react-native.jsontsconfig.jsonAfter fix:
warp.config.ymlconfig/tsconfig.src.browser.jsonconfig/tsconfig.src.esm.jsonconfig/tsconfig.src.cjs.jsonconfig/tsconfig.src.react-native.jsontsconfig.json./config/referencesAll existing tests pass (rlc-common 103/103, typespec-ts unit tests unchanged). I also confirmed the autorest.typescript generator does not have this issue — it uses a single linear code path with no new/update split.