UNPKG

shipthis

Version:

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

102 lines (99 loc) 3.38 kB
import { Flags } from '@oclif/core'; import { P as Platform, C as CredentialsType } from '../../../../baseCommand-CTn3KGH3.js'; import 'node:fs'; import 'axios'; import 'crypto-js'; import 'uuid'; import 'luxon'; import { a as getProjectCredentials, b as deleteProjectCredential } from '../../../../index-BW7z-5sB.js'; import 'node:path'; import 'chalk'; import { g as getShortUUID, a as getRenderedMarkdown, b as getInput } from '../../../../baseGameCommand-8VL7xe-O.js'; import 'react/jsx-runtime'; import 'ink'; import 'ink-spinner'; import 'react'; import '@tanstack/react-query'; import 'fast-glob'; import 'yazl'; import 'socket.io-client'; import 'fullscreen-ink'; import 'string-length'; import 'strip-ansi'; import 'open'; import '@inkjs/ui'; import 'qrcode'; import { B as BaseGameAndroidCommand } from '../../../../baseGameAndroidCommand-DRzVMKuG.js'; import '@expo/apple-utils/build/index.js'; import 'node:crypto'; import 'node:readline'; import 'node:url'; import 'readline-sync'; import 'isomorphic-git'; import 'deepmerge'; import 'ini'; import 'fs'; import 'path'; import 'marked'; import 'marked-terminal'; class GameAndroidKeyStoreDelete extends BaseGameAndroidCommand { static args = {}; static description = "Delete the active Android KeyStore from ShipThis"; static examples = [ "<%= config.bin %> <%= command.id %>", "<%= config.bin %> <%= command.id %> --immediate --iAmSure" ]; static flags = { ...BaseGameAndroidCommand.flags, immediate: Flags.boolean({ char: "i", description: "Remove from storage immediately (rather than waiting for automatic cleanup - cannot be undone)", required: false }), iAmSure: Flags.boolean({ char: "y", description: "I am sure I want to do this - do not prompt me", required: false }) }; async run() { const { flags } = await this.parse(GameAndroidKeyStoreDelete); const { immediate, iAmSure } = flags; const game = await this.getGame(); const projectCredentials = await getProjectCredentials(game.id); const userAndroidKeystoreCredentials = projectCredentials.filter( (cred) => cred.platform === Platform.ANDROID && cred.type === CredentialsType.CERTIFICATE && cred.isActive ); if (userAndroidKeystoreCredentials.length === 0) { this.log("No active Android keystore credentials found."); return; } const [keyStore] = userAndroidKeystoreCredentials; const getAreYouSure = async () => { if (iAmSure) return true; const confirmString = getShortUUID(keyStore.id); const prompt = getRenderedMarkdown({ filename: "confirm-delete-android-keystore.md.ejs", templateVars: { confirmString, exportCommand: `shipthis game android keyStore export keyStore.zip`, immediate } }); this.log(prompt); const input = await getInput(""); return input.trim().toLowerCase() === confirmString.toLowerCase(); }; const areYouSure = await getAreYouSure(); if (!areYouSure) { this.log("Aborting - Android KeyStore not deleted"); this.exit(0); } await deleteProjectCredential(game.id, { credentialId: keyStore.id, isImmediate: immediate }); this.log("The Android KeyStore has been deleted from ShipThis."); } } export { GameAndroidKeyStoreDelete as default };