mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-10 08:05:14 +02:00
perf(setup): speed up conductor setup and make it rerun-safe
Drop the duplicate `pnpm run build` (artifacts:build already builds every package). Run package builds in parallel topology via one recursive pnpm invocation. Enable incremental tsc and keep the cli's tsbuildinfo outside its dist (moved the dist wipe into a separate `clean` script). Run the final `ktx status` doctor from a temp dir so it stops walking up into a parent ktx.yaml and failing the script. Conductor setup drops from ~26s to ~9.8s cold and ~4.4s warm.
This commit is contained in:
parent
b759a4a286
commit
03f4e32143
7 changed files with 38 additions and 59 deletions
|
|
@ -31,12 +31,6 @@ async function writeJson(path, value) {
|
|||
await writeFile(path, `${JSON.stringify(value, null, 2)}\n`);
|
||||
}
|
||||
|
||||
const INTERNAL_BUILD_PACKAGE_NAMES = INTERNAL_NPM_WORKSPACE_PACKAGES.map((packageInfo) => packageInfo.name);
|
||||
const CONNECTOR_PACKAGE_NAMES = INTERNAL_BUILD_PACKAGE_NAMES.filter((packageName) =>
|
||||
packageName.startsWith('@ktx/connector-'),
|
||||
);
|
||||
const NPM_BUILD_PACKAGE_ORDER = ['@ktx/llm', '@ktx/context', ...CONNECTOR_PACKAGE_NAMES, '@ktx/cli'];
|
||||
|
||||
async function writeReleaseMetadataInputs(root) {
|
||||
for (const packageInfo of INTERNAL_NPM_WORKSPACE_PACKAGES) {
|
||||
await mkdir(join(root, packageInfo.packageRoot), { recursive: true });
|
||||
|
|
@ -81,24 +75,17 @@ describe('packageArtifactLayout', () => {
|
|||
});
|
||||
|
||||
describe('buildArtifactCommands', () => {
|
||||
it('builds TypeScript packages and the runtime wheel before packing npm artifacts', () => {
|
||||
it('builds TypeScript packages in parallel topology, then the runtime wheel, then packs npm artifacts', () => {
|
||||
const layout = packageArtifactLayout('/repo/ktx');
|
||||
const commands = buildArtifactCommands(layout);
|
||||
|
||||
assert.deepEqual(
|
||||
commands.slice(0, NPM_BUILD_PACKAGE_ORDER.length).map((command) => [command.command, command.args]),
|
||||
NPM_BUILD_PACKAGE_ORDER.map((packageName) => ['pnpm', ['--filter', packageName, 'run', 'build']]),
|
||||
);
|
||||
assert.deepEqual(
|
||||
commands.slice(NPM_BUILD_PACKAGE_ORDER.length, NPM_BUILD_PACKAGE_ORDER.length + 1).map((command) => [
|
||||
command.command,
|
||||
command.args,
|
||||
]),
|
||||
[[process.execPath, ['scripts/build-python-runtime-wheel.mjs']]],
|
||||
);
|
||||
assert.deepEqual(
|
||||
commands.slice(NPM_BUILD_PACKAGE_ORDER.length + 1).map((command) => [command.command, command.args]),
|
||||
[[process.execPath, ['scripts/build-public-npm-package.mjs']]],
|
||||
commands.map((command) => [command.command, command.args]),
|
||||
[
|
||||
['pnpm', ['--filter', './packages/*', '--workspace-concurrency=10', 'run', 'build']],
|
||||
[process.execPath, ['scripts/build-python-runtime-wheel.mjs']],
|
||||
[process.execPath, ['scripts/build-public-npm-package.mjs']],
|
||||
],
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue