fix(ai): validate generated model data before builds
This commit is contained in:
@@ -8,7 +8,7 @@ const agentTreeshakeOutputPath = join(tmpdir(), "pi-agent-treeshake-smoke.js");
|
||||
const errorLogPath = join(tmpdir(), "pi-browser-smoke-errors.log");
|
||||
const generatedCatalogDataDir = join(process.cwd(), "packages/ai/src/providers/data");
|
||||
|
||||
// Fresh checkouts do not materialize provider JSON until npm run build.
|
||||
// Fresh checkouts do not materialize provider JSON until model data is hydrated.
|
||||
const generatedCatalogDataPlugin = {
|
||||
name: "generated-model-catalog",
|
||||
setup(build) {
|
||||
|
||||
@@ -209,9 +209,9 @@ const bunInstallDirectory = join(outDir, "bun-install");
|
||||
const binaryDirectory = join(outDir, "bun");
|
||||
mkdirSync(tarballDirectory, { recursive: true });
|
||||
|
||||
if (!options.skipCheck || !options.skipTest) {
|
||||
run("npm", ["--prefix", "packages/ai", "run", "generate-models"], { cwd: repoRoot });
|
||||
}
|
||||
// Release artifacts always use a freshly generated, strictly validated catalog,
|
||||
// including when checks or tests are explicitly skipped.
|
||||
run("npm", ["run", "generate:models"], { cwd: repoRoot });
|
||||
|
||||
if (!options.skipCheck) {
|
||||
run("npm", ["run", "check"], { cwd: repoRoot });
|
||||
@@ -223,7 +223,7 @@ if (!options.skipTest) {
|
||||
|
||||
for (const pkg of packages) {
|
||||
run("npm", ["run", "clean"], { cwd: pkg.directory });
|
||||
run("npm", ["run", "build"], { cwd: pkg.directory });
|
||||
run("npm", ["run", pkg.directory === "packages/ai" ? "build:offline" : "build"], { cwd: pkg.directory });
|
||||
}
|
||||
|
||||
const tarballs = new Map();
|
||||
|
||||
@@ -167,6 +167,7 @@ console.log();
|
||||
// 4. Regenerate release artifacts
|
||||
console.log("Regenerating release artifacts...");
|
||||
run("npm run generate:models");
|
||||
run("npm run check:model-data");
|
||||
run("npm run shrinkwrap:coding-agent");
|
||||
run("npm run install-lock:coding-agent");
|
||||
console.log();
|
||||
|
||||
Reference in New Issue
Block a user