From 2c2323a3d6bd4906698b8edd0a4d78bf258857c2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 29 Jul 2026 23:40:28 +0000 Subject: [PATCH 1/6] fix: build preview packages before pkg-pr-new publish Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> --- eng/tsp-core/pkg-pr-new.ts | 48 ++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/eng/tsp-core/pkg-pr-new.ts b/eng/tsp-core/pkg-pr-new.ts index ef96f0fbbf8..3724622e474 100644 --- a/eng/tsp-core/pkg-pr-new.ts +++ b/eng/tsp-core/pkg-pr-new.ts @@ -1,7 +1,8 @@ import { execSync } from "child_process"; +import { join } from "path"; import { repoRoot } from "../common/scripts/utils/common.ts"; import { listChangedFilesSince } from "../common/scripts/utils/git.ts"; -import { getPublishablePackages } from "./tpm/packages.ts"; +import { CRITICAL_PACKAGES, getPublishablePackages, type PackageInfo } from "./tpm/packages.ts"; const files = await listChangedFilesSince(`origin/main`, { repositoryPath: repoRoot }); @@ -11,7 +12,8 @@ console.log("modified files:", files); const packages = await getPublishablePackages(); const paths = packages.map((pkg) => pkg.path); -const modifiedPaths = paths.filter((x) => files.some((f) => f.startsWith(x + "/"))); +const modifiedPackages = packages.filter((pkg) => files.some((f) => f.startsWith(pkg.path + "/"))); +const modifiedPaths = modifiedPackages.map((pkg) => pkg.path); // eslint-disable-next-line no-console console.log("Packages", { all: paths, modified: modifiedPaths }); if (modifiedPaths.length === 0) { @@ -19,12 +21,48 @@ if (modifiedPaths.length === 0) { console.log("No modified packages found."); process.exit(0); } -try { - execSync(`pnpx pkg-pr-new publish ${modifiedPaths.map((x) => `'${x}'`).join(" ")} --pnpm`, { + +function runCommand(command: string, cwd: string): void { + execSync(command, { stdio: "inherit", encoding: "utf-8", - cwd: repoRoot, + cwd, }); +} + +function buildPnpmFilterArgs(packages: PackageInfo[]): string { + const criticalFilters = CRITICAL_PACKAGES.map((name) => `--filter "${name}..."`); + const criticalDirNames = new Set(CRITICAL_PACKAGES.map((name) => name.replace(/^@typespec\//, ""))); + const restFilters = packages + .filter((p) => !criticalDirNames.has(p.name)) + .map((p) => `--filter "./${p.name}..."`); + return [...criticalFilters, ...restFilters].join(" "); +} + +try { + const pnpmPackages = modifiedPackages.filter((p) => !p.isStandalone); + const standalonePackages = modifiedPackages.filter((p) => p.isStandalone); + + if (pnpmPackages.length > 0) { + const filters = buildPnpmFilterArgs(pnpmPackages); + // eslint-disable-next-line no-console + console.log(`Building pnpm packages with filters: ${filters}`); + runCommand(`pnpm ${filters} run build`, repoRoot); + } + + for (const pkg of standalonePackages) { + // eslint-disable-next-line no-console + console.log(`Building standalone package: ${pkg.path}`); + runCommand("npm run build", join(repoRoot, pkg.path)); + } +} catch (e: any) { + // eslint-disable-next-line no-console + console.error("Failed to build modified packages before pkg-pr-new publish"); + process.exit(1); +} + +try { + runCommand(`pnpx pkg-pr-new publish ${modifiedPaths.map((x) => `'${x}'`).join(" ")} --pnpm`, repoRoot); } catch (e: any) { // eslint-disable-next-line no-console console.error("Failed to run pkg-pr-new publish"); From cb4bd976a77e3ee811e24adb76c775ee9a45d227 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 29 Jul 2026 23:44:22 +0000 Subject: [PATCH 2/6] fix: ensure pkg-pr-new publishes built preview packages Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> --- eng/tsp-core/pkg-pr-new.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/eng/tsp-core/pkg-pr-new.ts b/eng/tsp-core/pkg-pr-new.ts index 3724622e474..bcdc233d451 100644 --- a/eng/tsp-core/pkg-pr-new.ts +++ b/eng/tsp-core/pkg-pr-new.ts @@ -32,7 +32,9 @@ function runCommand(command: string, cwd: string): void { function buildPnpmFilterArgs(packages: PackageInfo[]): string { const criticalFilters = CRITICAL_PACKAGES.map((name) => `--filter "${name}..."`); - const criticalDirNames = new Set(CRITICAL_PACKAGES.map((name) => name.replace(/^@typespec\//, ""))); + const criticalDirNames = new Set( + CRITICAL_PACKAGES.map((name) => name.replace(/^@typespec\//, "")), + ); const restFilters = packages .filter((p) => !criticalDirNames.has(p.name)) .map((p) => `--filter "./${p.name}..."`); @@ -62,7 +64,10 @@ try { } try { - runCommand(`pnpx pkg-pr-new publish ${modifiedPaths.map((x) => `'${x}'`).join(" ")} --pnpm`, repoRoot); + runCommand( + `pnpx pkg-pr-new publish ${modifiedPaths.map((x) => `'${x}'`).join(" ")} --pnpm`, + repoRoot, + ); } catch (e: any) { // eslint-disable-next-line no-console console.error("Failed to run pkg-pr-new publish"); From 7f0394261d7ca7b6772cd85ee93c30745ad443e4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Jul 2026 00:14:29 +0000 Subject: [PATCH 3/6] fix: correct tpm build filter paths for modified packages Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> --- eng/tsp-core/pkg-pr-new.ts | 53 ++++---------------------------------- eng/tsp-core/tpm/cli.ts | 2 +- 2 files changed, 6 insertions(+), 49 deletions(-) diff --git a/eng/tsp-core/pkg-pr-new.ts b/eng/tsp-core/pkg-pr-new.ts index bcdc233d451..ef96f0fbbf8 100644 --- a/eng/tsp-core/pkg-pr-new.ts +++ b/eng/tsp-core/pkg-pr-new.ts @@ -1,8 +1,7 @@ import { execSync } from "child_process"; -import { join } from "path"; import { repoRoot } from "../common/scripts/utils/common.ts"; import { listChangedFilesSince } from "../common/scripts/utils/git.ts"; -import { CRITICAL_PACKAGES, getPublishablePackages, type PackageInfo } from "./tpm/packages.ts"; +import { getPublishablePackages } from "./tpm/packages.ts"; const files = await listChangedFilesSince(`origin/main`, { repositoryPath: repoRoot }); @@ -12,8 +11,7 @@ console.log("modified files:", files); const packages = await getPublishablePackages(); const paths = packages.map((pkg) => pkg.path); -const modifiedPackages = packages.filter((pkg) => files.some((f) => f.startsWith(pkg.path + "/"))); -const modifiedPaths = modifiedPackages.map((pkg) => pkg.path); +const modifiedPaths = paths.filter((x) => files.some((f) => f.startsWith(x + "/"))); // eslint-disable-next-line no-console console.log("Packages", { all: paths, modified: modifiedPaths }); if (modifiedPaths.length === 0) { @@ -21,53 +19,12 @@ if (modifiedPaths.length === 0) { console.log("No modified packages found."); process.exit(0); } - -function runCommand(command: string, cwd: string): void { - execSync(command, { +try { + execSync(`pnpx pkg-pr-new publish ${modifiedPaths.map((x) => `'${x}'`).join(" ")} --pnpm`, { stdio: "inherit", encoding: "utf-8", - cwd, + cwd: repoRoot, }); -} - -function buildPnpmFilterArgs(packages: PackageInfo[]): string { - const criticalFilters = CRITICAL_PACKAGES.map((name) => `--filter "${name}..."`); - const criticalDirNames = new Set( - CRITICAL_PACKAGES.map((name) => name.replace(/^@typespec\//, "")), - ); - const restFilters = packages - .filter((p) => !criticalDirNames.has(p.name)) - .map((p) => `--filter "./${p.name}..."`); - return [...criticalFilters, ...restFilters].join(" "); -} - -try { - const pnpmPackages = modifiedPackages.filter((p) => !p.isStandalone); - const standalonePackages = modifiedPackages.filter((p) => p.isStandalone); - - if (pnpmPackages.length > 0) { - const filters = buildPnpmFilterArgs(pnpmPackages); - // eslint-disable-next-line no-console - console.log(`Building pnpm packages with filters: ${filters}`); - runCommand(`pnpm ${filters} run build`, repoRoot); - } - - for (const pkg of standalonePackages) { - // eslint-disable-next-line no-console - console.log(`Building standalone package: ${pkg.path}`); - runCommand("npm run build", join(repoRoot, pkg.path)); - } -} catch (e: any) { - // eslint-disable-next-line no-console - console.error("Failed to build modified packages before pkg-pr-new publish"); - process.exit(1); -} - -try { - runCommand( - `pnpx pkg-pr-new publish ${modifiedPaths.map((x) => `'${x}'`).join(" ")} --pnpm`, - repoRoot, - ); } catch (e: any) { // eslint-disable-next-line no-console console.error("Failed to run pkg-pr-new publish"); diff --git a/eng/tsp-core/tpm/cli.ts b/eng/tsp-core/tpm/cli.ts index 79fd95ffae3..2ee35dc66aa 100644 --- a/eng/tsp-core/tpm/cli.ts +++ b/eng/tsp-core/tpm/cli.ts @@ -71,7 +71,7 @@ function buildPnpmFilterArgs(packages: PackageInfo[]): string { ); const restFilters = packages .filter((p) => !criticalDirNames.has(p.name)) - .map((p) => `--filter "./${p.name}..."`); + .map((p) => `--filter "./${p.path}..."`); return [...criticalFilters, ...restFilters].join(" "); } From 3426b362a336a2e92dcea6a5b7c324d4221fd5d2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Jul 2026 00:28:12 +0000 Subject: [PATCH 4/6] docs(http-server-js): add dummy change for preview build test Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> --- packages/http-server-js/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/http-server-js/README.md b/packages/http-server-js/README.md index b9b1ae3b87a..3987df75103 100644 --- a/packages/http-server-js/README.md +++ b/packages/http-server-js/README.md @@ -2,7 +2,7 @@ :warning: **This package is highly experimental and may be subject to breaking changes and bugs.** Please expect that your code may need to be updated as this package evolves, and please report any issues you encounter. -TypeSpec HTTP server code generator for JavaScript +TypeSpec HTTP server code generator for JavaScript. ## Install From 7669fe9dc3506540445879337cd70f4aaa0d900a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Jul 2026 01:23:32 +0000 Subject: [PATCH 5/6] fix(tpm): use package-name filters for build dependency graph Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> --- eng/tsp-core/tpm/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/tsp-core/tpm/cli.ts b/eng/tsp-core/tpm/cli.ts index 2ee35dc66aa..f3416352f3a 100644 --- a/eng/tsp-core/tpm/cli.ts +++ b/eng/tsp-core/tpm/cli.ts @@ -71,7 +71,7 @@ function buildPnpmFilterArgs(packages: PackageInfo[]): string { ); const restFilters = packages .filter((p) => !criticalDirNames.has(p.name)) - .map((p) => `--filter "./${p.path}..."`); + .map((p) => `--filter "${p.name}..."`); return [...criticalFilters, ...restFilters].join(" "); } From b32dd5b264bd029d0df786f3d5f36b4c8ab5d416 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Jul 2026 13:39:44 +0000 Subject: [PATCH 6/6] revert: remove http-server-js dummy README change Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> --- packages/http-server-js/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/http-server-js/README.md b/packages/http-server-js/README.md index 3987df75103..b9b1ae3b87a 100644 --- a/packages/http-server-js/README.md +++ b/packages/http-server-js/README.md @@ -2,7 +2,7 @@ :warning: **This package is highly experimental and may be subject to breaking changes and bugs.** Please expect that your code may need to be updated as this package evolves, and please report any issues you encounter. -TypeSpec HTTP server code generator for JavaScript. +TypeSpec HTTP server code generator for JavaScript ## Install