Skip to content

[typespec-ts] Fix missing config/ tsconfig files when updating existing packages#3967

Open
maorleger wants to merge 1 commit into
Azure:mainfrom
maorleger:fix/warp-config-missing-tsconfigs
Open

[typespec-ts] Fix missing config/ tsconfig files when updating existing packages#3967
maorleger wants to merge 1 commit into
Azure:mainfrom
maorleger:fix/warp-config-missing-tsconfigs

Conversation

@maorleger
Copy link
Copy Markdown
Member

@maorleger maorleger commented May 15, 2026

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:

[warp] Invalid config in warp.config.yml: target "browser" references tsconfig
"./config/tsconfig.src.browser.json" which does not exist at
.../azure-sdk-for-js/sdk/cognitiveservices/arm-cognitiveservices/config/tsconfig.src.browser.json

Root Cause

There are two code paths in packages/typespec-ts/src/index.ts for metadata generation:

  1. New package (shouldGenerateMetadata = true) — generates warp.config.yml AND the config/ tsconfig files ✅
  2. Update existing package (shouldGenerateMetadata = false, i.e. package.json already exists and generate-metadata is not explicitly true) — generates warp.config.yml but not the config/ tsconfig files or tsconfig.json

SDK automation always hits path (2) since the packages already exist in azure-sdk-for-js. So warp.config.yml gets written with ./config/tsconfig.src.browser.json references, but the config/ 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, and buildTsSrcCjsConfig builders to the update path, matching what the new-package path already does. Also added a consistency test to make sure every tsconfig path referenced in warp.config.yml has a corresponding builder.

Validation

I repro'd the bug e2e with a minimal ARM TypeSpec spec with azure-sdk-for-js: true and a pre-existing package.json (to trigger the update path), then verified the fix by applying the same process:

Before fix:

File Status
warp.config.yml ✅ Generated (references ./config/tsconfig.src.*.json)
config/tsconfig.src.browser.json ❌ Missing
config/tsconfig.src.esm.json ❌ Missing
config/tsconfig.src.cjs.json ❌ Missing
config/tsconfig.src.react-native.json ❌ Missing
tsconfig.json ❌ Not updated

After fix:

File Status
warp.config.yml ✅ Generated
config/tsconfig.src.browser.json ✅ Generated
config/tsconfig.src.esm.json ✅ Generated
config/tsconfig.src.cjs.json ✅ Generated
config/tsconfig.src.react-native.json ✅ Generated
tsconfig.json ✅ Updated with ./config/ references

All 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.

…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>
@maorleger maorleger force-pushed the fix/warp-config-missing-tsconfigs branch from ee8e6cb to f573a24 Compare May 15, 2026 13:38
@maorleger maorleger marked this pull request as ready for review May 15, 2026 13:38
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.

1 participant