UNPKG

@knapsack/app

Version:

Build Design Systems with Knapsack

64 lines 2.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.KnapsackConfigSchema = void 0; const zod_1 = require("zod"); const file_utils_1 = require("@knapsack/file-utils"); const renderer_base_1 = require("../domains/patterns/renderers/renderer-base"); const PathSchema = zod_1.z.custom((val) => { return typeof val === 'string' && ((0, file_utils_1.isAbsolute)(val) || (0, file_utils_1.isRelativePath)(val)); }, { error: ({ input }) => `Must be either an absolute or relative path. Received: "${input}"`, }); const TokenTargetSchema = zod_1.z.strictObject({ enabled: zod_1.z.boolean(), filterTokens: zod_1.z .custom((val) => typeof val === 'function') .optional(), }); exports.KnapsackConfigSchema = zod_1.z.strictObject({ public: PathSchema, dist: PathSchema, data: PathSchema, version: zod_1.z.string().optional(), designTokens: zod_1.z .strictObject({ srcFilePath: PathSchema.optional(), distDir: PathSchema.optional(), targets: zod_1.z .strictObject({ css: TokenTargetSchema.optional(), js: TokenTargetSchema.optional(), android: TokenTargetSchema.optional(), ios: TokenTargetSchema.optional(), }) .optional(), }) .optional(), cloud: zod_1.z .strictObject({ siteId: zod_1.z.string(), repoRoot: PathSchema.optional(), repoName: zod_1.z.string().optional(), repoOwner: zod_1.z.string().optional().meta({ deprecated: true }), }) .optional(), devServer: zod_1.z .strictObject({ https: zod_1.z.boolean().optional(), ssl: zod_1.z .strictObject({ cert: PathSchema, key: PathSchema, }) .optional(), port: zod_1.z.number().optional(), }) .optional(), plugins: zod_1.z .array( // leaving the validation light on this one since we have 1 plugin (changelog) and it is from Knapsack zod_1.z.custom((val) => zod_1.z.object({}).safeParse(val).success)) .optional(), templateRenderers: zod_1.z.array(zod_1.z.custom((val) => zod_1.z.instanceof(renderer_base_1.RendererBase).safeParse(val).success)), }); //# sourceMappingURL=knapsack-config.js.map