UNPKG

shipthis

Version:

ShipThis manages building and uploading your Godot games to the App Store and Google Play.

97 lines (94 loc) 3.58 kB
import { jsx } from 'react/jsx-runtime'; import { Flags } from '@oclif/core'; import { render } from 'ink'; import { h as CapabilityTypeOption } from '../../../../baseCommand-CTn3KGH3.js'; import 'node:fs'; import 'axios'; import 'crypto-js'; import 'uuid'; import 'luxon'; import 'node:path'; import 'chalk'; import 'node:crypto'; import 'node:readline'; import 'node:url'; import 'readline-sync'; import 'isomorphic-git'; import '@tanstack/react-query'; import 'react'; import { f as fetchBundleId } from '../../../../useAppleBundleId-BnwPmVEu.js'; import 'fast-glob'; import 'yazl'; import 'socket.io-client'; import 'fullscreen-ink'; import 'ink-spinner'; import 'string-length'; import 'strip-ansi'; import 'open'; import '@inkjs/ui'; import { c as BaseGameCommand } from '../../../../baseGameCommand-8VL7xe-O.js'; import 'marked'; import 'marked-terminal'; import 'qrcode'; import { R as RunWithSpinner } from '../../../../RunWithSpinner-DucRnFp6.js'; import { C as Command } from '../../../../Command-Cj6F5B5a.js'; import '@expo/apple-utils/build/index.js'; import 'deepmerge'; import 'ini'; import 'fs'; import 'path'; class GameIosAppSync extends BaseGameCommand { static args = {}; static description = 'Synchronies the Apple App "BundleId" with the capabilities from the local project.'; static examples = ["<%= config.bin %> <%= command.id %>"]; static flags = { force: Flags.boolean({ char: "f" }), // not used but don't remove or the wizard breaks gameId: Flags.string({ char: "g", description: "The ID of the game" }), quiet: Flags.boolean({ char: "q", description: "Avoid output except for interactions and errors" }) }; async run() { const game = await this.getGame(); const authState = await this.refreshAppleAuthState(); const ctx = authState.context; if (!game.details?.iosBundleId) return this.error("Please run `shipthis game ios app create` first"); const { iosBundleId } = game.details; const syncCapabilities = async () => { const bundleQueryResponse = await fetchBundleId({ ctx, iosBundleId }); const { bundleId, capabilities: existing, projectCapabilities } = bundleQueryResponse; if (!bundleId) return this.error("BundleId not found"); if (!projectCapabilities) return this.error("Project capabilities not loaded"); const unRemovable = /* @__PURE__ */ new Set(["IN_APP_PURCHASE"]); const toRemove = existing.filter((c) => !projectCapabilities.includes(c) && !unRemovable.has(c)); const toAdd = projectCapabilities.filter((c) => !existing.includes(c)); for (const capability of toRemove) { await bundleId.updateBundleIdCapabilityAsync({ capabilityType: capability, option: CapabilityTypeOption.OFF }); } for (const capability of toAdd) { await bundleId.updateBundleIdCapabilityAsync({ capabilityType: capability, option: CapabilityTypeOption.ON }); } }; const handleComplete = async () => { await this.config.runCommand("game:ios:app:status", ["--gameId", game.id]); }; if (this.flags.quiet) return await syncCapabilities(); render( /* @__PURE__ */ jsx(Command, { command: this, children: /* @__PURE__ */ jsx( RunWithSpinner, { executeMethod: syncCapabilities, msgComplete: "App Store BundleId capabilities synced", msgInProgress: "Syncing App Store BundleId capabilities", onComplete: handleComplete } ) }) ); } } export { GameIosAppSync as default };