@chakra-ui/cli
Version:
Generate theme typings for autocomplete
66 lines (63 loc) • 1.95 kB
JavaScript
"use strict";
import { z } from 'zod';
const compositionFileSchema = z.object({
type: z.string(),
id: z.string(),
file: z.object({
name: z.string(),
content: z.string()
}),
component: z.string(),
npmDependencies: z.array(z.string()),
fileDependencies: z.array(z.string())
});
const compositionIndexSchema = z.array(
z.object({
type: z.string(),
id: z.string(),
file: z.string(),
component: z.string(),
npmDependencies: z.array(z.string()),
fileDependencies: z.array(z.string())
})
);
const processEnvSchema = z.object({
// REGISTRY_URL: z.string().default("http://localhost:3000"),
REGISTRY_URL: z.string().default("https://chakra-v3-docs.vercel.app"),
/** Base URL for docs site API (types, theme, search, examples). */
CHAKRA_DOCS_URL: z.string().url().default("https://chakra-ui.com"),
HTTPS_PROXY: z.string().optional()
});
const componentListSchema = z.object({
components: z.array(z.string()),
charts: z.array(z.string())
});
const searchItemSchema = z.object({
label: z.string(),
slug: z.string(),
url: z.string(),
description: z.string(),
category: z.string()
});
const searchResultsSchema = z.array(searchItemSchema);
const themeEntrySchema = z.object({
key: z.string(),
values: z.unknown()
});
const themeIndexSchema = z.array(themeEntrySchema);
const proBlockResponseSchema = z.object({
files: z.array(
z.object({
filename: z.string().optional(),
content: z.string().optional()
})
).optional()
}).passthrough();
const addCommandFlagsSchema = z.object({
force: z.boolean().optional(),
dryRun: z.boolean().optional(),
outdir: z.string().optional(),
all: z.boolean().optional(),
tsx: z.boolean().optional()
});
export { addCommandFlagsSchema, componentListSchema, compositionFileSchema, compositionIndexSchema, proBlockResponseSchema, processEnvSchema, searchItemSchema, searchResultsSchema, themeEntrySchema, themeIndexSchema };