70bf21e064
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
26 lines
723 B
TypeScript
26 lines
723 B
TypeScript
import { writeFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import { createGenerator } from "ts-json-schema-generator";
|
|
import type { Config, Schema } from "ts-json-schema-generator";
|
|
|
|
const config: Config = {
|
|
path: join(__dirname, "../../workers-utils/src/config/config.ts"),
|
|
tsconfig: join(__dirname, "../../workers-utils/tsconfig.json"),
|
|
type: "RawConfig",
|
|
skipTypeCheck: true,
|
|
markdownDescription: true,
|
|
};
|
|
|
|
const applyFormattingRules = (schema: Schema) => {
|
|
return { ...schema, allowTrailingCommas: true };
|
|
};
|
|
|
|
const schema = applyFormattingRules(
|
|
createGenerator(config).createSchema(config.type)
|
|
);
|
|
|
|
writeFileSync(
|
|
join(__dirname, "../config-schema.json"),
|
|
JSON.stringify(schema, null, 2)
|
|
);
|