UNPKG

shipthis

Version:

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

116 lines (113 loc) 4.21 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 { c as BaseGameCommand, 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 '../../../../index-hoHfGrjg.js'; import { I as ImportKeystore } from '../../../../Import-BNMHsJoM.js'; import { C as CommandGame } from '../../../../CommandGame-D2NqytWc.js'; import { B as BaseGameAndroidCommand } from '../../../../baseGameAndroidCommand-BCB1SMCf.js'; import '@expo/apple-utils/build/index.js'; import 'deepmerge'; import 'ini'; import 'fs'; import 'path'; import '../../../../index-CJWMt1s-.js'; import '../../../../useAndroidServiceAccountTestResult-CwKeW0ED.js'; import '../../../../import-BpGyif-m.js'; import '../../../../Command-DN1j3tjt.js'; class GameAndroidKeyStoreImport extends BaseGameCommand { static args = { file: Args.string({ description: "Path to the ZIP file to import (must be in the same format as the export)", required: false }) }; static description = "Imports an Android Keystore to your ShipThis account for the specified game."; static examples = [ "<%= config.bin %> <%= command.id %> path/to/import.zip -g abfd5b00", "<%= config.bin %> <%= command.id %> --jksFile path/to/file.jks --keystorePassword yourpass --keyPassword yourkeypass" ]; static flags = { ...BaseGameAndroidCommand.flags, force: Flags.boolean({ char: "f", description: "Overwrite any existing keystore without confirmation" }), jksFile: Flags.string({ description: "Path to the JKS file to import (requires passwords)" }), keyPassword: Flags.string({ description: "Key alias password (required when using --jksFile)" }), keystorePassword: Flags.string({ description: "Keystore password (required when using --jksFile)" }) }; async run() { const game = await this.getGame(); const { args, flags } = this; const zipFilePath = args.file; const jksFilePath = flags.jksFile; const { keyPassword, keystorePassword } = flags; if (!zipFilePath && !jksFilePath) { this.error("You must provide either a ZIP file or a JKS file to import."); } if (zipFilePath && jksFilePath) { this.error("You cannot provide both a ZIP file and a JKS file."); } if (jksFilePath && (!keystorePassword || !keyPassword)) { this.error("Both --keystorePassword and --keyPassword are required when importing a JKS file."); } const toTest = `${zipFilePath || jksFilePath}`; const isFound = fs.existsSync(toTest); if (!isFound) { this.error(`The file ${toTest} does not exist.`); } const projectCredentials = await getProjectCredentials(game.id); const hasKeystore = projectCredentials.some( (cred) => cred.platform === Platform.ANDROID && cred.isActive && cred.type === CredentialsType.CERTIFICATE ); if (hasKeystore && !flags.force) { this.error("A Keystore is already set on this game. Use --force to overwrite it."); } const handleComplete = async () => { await this.config.runCommand(`game:android:keyStore:status`, ["--gameId", game.id]); }; render( /* @__PURE__ */ jsx(CommandGame, { command: this, children: /* @__PURE__ */ jsx( ImportKeystore, { importKeystoreProps: { jksFilePath, keyPassword, keystorePassword, zipFilePath }, onComplete: handleComplete, onError: (e) => this.error(e) } ) }) ); } } export { GameAndroidKeyStoreImport as default };