Skip to content

Commit 86ab49e

Browse files
maorlegerCopilot
andcommitted
fix: generate config/ tsconfig files in the update path alongside warp.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>
1 parent cae57c5 commit 86ab49e

2 files changed

Lines changed: 51 additions & 1 deletion

File tree

packages/rlc-common/test/integration/warpConfig.spec.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
import { describe, it, expect } from "vitest";
55

66
import { buildWarpConfig } from "../../src/metadata/buildWarpConfig.js";
7+
import {
8+
buildTsSrcEsmConfig,
9+
buildTsSrcBrowserConfig,
10+
buildTsSrcReactNativeConfig,
11+
buildTsSrcCjsConfig
12+
} from "../../src/metadata/buildTsConfig.js";
713
import { createMockModel } from "./mockHelper.js";
814

915
describe("warp.config.yml generation", () => {
@@ -94,4 +100,43 @@ describe("warp.config.yml generation", () => {
94100
expect(result!.content).toContain("name: commonjs");
95101
});
96102
});
103+
104+
describe("tsconfig path consistency", () => {
105+
it("every tsconfig referenced in warp.config.yml has a matching config/ builder", () => {
106+
const model = createMockModel({
107+
moduleKind: "esm",
108+
isMonorepo: true,
109+
flavor: "azure"
110+
});
111+
112+
const warpResult = buildWarpConfig(model);
113+
expect(warpResult).toBeDefined();
114+
115+
// Extract all tsconfig paths from warp.config.yml
116+
const tsconfigRefPattern = /tsconfig:\s*"([^"]+)"/g;
117+
const referencedPaths: string[] = [];
118+
let match;
119+
while (
120+
(match = tsconfigRefPattern.exec(warpResult!.content)) !== null
121+
) {
122+
referencedPaths.push(match[1].replace(/^\.\//, ""));
123+
}
124+
expect(referencedPaths.length).toBeGreaterThan(0);
125+
126+
// These are the config/ files the builders produce
127+
const generatedPaths = [
128+
buildTsSrcEsmConfig(),
129+
buildTsSrcBrowserConfig(),
130+
buildTsSrcReactNativeConfig(),
131+
buildTsSrcCjsConfig()
132+
].map((f) => f.path);
133+
134+
for (const ref of referencedPaths) {
135+
expect(
136+
generatedPaths,
137+
`warp.config.yml references "${ref}" but no config/ builder generates it`
138+
).toContain(ref);
139+
}
140+
});
141+
});
97142
});

packages/typespec-ts/src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,11 +638,16 @@ export async function $onEmit(context: EmitContext) {
638638
);
639639
}
640640

641-
// Update warp.config.yml for Azure monorepo packages
641+
// Update warp.config.yml and config/ tsconfig files for Azure monorepo packages
642642
if (option.azureSdkForJs) {
643643
updateBuilders.push((model: RLCModel) =>
644644
buildWarpConfig(model, modularPackageInfo)
645645
);
646+
updateBuilders.push(buildTsConfig);
647+
updateBuilders.push(buildTsSrcEsmConfig);
648+
updateBuilders.push(buildTsSrcBrowserConfig);
649+
updateBuilders.push(buildTsSrcReactNativeConfig);
650+
updateBuilders.push(buildTsSrcCjsConfig);
646651
}
647652

648653
// If the client name changed, regenerate the README and snippets completely;

0 commit comments

Comments
 (0)