mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 01:29:56 +00:00
fix(build): complete source-only Kysely preparation
Keep the packed prepare hook independent of the unshipped source generator:
invoke its CLI only when source schemas exist and preserve failure exits.
Prepare declarations through their existing owner before direct tsgo profiling.
This completes the source preparation gaps from 6337d159e3 (#162288).
Update behavior: published npm installs have no source schemas and skip
source preparation. No database, rollback, or runtime update behavior changes.
No published version contains the regressing commit; 2026.9.7 predates it.
Validation: real pnpm-pack tarball fails the missing-import guard before and
passes after; cold profiler fails before and passes after. Focused owner and
package tests, changed checks, boundary lint, architecture, and P2 review pass.
This commit is contained in:
parent
92457bebe2
commit
83e4755b55
2 changed files with 12 additions and 2 deletions
|
|
@ -55,8 +55,16 @@ export function configurePrepareGitHooks(params = {}) {
|
|||
|
||||
if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
|
||||
if (existsSync(join(DEFAULT_PACKAGE_ROOT, "src/state/openclaw-state-schema.sql"))) {
|
||||
const { ensureKyselyTypes } = await import("./generate-kysely-types.mts");
|
||||
await ensureKyselyTypes(DEFAULT_PACKAGE_ROOT);
|
||||
// Source preparation uses the generator CLI; packaged installs have no schemas.
|
||||
const generated = spawnSync(process.execPath, [join(scriptDir, "generate-kysely-types.mts")], {
|
||||
stdio: "inherit",
|
||||
});
|
||||
if (generated.error) {
|
||||
throw generated.error;
|
||||
}
|
||||
if (generated.status !== 0) {
|
||||
process.exit(generated.status ?? 1);
|
||||
}
|
||||
}
|
||||
configurePrepareGitHooks();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import { spawnSync } from "node:child_process";
|
|||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { ensureKyselyTypes } from "./generate-kysely-types.mts";
|
||||
import { applyLocalTsgoPolicy, resolveRepoToolBinPath } from "./lib/local-check-runtime.mts";
|
||||
import { createManagedCommandInvocation } from "./lib/managed-child-process.mts";
|
||||
import { resolveRepoRoot } from "./lib/repo-root.mjs";
|
||||
|
|
@ -419,6 +420,7 @@ function profileGraph(name: GraphName, options: ProfileOptions) {
|
|||
|
||||
async function main(argv: string[]): Promise<void> {
|
||||
const { options, selectedGraphs } = parseArgs(argv);
|
||||
await ensureKyselyTypes(repoRoot);
|
||||
ensureDirs(options.outDir);
|
||||
const report: ProfileReport = {
|
||||
generatedAt: new Date().toISOString(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue