28 lines
1003 B
JavaScript
28 lines
1003 B
JavaScript
#!/usr/bin/env node
|
|
"use strict";
|
|
|
|
const path = require("path");
|
|
const { readAreaConfig } = require("./lib/area-config");
|
|
const { compileArea, parseArgs } = require("./compile-native-roads");
|
|
const { checkOutput } = require("../packages/road-compiler/src/check");
|
|
|
|
const repoRoot = path.resolve(__dirname, "..");
|
|
|
|
function checkArea(configPath, options = {}) {
|
|
if (options.compile) compileArea(configPath);
|
|
const area = readAreaConfig(configPath, { repoRoot });
|
|
return checkOutput({ areaId: area.id, outDir: area.outputs.nativeRoadDir });
|
|
}
|
|
|
|
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 result = checkArea(configPath, { compile: args.compile === "true" });
|
|
console.log(`NATIVE_ROAD_CHECK_DONE ${JSON.stringify(result)}`);
|
|
if (!result.ok) process.exitCode = 1;
|
|
}
|
|
|
|
if (require.main === module) main();
|
|
|
|
module.exports = { checkArea };
|