Delete apps/www, packages/admin-web, every packages/hive-mind-* package, packages/memory-mcp and packages/wiki-compiler (ADR-0002), with what existed only for them: their tests kept outside the packages, the hook runtime build, the hive-mind OSS subtree-split and drift scripts, the www deploy and hive-mind-cli workflows, the staged hook lifecycle step in the Windows desktop workflows, and the root dev:www, build:www and build:hook-runtime scripts. Drop the matching excludes from the Vitest, ESLint and workspace dependency checks, the next override, and the extraneous workspace entries from package-lock.json. The smart-router qualification seed now writes its spend to waggle.db, where the sidecar has read cost traces since P1.5.
36 lines
1.5 KiB
TypeScript
36 lines
1.5 KiB
TypeScript
import { readdirSync, existsSync, readFileSync } from 'node:fs';
|
|
import { resolve, join } from 'node:path';
|
|
|
|
/**
|
|
* Resolve conditions for the test runs: workspace packages export their
|
|
* TypeScript source under the `source` condition (P2.1), so tests run against
|
|
* src/ without a build step, the same way tsx and the sidecar bundle do.
|
|
*/
|
|
export const WAGGLE_SOURCE_CONDITIONS = ['source', 'module', 'node', 'development|production'];
|
|
|
|
/**
|
|
* Map the `@waggle/<dir>` packages that do not export a `source` condition to
|
|
* their `src/` directory. Only the postponed team packages (team-server,
|
|
* waggle-dance, worker) still need this; it goes away with them.
|
|
*
|
|
* The alias target is the `src/` DIRECTORY (not `src/index.ts`): vite resolves
|
|
* a bare `@waggle/x` import to the directory's index, AND a subpath import like
|
|
* `@waggle/x/scope` to `…/src/scope`.
|
|
*/
|
|
export function waggleSrcAliases(repoRoot: string): Record<string, string> {
|
|
const pkgsDir = resolve(repoRoot, 'packages');
|
|
const aliases: Record<string, string> = {};
|
|
for (const dir of readdirSync(pkgsDir)) {
|
|
const srcDir = join(pkgsDir, dir, 'src');
|
|
if (!existsSync(join(srcDir, 'index.ts')) || exportsSource(join(pkgsDir, dir, 'package.json'))) continue;
|
|
aliases[`@waggle/${dir}`] = srcDir;
|
|
}
|
|
return aliases;
|
|
}
|
|
|
|
function exportsSource(manifestPath: string): boolean {
|
|
if (!existsSync(manifestPath)) return false;
|
|
const manifest = JSON.parse(readFileSync(manifestPath, 'utf-8')) as { exports?: unknown };
|
|
return JSON.stringify(manifest.exports ?? null).includes('"source"');
|
|
}
|