30 lines · 1.0 KB · TypeScript
RawDownload
import * as Schema from "effect/Schema"; import { T3ProjectFile, T3_PROJECT_FILE_SCHEMA_URL } from "@t3tools/contracts"; import { fromLenientJson } from "./schemaJson.ts"; /** * Codec between the raw `t3.json` file contents (lenient JSONC string) and the * decoded {@link T3ProjectFile}. */export const T3ProjectFileFromJson = fromLenientJson(T3ProjectFile); /** * Build the publishable JSON Schema document for `t3.json` (draft 2020-12). * * Served from the marketing site at {@link T3_PROJECT_FILE_SCHEMA_URL} so * editors get LSP support via a `$schema` reference. */export function buildT3ProjectFileJsonSchema(): Record<string, unknown> {  const document = Schema.toJsonSchemaDocument(T3ProjectFile);  const jsonSchema: Record<string, unknown> = {    $schema: "https://json-schema.org/draft/2020-12/schema",    $id: T3_PROJECT_FILE_SCHEMA_URL,    ...document.schema,  };  if (document.definitions && Object.keys(document.definitions).length > 0) {    jsonSchema.$defs = document.definitions;  }  return jsonSchema;}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t