From 0f3bada90986c4a3c0c62ddfef6a1f2bb3602959 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Fri, 29 May 2026 12:52:47 -0400 Subject: [PATCH 1/2] build: configure turbo outputs for non-standard builds --- packages/astro-utils/.scripts/build.js | 42 ++++++++++++++++++++++++++ packages/astro-utils/package.json | 2 +- packages/astro-utils/turbo.json | 8 +++++ packages/typespec-vs/turbo.json | 9 ++++++ website/.scripts/build.ts | 12 +++++--- website/turbo.json | 14 +++++++++ 6 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 packages/astro-utils/.scripts/build.js create mode 100644 packages/astro-utils/turbo.json create mode 100644 packages/typespec-vs/turbo.json create mode 100644 website/turbo.json diff --git a/packages/astro-utils/.scripts/build.js b/packages/astro-utils/.scripts/build.js new file mode 100644 index 00000000000..358b76f0d5b --- /dev/null +++ b/packages/astro-utils/.scripts/build.js @@ -0,0 +1,42 @@ +#!/usr/bin/env node +import { spawn } from "child_process"; +import { mkdir, rm, writeFile } from "fs/promises"; +import { join, resolve } from "path"; + +const projectRoot = resolve(import.meta.dirname, ".."); +const skipBuildMarker = join(projectRoot, "temp/turbo-build-skipped"); + +if (process.env.TYPESPEC_SKIP_WEBSITE_BUILD?.toLowerCase() === "true") { + await mkdir(join(projectRoot, "temp"), { recursive: true }); + await writeFile(skipBuildMarker, "TYPESPEC_SKIP_WEBSITE_BUILD=true\n"); + console.log("Skipping astro-utils build"); + process.exit(0); +} + +await rm(skipBuildMarker, { force: true }); +await run("astro", ["check"]); +await run("tsc", ["-p", "./tsconfig.build.json"]); + +function run(command, args) { + return new Promise((resolveRun) => { + const child = spawn(command, args, { + cwd: projectRoot, + stdio: "inherit", + shell: process.platform === "win32", + }); + child.on("error", (error) => { + console.error(error.message); + process.exit(1); + }); + child.on("exit", (code, signal) => { + if (signal) { + process.kill(process.pid, signal); + return; + } + if (code !== 0) { + process.exit(code ?? 1); + } + resolveRun(); + }); + }); +} diff --git a/packages/astro-utils/package.json b/packages/astro-utils/package.json index b35e317dd4e..93f4c6fe938 100644 --- a/packages/astro-utils/package.json +++ b/packages/astro-utils/package.json @@ -19,7 +19,7 @@ "index.ts" ], "scripts": { - "build": "node -e \"if(process.env.TYPESPEC_SKIP_WEBSITE_BUILD==='true'){console.log('Skipping astro-utils build');process.exit(0)}else{process.exit(1)}\" || (astro check && tsc -p ./tsconfig.build.json)", + "build": "node ./.scripts/build.js", "watch": "tsc -p ./tsconfig.build.json --watch" }, "devDependencies": { diff --git a/packages/astro-utils/turbo.json b/packages/astro-utils/turbo.json new file mode 100644 index 00000000000..5c236939725 --- /dev/null +++ b/packages/astro-utils/turbo.json @@ -0,0 +1,8 @@ +{ + "extends": ["//"], + "tasks": { + "build": { + "outputs": ["dist/**", ".astro/**", "temp/turbo-build-skipped"] + } + } +} diff --git a/packages/typespec-vs/turbo.json b/packages/typespec-vs/turbo.json new file mode 100644 index 00000000000..186aff2e1a0 --- /dev/null +++ b/packages/typespec-vs/turbo.json @@ -0,0 +1,9 @@ +{ + "extends": ["//"], + "tasks": { + "build": { + "inputs": ["src/**", "scripts/**", "package.json"], + "outputs": ["src/bin/**", "src/obj/**", "Microsoft.TypeSpec.VS.vsix"] + } + } +} diff --git a/website/.scripts/build.ts b/website/.scripts/build.ts index c74e7696794..26cd7830d7f 100644 --- a/website/.scripts/build.ts +++ b/website/.scripts/build.ts @@ -1,16 +1,20 @@ #!/usr/bin/env node import { runOrExit } from "@typespec/internal-build-utils"; -import { copyFile } from "fs/promises"; +import { copyFile, mkdir, rm, writeFile } from "fs/promises"; import { join, resolve } from "path"; +export const repoRoot = resolve(import.meta.dirname, "../.."); +export const projectRoot = resolve(import.meta.dirname, ".."); +const skipBuildMarker = join(projectRoot, "temp/turbo-build-skipped"); + if (process.env.TYPESPEC_SKIP_WEBSITE_BUILD?.toLowerCase() === "true") { + await mkdir(join(projectRoot, "temp"), { recursive: true }); + await writeFile(skipBuildMarker, "TYPESPEC_SKIP_WEBSITE_BUILD=true\n"); console.log("Skipping website build: TYPESPEC_SKIP_WEBSITE_BUILD=true"); process.exit(0); } -export const repoRoot = resolve(import.meta.dirname, "../.."); -export const projectRoot = resolve(import.meta.dirname, ".."); - +await rm(skipBuildMarker, { force: true }); await copyFile( join(repoRoot, "packages/standalone/install.sh"), join(projectRoot, "public/install.sh"), diff --git a/website/turbo.json b/website/turbo.json new file mode 100644 index 00000000000..ea31d347fac --- /dev/null +++ b/website/turbo.json @@ -0,0 +1,14 @@ +{ + "extends": ["//"], + "tasks": { + "build": { + "outputs": [ + "dist/**", + ".astro/**", + "public/install.sh", + "public/install.ps1", + "temp/turbo-build-skipped" + ] + } + } +} From 5c2bc94ff230837f720ace6fae5bccadcf6e3c9c Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Fri, 29 May 2026 13:03:28 -0400 Subject: [PATCH 2/2] build: simplify astro-utils turbo config --- .../fix-turbo-warnings-2026-4-29-13-1-44.md | 7 ++++ packages/astro-utils/.scripts/build.js | 42 ------------------- packages/astro-utils/package.json | 2 +- packages/astro-utils/turbo.json | 3 +- 4 files changed, 10 insertions(+), 44 deletions(-) create mode 100644 .chronus/changes/fix-turbo-warnings-2026-4-29-13-1-44.md delete mode 100644 packages/astro-utils/.scripts/build.js diff --git a/.chronus/changes/fix-turbo-warnings-2026-4-29-13-1-44.md b/.chronus/changes/fix-turbo-warnings-2026-4-29-13-1-44.md new file mode 100644 index 00000000000..b63386dae89 --- /dev/null +++ b/.chronus/changes/fix-turbo-warnings-2026-4-29-13-1-44.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - typespec-vs +--- + +Configure Turbo build outputs for the Visual Studio extension package. diff --git a/packages/astro-utils/.scripts/build.js b/packages/astro-utils/.scripts/build.js deleted file mode 100644 index 358b76f0d5b..00000000000 --- a/packages/astro-utils/.scripts/build.js +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env node -import { spawn } from "child_process"; -import { mkdir, rm, writeFile } from "fs/promises"; -import { join, resolve } from "path"; - -const projectRoot = resolve(import.meta.dirname, ".."); -const skipBuildMarker = join(projectRoot, "temp/turbo-build-skipped"); - -if (process.env.TYPESPEC_SKIP_WEBSITE_BUILD?.toLowerCase() === "true") { - await mkdir(join(projectRoot, "temp"), { recursive: true }); - await writeFile(skipBuildMarker, "TYPESPEC_SKIP_WEBSITE_BUILD=true\n"); - console.log("Skipping astro-utils build"); - process.exit(0); -} - -await rm(skipBuildMarker, { force: true }); -await run("astro", ["check"]); -await run("tsc", ["-p", "./tsconfig.build.json"]); - -function run(command, args) { - return new Promise((resolveRun) => { - const child = spawn(command, args, { - cwd: projectRoot, - stdio: "inherit", - shell: process.platform === "win32", - }); - child.on("error", (error) => { - console.error(error.message); - process.exit(1); - }); - child.on("exit", (code, signal) => { - if (signal) { - process.kill(process.pid, signal); - return; - } - if (code !== 0) { - process.exit(code ?? 1); - } - resolveRun(); - }); - }); -} diff --git a/packages/astro-utils/package.json b/packages/astro-utils/package.json index 93f4c6fe938..b35e317dd4e 100644 --- a/packages/astro-utils/package.json +++ b/packages/astro-utils/package.json @@ -19,7 +19,7 @@ "index.ts" ], "scripts": { - "build": "node ./.scripts/build.js", + "build": "node -e \"if(process.env.TYPESPEC_SKIP_WEBSITE_BUILD==='true'){console.log('Skipping astro-utils build');process.exit(0)}else{process.exit(1)}\" || (astro check && tsc -p ./tsconfig.build.json)", "watch": "tsc -p ./tsconfig.build.json --watch" }, "devDependencies": { diff --git a/packages/astro-utils/turbo.json b/packages/astro-utils/turbo.json index 5c236939725..8e6f2949a96 100644 --- a/packages/astro-utils/turbo.json +++ b/packages/astro-utils/turbo.json @@ -2,7 +2,8 @@ "extends": ["//"], "tasks": { "build": { - "outputs": ["dist/**", ".astro/**", "temp/turbo-build-skipped"] + "cache": false, + "outputs": [] } } }