Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions cli/check-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ function fileCase(id: string, description: string, scriptPath: string): Compiler
};
}

const COMPILER_CASES: CompilerCaseDefinition[] = [
let _compilerCases: CompilerCaseDefinition[] | undefined;
function getCompilerCases(): CompilerCaseDefinition[] {
if (_compilerCases) return _compilerCases;
_compilerCases = [
inlineCase(
'exact-boolean-plate',
'Exact boolean plate with profile booleans and tapered extrude stays on the exact route.',
Expand Down Expand Up @@ -335,9 +338,11 @@ return [{ name: 'Profile', sketch: profile }];
fileCase(
'example-brep-exportable',
'The public BREP-exportable example stays on the exact compiler route.',
'examples/api/brep-exportable.forge.js',
resolvePackagePath(import.meta.url, 'examples', 'api', 'brep-exportable.forge.js'),
),
];
];
return _compilerCases;
}

function parseArgs(argv: string[]) {
let update = false;
Expand Down Expand Up @@ -380,7 +385,8 @@ function stripUndefinedDeep<T>(value: T): T {
}

function generateSnapshots(caseId?: string): CompilerCaseSnapshot[] {
const selected = caseId ? COMPILER_CASES.filter((entry) => entry.id === caseId) : COMPILER_CASES;
const cases = getCompilerCases();
const selected = caseId ? cases.filter((entry) => entry.id === caseId) : cases;
if (selected.length === 0) {
throw new Error(`Unknown compiler snapshot case: ${caseId}`);
}
Expand Down
13 changes: 9 additions & 4 deletions cli/check-query-propagation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ function compilerCorpusCase(
return fileCase(part.id, description, part.scriptPath, expectedObjects);
}

const QUERY_PROPAGATION_CASES: QueryPropagationCaseDefinition[] = [
let _queryPropagationCases: QueryPropagationCaseDefinition[] | undefined;
function getQueryPropagationCases(): QueryPropagationCaseDefinition[] {
if (_queryPropagationCases) return _queryPropagationCases;
_queryPropagationCases = [
inlineCase(
'trim-and-split-created-faces',
'Trim and split-by-plane workflows keep the defended plane-cap created-face query visible for each surviving branch.',
Expand Down Expand Up @@ -478,7 +481,9 @@ const QUERY_PROPAGATION_CASES: QueryPropagationCaseDefinition[] = [
},
],
),
];
];
return _queryPropagationCases;
}

function parseArgs(argv: string[]) {
let update = false;
Expand Down Expand Up @@ -583,7 +588,7 @@ function summarizeShapeObject(object: CompilerShapeInspection): QueryPropagation
}

function generateSnapshots(caseId?: string): QueryPropagationCaseSnapshot[] {
const selected = caseId ? QUERY_PROPAGATION_CASES.filter((entry) => entry.id === caseId) : QUERY_PROPAGATION_CASES;
const selected = caseId ? getQueryPropagationCases().filter((entry) => entry.id === caseId) : getQueryPropagationCases();
if (selected.length === 0) {
throw new Error(`Unknown query-propagation snapshot case: ${caseId}`);
}
Expand Down Expand Up @@ -626,7 +631,7 @@ function assertIncludesAll(
}

function assertExpectedCoverage(snapshots: QueryPropagationCaseSnapshot[]): void {
const definitions = new Map(QUERY_PROPAGATION_CASES.map((entry) => [entry.id, entry]));
const definitions = new Map(getQueryPropagationCases().map((entry) => [entry.id, entry]));

for (const snapshot of snapshots) {
const definition = definitions.get(snapshot.id);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build:solver": "node scripts/solver-build.mjs --release",
"build:solver:dev": "node scripts/solver-build.mjs",
"test:solver": "node scripts/solver-test.mjs",
"build": "npm run build:solver && tsc && vite build && npm run build:cli",
"build": "npm run build:solver && npm run build:skill:forgecad && tsc && vite build && npm run build:cli",
"build:web": "npm run build:solver && tsc && FORGE_MODE=web vite build",
"dev:cli": "tsup cli/forgecad.ts --format esm --platform node --target node20 --out-dir dist-cli --sourcemap --external typescript",
"build:cli": "tsup cli/forgecad.ts --format esm --platform node --target node20 --out-dir dist-cli --clean --sourcemap --external typescript",
Expand Down
Loading