UNPKG

@minecraft/creator-tools

Version:

Minecraft Creator Tools command line and libraries.

71 lines (70 loc) 4.42 kB
import { JSONSchema7 } from "json-schema"; import IField, { FieldDataType } from "../dataform/IField"; import IFormDefinition, { IFormSample } from "../dataform/IFormDefinition"; import IFolder from "../storage/IFolder"; import ILegacyDocumentationNode from "../minecraft/docs/ILegacyDocumentation"; import IFile from "../storage/IFile"; import { AnnotationCategory } from "../core/ContentIndex"; export interface JsonTypeSummary { title: string; category: string; } export default class FormJsonDocumentationGenerator { defsById: { [name: string]: JSONSchema7; }; defsByTitle: { [name: string]: JSONSchema7; }; defRefs: { [name: string]: number; }; defCategories: { [name: string]: string; }; updateFormSource(folder: IFolder, isPreview?: boolean): Promise<void>; generateSubformsFromFields(formJsonFolder: IFolder, resultForms: (IFormDefinition | undefined)[], prefix?: string): Promise<IFormDefinition[]>; generateFormNodesFromPseudoSchemaDocs(formJsonFolder: IFolder, node: ILegacyDocumentationNode, prefix?: string): Promise<IFormDefinition[]>; static cleanForId(id: string | undefined): string; generateFormJson(inputFolder: IFolder, outputFolder: IFolder): Promise<void>; generateFormJsonFromFolder(inputFolder: IFolder, outputFolder: IFolder): Promise<void>; finalizeJsonForm(formObj: IFormDefinition, outputFile: IFile): Promise<void>; mergeOntoForm(targetForm: IFormDefinition, generatedFormToMergeOn: IFormDefinition): void; exportJsonSchemaForms(formJsonFolder: IFolder): Promise<void>; getIsStandaloneSchemaFile(keyOrTitle: string): boolean; isDisallowedSchemaFile(key: string): boolean; getFormPathForJsonSchemaForm(schemaKey: string): string; private processAndExportJsonSchemaNode; getFormFileNameBase(key: string): string; private getVersionlessString; getJsonFormFromJsonSchemaKey(keyName: string): Promise<IFormDefinition>; getJsonFormFromJsonSchemaDefinition(node: JSONSchema7, nodeName?: string, fieldList?: string[], depth?: number): Promise<IFormDefinition>; static humanifySchemaTag(name: string): string; loadSchemas(schemaFolder: IFolder, categoryName: string): Promise<void>; private processJsonSchemaDefinition; generateFormNodesFromLegacyDocNode(formJsonFolder: IFolder, node: ILegacyDocumentationNode, prefix?: string): Promise<void>; getOriginalFormDefinition(formJsonFolder: IFolder, name: string, categoryName?: string): Promise<IFormDefinition>; mergeToFile(formJsonFolder: IFolder, name: string, formDefNode: IFormDefinition, categoryName?: string, isSchema?: boolean): Promise<void>; annotateFormJson(formDefNode: IFormDefinition, name: string, prefix?: string, originalNode?: IFormDefinition): Promise<void>; distributeSampleValues(samplesNode: { [name: string]: IFormSample[]; }, formDefNode: IFormDefinition, pathTokens: string[], originalNode?: IFormDefinition): Promise<void>; private static readonly MAX_SAMPLES_PER_FORM; private static debugFileCount; private static readonly DEBUG_LOG_FREQUENCY; addVanillaMatches(formDefNode: IFormDefinition, name: string, annotations: AnnotationCategory[]): Promise<void>; addSamplesMatches(formDefNode: IFormDefinition, name: string, annotations: AnnotationCategory[]): Promise<void>; private static readonly MAX_APPEND_DEPTH; appendNodesByName(exampleList: IFormSample[], nodeName: string, source: object, path: string, depth?: number): void; static sanitizeTitle(title: string): void; getFormFromDocNode(childNode: ILegacyDocumentationNode, name?: string): IFormDefinition; getFieldFromDocNode(childNode: ILegacyDocumentationNode): IField; getDefinitionFromId(definitionString: string): JSONSchema7; getFieldFromJsonPropertyNode(childNode: JSONSchema7, propName: string, alreadyProcessedFieldList?: string[], depth?: number): Promise<IField>; getFieldIsDifferentType(fieldA: IField, fieldB: IField): boolean; addChildSchemaNode(fieldNode: IField, propName: string, subDefNode: JSONSchema7, dataType: FieldDataType, alreadyProcessedFieldList: string[], depth?: number): Promise<void>; static humanifyId(title: string): string; static humanifyText(title: string): string; humanifyJsonMinecraftName(title: string): string; getFormFileName(name: string, dataVersion?: string): string; }