@baseplate-dev/sync
Version:
Library for syncing Baseplate descriptions
40 lines • 1.18 kB
JavaScript
import { z } from 'zod';
/**
* Schema for a single template configuration in the extractor.json file
*/
export const templateConfigSchema = z
.object({
/**
* Source file path relative to templates directory
*/
sourceFile: z.string(),
/**
* Type of the template. For example, it can be `ts` for typescript templates.
*/
type: z.string(),
})
.passthrough();
/**
* Main schema for extractor.json configuration
*/
export const extractorConfigSchema = z.object({
/**
* Name of the generator, e.g. auth/auth-module
*/
name: z
.string()
.regex(/^[a-z0-9-/]+$/, 'must be a valid generator basename e.g. core/fastify-scripts'),
/**
* Template map keyed by template name
*/
templates: z.record(templateConfigSchema).default({}),
/**
* Configuration for each extractor keyed by extractor type
*/
extractors: z.record(z.string(), z.object({}).passthrough()).optional(),
/**
* Plugin-specific configuration keyed by plugin name
*/
plugins: z.record(z.string(), z.object({}).passthrough()).optional(),
});
//# sourceMappingURL=extractor-config.schema.js.map