feat: config files, readme

This commit is contained in:
2026-07-04 21:32:03 +02:00
parent d1620f7fdb
commit c3313223ef
13 changed files with 311 additions and 16 deletions
+28
View File
@@ -1,3 +1,5 @@
import { type } from "arktype";
export interface Options {
/**
* Pattern matching files to include in parsing
@@ -66,6 +68,22 @@ export interface Options {
emitRegions: boolean;
}
export const Options = type({
include: "string[]",
"exclude?": "string[]",
"outDir?": "string | null",
"fileExtension?": "string",
"testName?": "string | null",
"templateRoot?": "boolean",
"templateHeader?": "string[]",
"templateFooter?": "string[]",
"format?": '"jest" | "vitest" | "assert"',
"onlyGenerateTests?": "boolean",
"requireCodeBlock?": "boolean",
"includePath?": "boolean",
"emitRegions?": "boolean",
});
export const DEFAULT_OPTIONS: Required<Options> = {
include: [],
exclude: [],
@@ -81,3 +99,13 @@ export const DEFAULT_OPTIONS: Required<Options> = {
includePath: true,
emitRegions: true,
};
export function defineConfig(
opts: Partial<Omit<Options, "include">> &
Pick<Options, "include">,
): Options {
return {
...DEFAULT_OPTIONS,
...opts,
};
}