interface ExportPresetsFile { preset: { [key: `${number}`]: ExportPresetBeforeProcessing } } type ExportPresetBeforeProcessing = Omit< ExportPreset, 'isGodot3' | 'index' | 'type' | 'meta' > type ExportPlatform = ExportPreset['platform'] type ExportType = ExportPreset['type'] interface GodotExportOptionsCommon { 'custom_template/debug': string 'custom_template/release': string } interface GodotExportOptionsCommonGodot3 extends GodotExportOptionsCommon { 'binary_format/64_bits': boolean } interface GodotExportOptionsCommonGodot4 extends GodotExportOptionsCommon { 'binary_format/architecture': 'x86_64' | 'x86_32' } type ExportWithMeta = ExportPreset & {meta: CompilerMeta} type ExportPreset = { name: string index: number export_path: string } & ( | ( | { type: 'uwp' isGodot3: true platform: 'UWP' options: GodotExportOptionsCommonGodot3 & { // arm | x86 | x64 'architecture/target': 0 | 1 | 2 } } | { type: 'osx' isGodot3: true platform: 'Mac OSX' options: GodotExportOptionsCommonGodot3 } | { type: 'web' isGodot3: true platform: 'HTML5' options: GodotExportOptionsCommonGodot3 & { // Regular, Threads, GDNative, 'variant/export_type': 0 | 1 | 2 'html/custom_html_shell': string } } | { type: 'android' isGodot3: true platform: ExportPlatforms options: GodotExportOptionsCommonGodot3 } | { type: 'ios' isGodot3: true platform: 'iOS' options: GodotExportOptionsCommonGodot3 } | { type: 'win' isGodot3: true platform: 'Windows Desktop' options: GodotExportOptionsCommonGodot3 } | { type: 'x11' isGodot3: true platform: 'Linux/X11' options: GodotExportOptionsCommonGodot3 } ) | ( | { isGodot3: false type: 'web' platform: 'Web' options: GodotExportOptionsCommonGodot4 & { 'variant/extensions_support': boolean 'html/custom_html_shell': string } } | { isGodot3: false type: 'osx' platform: 'macOS' options: GodotExportOptionsCommonGodot4 } | { isGodot3: false type: 'win' platform: 'Windows Desktop' options: GodotExportOptionsCommonGodot4 & { 'debug/export_console_script': boolean } } | { type: 'android' isGodot3: false platform: 'Android' options: GodotExportOptionsCommonGodot4 } | { type: 'uwp' isGodot3: false platform: 'UWP' options: GodotExportOptionsCommonGodot4 } | { type: 'ios' isGodot3: false platform: 'iOS' options: GodotExportOptionsCommonGodot4 } | { type: 'x11' isGodot3: false platform: 'Linux/X11' options: GodotExportOptionsCommonGodot4 } ) ) interface GodotSerializedObj { funcName: string args: unknown[] } interface PackedStringArray extends GodotSerializedObj { funcName: 'PackedStringArray' args: string[] } type NumericString = `${number}` type Renderer = 'Forward Plus' | 'mobile' | 'gl_compatibility' | 'none' type Variant = 'stable' | `alpha${number}` | `beta${number}` | `rc${number}` type FullVersion = `${number}.${number}-${Variant}` interface GodotFeatures extends PackedStringArray { funcName: 'PackedStringArray' args: [NumericString, Renderer, ...string[]] } interface IniDecodedFile { [key]: string | number | boolean | IniDecodedFile } interface GodotDeserializedConfig { [key: string]: | string | boolean | number | GodotDeserializedConfig | GodotSerializedObj } interface GodotProject { /** Godot version. We store an array to store the minor if necessary */ godotVersion: number[] /** Game default window size */ windowSize: number[] config_version: number application: { config: { /** The name of the project */ name: string /** the path to the icon */ icon: string /** a PackedStringArray containing the features of Godot. The first */ features: GodotFeatures } } display: { window: { size: | { width: number height: number } | { viewport_width: number viewport_height: number window_width_override: number window_height_override: number } } } run: { main_scene: string } } /** * All the necessary information to trigger a download of the template or the binary */ interface GodotDownloadInfo { type: 'binary' | 'template' version: FullVersion basename: string filename: string url: string } interface GodotDownloadInfoDict { binary: GodotDownloadInfo template: GodotDownloadInfo } type YYYYMMDD = `${number}${number}${number}${number}-${number}${number}-${number}${number}` interface BuildData { /** holds the type, names, and paths of the built presets. Used in templates to list downloads * Not filled automatically, you shouldn't assume it's there unless the building function specifies it. */ data: any windowSize: GodotProject['windowSize'] isGodot4: boolean variant: Variant frontmatter: FrontMatter doZipResults: boolean readme: string verbose: boolean /** Godot 4 Beta sometimes doesn't work in headless mode. We can pass this to use desktop mode (Won't work in CI!) */ skipHeadless: boolean debug: false cacheDir: string zipDir: string useTempDirs: boolean executable: string /** Directory where the unzipped template files are stored */ templatesDir: string exportsDir: string godot_version: GodotProject['godotVersion'] projectDir: string name: GodotProject['name'] icon: GodotProject['icon'] exports: ExportPreset[] date: DateMetaData git: GitMetaData } interface GitMetaData { remote: string commit: string commitShort: string branch: string version: string lastMessage: string submodules: {title: string; path: string}[] } interface DateMetaData { unix: number date: YYYYMMDD } interface MinimalBuildDataOptions extends Partial { projectDir: BuildData['projectDir'] cacheDir: BuildData['cacheDir'] exportsDir: BuildData['exportsDir'] } interface FromProjectBuildDataOptions extends Partial { projectDir: BuildData['projectDir'] workingDir?: string useTempDirs?: BuildData['useTempDirs'] doZipResults?: BuildData['doZipResults'] } interface ExhaustiveSwitchChecker { assertUnreachable(x: never): never } type VFile = import('vfile').VFile interface MarkdownResult extends VFile { data: import('vfile').Data & { headings: {depth: number; value: string}[] frontmatter?: Record } value: import('vfile').Value } interface MarkdownTransformed { frontmatter: FrontMatter html: string demos: BuildData[] } interface FrontMatter extends Record { firstHeader: string itchio?: string youtube?: string[] cover?: string tags?: string[] } interface TempFileHandler { modify: () => void restore: () => void originalContents: string } interface CompilerMeta { debugTemplate: string releaseTemplate: string regexTemplatePaths: RegExp presetPath: string presetFile: TempFileHandler command: string[] exportPath: string exportId: string compile: Compiler execCompileCommand: Compiler clean: () => void } interface Compiler { (): Promise } interface CompilerMaker { (buildData: BuildData, preset: ExportPreset): CompilerMeta } interface SpecialCompilers { [key: ExportType]: CompilerMaker } interface ItchIoButlerPushOptions { apiKey?: string directoryOrZip: string user: string game: string type?: string } /** * Used to pass arguments to builders from the command line. Accepts a list, an array, * a comma-delimited string, or the string 'all'. * Both `true` and `false` or `undefined` resolve to all available exports */ type PresetSpecification = | 'all' | boolean | ExportType[] | ExportType | `${ExportType},${ExportType}` | `${ExportType},${ExportType},${ExportType}` | `${ExportType},${ExportType},${ExportType},${ExportType}` interface CLICommand { (cliInput: string[], passedFlags?: Record): void } interface FileDescription { name: string isDirectory: boolean path: string } type ValueOf = T extends any[] ? T[number] : T[keyof T] interface Size { width: number height: number }