UNPKG

shipthis

Version:

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

88 lines (85 loc) 3.28 kB
import { jsx } from 'react/jsx-runtime'; import * as fs from 'node:fs'; import { Args, Flags } from '@oclif/core'; import { render } from 'ink'; import { a as getProjectCredentials } from '../../../../index-izrACZbC.js'; import { P as Platform, C as CredentialsType } from '../../../../index-BwnzoldS.js'; import 'ink-spinner'; import 'node:crypto'; import 'node:path'; import 'node:readline'; import 'node:url'; import 'readline-sync'; import 'luxon'; import 'axios'; import 'isomorphic-git'; import '@tanstack/react-query'; import 'react'; import 'crypto-js'; import 'uuid'; import 'fast-glob'; import 'yazl'; import 'socket.io-client'; import 'fullscreen-ink'; import 'string-length'; import 'strip-ansi'; import 'open'; import '@inkjs/ui'; import '../../../../ejs-DirFZbza.js'; import 'marked'; import 'marked-terminal'; import 'qrcode'; import { R as RunWithSpinner } from '../../../../RunWithSpinner-DucRnFp6.js'; import '../../../../index-hoHfGrjg.js'; import { C as Command } from '../../../../Command-DN1j3tjt.js'; import { B as BaseGameAndroidCommand } from '../../../../baseGameAndroidCommand-BCB1SMCf.js'; import { e as exportCredential } from '../../../../export-DFCZKNQk.js'; import '@expo/apple-utils/build/index.js'; import 'deepmerge'; import 'ini'; import 'fs'; import 'path'; import '../../../../index-CJWMt1s-.js'; import '../../../../useAndroidServiceAccountTestResult-CwKeW0ED.js'; class GameAndroidApiKeyExport extends BaseGameAndroidCommand { static args = { file: Args.string({ description: "Name of the ZIP file to create", required: true }) }; static description = "Saves the current Android Service Account API Key to a ZIP file"; static examples = ["<%= config.bin %> <%= command.id %> keyStore.zip"]; static flags = { force: Flags.boolean({ char: "f", description: "Overwrite the file if it already exists" }), gameId: Flags.string({ char: "g", description: "The ID of the game" }) }; async run() { const { args, flags } = this; const { file } = args; const { force } = flags; const game = await this.getGame(); const zipAlreadyExists = fs.existsSync(file); if (zipAlreadyExists && !force) { this.error(`The file ${file} already exists. Use --force to overwrite it.`); } const projectCredentials = await getProjectCredentials(game.id); const projectAndroidApiKeyCreds = projectCredentials.filter( (cred) => cred.platform === Platform.ANDROID && cred.type === CredentialsType.KEY && cred.isActive ); if (projectAndroidApiKeyCreds.length === 0) { this.error("No Android Service Account API Key found which can be exported."); } const [apiKey] = projectAndroidApiKeyCreds; const handleComplete = async () => process.exit(0); render( /* @__PURE__ */ jsx(Command, { command: this, children: /* @__PURE__ */ jsx( RunWithSpinner, { executeMethod: () => exportCredential({ credentialId: apiKey.id, projectId: game.id, zipPath: file }), msgComplete: `Android Service Account API Key exported to ${file}`, msgInProgress: `Exporting Android Service Account API Key to ${file}...`, onComplete: handleComplete } ) }) ); } } export { GameAndroidApiKeyExport as default };