chore: initialize from frontend template 4dc033c
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import { mkdir } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
import { realtimeBoundariesArtifactSchema } from "./contracts/release-artifacts.ts";
|
||||
import { scanRealtimeBoundaries } from "./lib/realtime-boundaries.ts";
|
||||
import { writeValidatedJsonArtifact } from "./lib/validated-json-artifact.ts";
|
||||
|
||||
const sourceRoot = argument("--source-root") ?? "src";
|
||||
const artifact =
|
||||
argument("--artifact") ??
|
||||
"artifacts/quality/realtime-boundaries.json";
|
||||
const violations = await scanRealtimeBoundaries(sourceRoot);
|
||||
const report = realtimeBoundariesArtifactSchema.parse({
|
||||
schemaVersion: 1,
|
||||
sourceRoot,
|
||||
violations,
|
||||
passed: violations.length === 0,
|
||||
});
|
||||
|
||||
await mkdir(path.dirname(artifact), { recursive: true });
|
||||
await writeValidatedJsonArtifact({
|
||||
path: artifact,
|
||||
schema: realtimeBoundariesArtifactSchema,
|
||||
value: report,
|
||||
});
|
||||
|
||||
if (violations.length > 0) {
|
||||
for (const violation of violations) {
|
||||
process.stderr.write(
|
||||
`${violation.file}:${violation.line} ${violation.ruleId}\n`,
|
||||
);
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
process.stdout.write(
|
||||
`Realtime boundaries: PASS (${sourceRoot})\n`,
|
||||
);
|
||||
|
||||
function argument(name: string): string | undefined {
|
||||
const index = process.argv.indexOf(name);
|
||||
return index >= 0 ? process.argv[index + 1] : undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user