refactor: 리펙토링
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
scanProductionBundle,
|
||||
validateRecipeCatalog,
|
||||
} from "./lib/optional-recipes.ts";
|
||||
import { assertMatchesJsonSchema } from "./lib/json-schema.ts";
|
||||
|
||||
type GateViolation = Readonly<{
|
||||
ruleId: string;
|
||||
@@ -46,7 +47,25 @@ const recipes = Array.isArray(catalog.recipes) ? catalog.recipes : [];
|
||||
const packageDocument = JSON.parse(
|
||||
await readFile("package.json", "utf8"),
|
||||
) as Record<string, unknown>;
|
||||
const catalogViolations = validateRecipeCatalog(catalog, packageDocument);
|
||||
const catalogSchemaViolations: string[] = [];
|
||||
try {
|
||||
assertMatchesJsonSchema(
|
||||
JSON.parse(
|
||||
await readFile(
|
||||
"schemas/config/frontend-capability-recipes.schema.json",
|
||||
"utf8",
|
||||
),
|
||||
),
|
||||
catalog,
|
||||
"optional recipe catalog",
|
||||
);
|
||||
} catch {
|
||||
catalogSchemaViolations.push("CATALOG_JSON_SCHEMA_INVALID");
|
||||
}
|
||||
const catalogViolations = [
|
||||
...catalogSchemaViolations,
|
||||
...validateRecipeCatalog(catalog, packageDocument),
|
||||
];
|
||||
const runtimeSourceViolations = (
|
||||
await Promise.all(
|
||||
recipes.flatMap((recipe: unknown) => {
|
||||
|
||||
Reference in New Issue
Block a user