UNPKG

shipthis

Version:

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

101 lines (97 loc) 4.35 kB
import { jsxs, jsx, Fragment } from 'react/jsx-runtime'; import { Flags } from '@oclif/core'; import { Box, Text, render } from 'ink'; import 'node:fs'; import 'axios'; import 'crypto-js'; import 'uuid'; import { C as CredentialsType, P as Platform } from '../../../../baseCommand-CTn3KGH3.js'; 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 'fast-glob'; import 'yazl'; import 'socket.io-client'; import 'fullscreen-ink'; import Spinner from 'ink-spinner'; import 'string-length'; import 'strip-ansi'; import { P as ProjectCredentialsTable } from '../../../../ProjectCredentialsTable-BJJz7W1P.js'; import 'open'; import '@inkjs/ui'; import { c as BaseGameCommand } from '../../../../baseGameCommand-8VL7xe-O.js'; import 'marked'; import 'marked-terminal'; import 'qrcode'; import { u as useAppleProfiles, c as canAppleProfileBeUsed, g as getAppleProfileSummary } from '../../../../useAppleProfiles-DY-H0420.js'; import { u as useProjectCredentials } from '../../../../useProjectCredentials-TvlolkId.js'; import { T as Table } from '../../../../Table-FaNgpyeq.js'; import { T as Title } from '../../../../Title-BCQtayg6.js'; import { N as NextSteps } from '../../../../NextSteps-DbJHmscQ.js'; import { C as Command } from '../../../../Command-Cj6F5B5a.js'; import '@expo/apple-utils/build/index.js'; import 'deepmerge'; import 'ini'; import 'fs'; import 'path'; const AppleProfilesTable = ({ ctx, project, ...boxProps }) => { const { data: credentialsResponse } = useProjectCredentials({ platform: Platform.IOS, projectId: project.id, type: CredentialsType.CERTIFICATE }); const { data: profiles, isLoading } = useAppleProfiles({ ctx }); const hasUsable = profiles && credentialsResponse && profiles.some((cert) => canAppleProfileBeUsed(cert, project, credentialsResponse.data)); return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, ...boxProps, children: [ /* @__PURE__ */ jsx(Title, { children: "Mobile Provisioning Profiles in your Apple account" }), isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }), profiles && credentialsResponse && /* @__PURE__ */ jsxs(Fragment, { children: [ /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, marginLeft: 2, children: [ /* @__PURE__ */ jsx(Text, { children: `You have ${profiles.length} Mobile Provisioning Profiles in your Apple account` }), /* @__PURE__ */ jsx(Text, { children: `${hasUsable ? "One" : "None"} of these can be used by ShipThis` }) ] }), profiles.length > 0 && /* @__PURE__ */ jsx(Table, { data: profiles.map((cert) => getAppleProfileSummary(cert, project, credentialsResponse.data)) }), !hasUsable && /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { bold: true, children: "You do not have a usable Mobile Provisioning Profile. To ship an iOS game, you will need a usable Mobile Provisioning Profile." }) }) ] }), profiles && !hasUsable && /* @__PURE__ */ jsx(NextSteps, { steps: ["shipthis game ios profile create"] }) ] }); }; class GameIosProfileStatus extends BaseGameCommand { static args = {}; static description = "Shows the Game iOS Mobile Provisioning Profile Status."; static examples = ["<%= config.bin %> <%= command.id %>"]; static flags = { gameId: Flags.string({ char: "g", description: "The ID of the game" }), noAppleAuth: Flags.boolean({ char: "f" }) }; async run() { const { flags } = this; const showApple = !flags.noAppleAuth; const game = await this.getGame(); let ctx = null; if (showApple) { const authState = await this.refreshAppleAuthState(); ctx = authState.context; } render( /* @__PURE__ */ jsxs(Command, { command: this, children: [ /* @__PURE__ */ jsx( ProjectCredentialsTable, { credentialTypeName: "Mobile Provisioning Profile", queryProps: { platform: Platform.IOS, projectId: game.id, type: CredentialsType.CERTIFICATE } } ), showApple && /* @__PURE__ */ jsx(AppleProfilesTable, { ctx, project: game }) ] }) ); } } export { GameIosProfileStatus as default };