refactor: consume external road compiler
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
const { readAreaConfig, toRoadCompilerInput } = require("./lib/area-config");
|
||||
const { compileInput } = require("../packages/road-compiler/src/compile/compiler");
|
||||
const { readAreaConfig } = require("./lib/area-config");
|
||||
const { compileArea: compileWithCli } = require("./lib/road-compiler-cli");
|
||||
|
||||
const repoRoot = path.resolve(__dirname, "..");
|
||||
|
||||
@@ -19,15 +19,13 @@ function parseArgs(argv) {
|
||||
|
||||
function compileArea(configPath) {
|
||||
const area = readAreaConfig(configPath, { repoRoot });
|
||||
const compiled = compileInput(toRoadCompilerInput(area));
|
||||
return { ...compiled, area };
|
||||
return { area, marker: compileWithCli(area) };
|
||||
}
|
||||
|
||||
function main() {
|
||||
const args = parseArgs(process.argv.slice(2));
|
||||
const configPath = path.resolve(args.config || path.join(repoRoot, "config", "areas", "nantaizi-lake-innovation-valley.json"));
|
||||
const { area, result, comparison } = compileArea(configPath);
|
||||
console.log(`NATIVE_ROAD_COMPILE_DONE ${JSON.stringify({ areaId: area.id, roads: result.model.roads.length, endpoints: result.model.endpoints.length, diagnostics: result.diagnostics.length, output: area.outputs.nativeRoadDir, comparison })}`);
|
||||
compileArea(configPath);
|
||||
}
|
||||
|
||||
if (require.main === module) main();
|
||||
|
||||
Reference in New Issue
Block a user