-
Notifications
You must be signed in to change notification settings - Fork 83
[typespec-ts] Sync tsconfig.src include with warp exports for multi-client packages #4872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kazrael2119
merged 8 commits into
main
from
copilot/typespec-ts-fail-to-build-multi-client-packages
Jul 28, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c68848e
Initial plan
Copilot d03fde7
fix(typespec-ts): sync tsconfig.src include with warp exports for mul…
Copilot f1edda4
Merge remote-tracking branch 'origin/main' into copilot/typespec-ts-f…
Copilot b30d0b7
Merge branch 'main' into copilot/typespec-ts-fail-to-build-multi-clie…
kazrael2119 d5ce4f1
Update packages/typespec-ts/src/index.ts
kazrael2119 3d98af8
Update packages/typespec-ts/src/metadata/build-ts-config.ts
kazrael2119 5bfefe9
Update packages/typespec-ts/src/metadata/build-ts-config.ts
kazrael2119 c14f9cd
Merge branch 'main' into copilot/typespec-ts-fail-to-build-multi-clie…
kazrael2119 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
.chronus/changes/fix-multi-client-tsconfig-src-include-2026-7-13-6-30-0.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| changeKind: fix | ||
| packages: | ||
| - "@azure-tools/typespec-ts" | ||
| --- | ||
|
|
||
| Fix multi-client package build failures by syncing the generated `config/tsconfig.src.*.json` `include` lists with the `warp.config.yml` exports, so every client entry point is compiled and emitted to `dist` (previously warp failed with `DIST_MISSING`). |
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
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
78 changes: 78 additions & 0 deletions
78
packages/typespec-ts/test-next/unit/metadata/ts-config.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| import { | ||
| buildTsSrcBrowserConfig, | ||
| buildTsSrcCjsConfig, | ||
| buildTsSrcEsmConfig, | ||
| buildTsSrcReactNativeConfig, | ||
| getSrcIncludePaths, | ||
| } from "../../../src/metadata/build-ts-config.js"; | ||
|
|
||
| describe("tsconfig.src.*.json include generation", () => { | ||
| it("defaults to the root entry point when no exports are provided", () => { | ||
| expect(getSrcIncludePaths()).toEqual(["../src/index.ts"]); | ||
| expect(getSrcIncludePaths({})).toEqual(["../src/index.ts"]); | ||
| }); | ||
|
|
||
| it("keeps the include list in sync with the warp exports for multi-client packages", () => { | ||
| // Mirrors the exports map produced for a multi-client package. | ||
| const exports = { | ||
| ".": "./src/index.ts", | ||
| "./devCenter": "./src/devCenter/index.ts", | ||
| "./devCenter/api": "./src/devCenter/api/index.ts", | ||
| "./devBoxes": "./src/devBoxes/index.ts", | ||
| "./devBoxes/api": "./src/devBoxes/api/index.ts", | ||
| "./deploymentEnvironments": "./src/deploymentEnvironments/index.ts", | ||
| "./deploymentEnvironments/api": "./src/deploymentEnvironments/api/index.ts", | ||
| "./models": "./src/models/index.ts", | ||
| }; | ||
|
|
||
| const include = getSrcIncludePaths(exports); | ||
|
|
||
| // Every per-client barrel must be a compilation input so it is emitted to dist. | ||
| expect(include).toContain("../src/index.ts"); | ||
| expect(include).toContain("../src/devCenter/index.ts"); | ||
| expect(include).toContain("../src/devBoxes/index.ts"); | ||
| expect(include).toContain("../src/deploymentEnvironments/index.ts"); | ||
| // The deeper api/model barrels are exported too, so they are included as well. | ||
| expect(include).toContain("../src/devCenter/api/index.ts"); | ||
| expect(include).toContain("../src/models/index.ts"); | ||
| }); | ||
|
|
||
| it("ignores non-TypeScript export values (e.g. package.json)", () => { | ||
| const include = getSrcIncludePaths({ | ||
| "./package.json": "./package.json", | ||
| ".": "./src/index.ts", | ||
| }); | ||
| expect(include).toEqual(["../src/index.ts"]); | ||
| }); | ||
|
|
||
| it("does not emit duplicate include entries", () => { | ||
| const include = getSrcIncludePaths({ | ||
| ".": "./src/index.ts", | ||
| "./alias": "./src/index.ts", | ||
| }); | ||
| expect(include).toEqual(["../src/index.ts"]); | ||
| }); | ||
|
|
||
| it("propagates the exports into each per-target tsconfig", () => { | ||
| const exports = { | ||
| ".": "./src/index.ts", | ||
| "./devCenter": "./src/devCenter/index.ts", | ||
| }; | ||
|
|
||
| for (const build of [ | ||
| buildTsSrcEsmConfig, | ||
| buildTsSrcBrowserConfig, | ||
| buildTsSrcReactNativeConfig, | ||
| buildTsSrcCjsConfig, | ||
| ]) { | ||
| const result = build(exports); | ||
| const parsed = JSON.parse(result.content); | ||
| expect(parsed.include).toEqual(["../src/index.ts", "../src/devCenter/index.ts"]); | ||
| } | ||
| }); | ||
| }); |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.