shipthis
Version:
ShipThis manages building and uploading your Godot games to the App Store and Google Play.
95 lines (92 loc) • 3.26 kB
JavaScript
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-BW7z-5sB.js';
import 'axios';
import 'crypto-js';
import 'uuid';
import { P as Platform, C as CredentialsType } 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 'ink-spinner';
import 'string-length';
import 'strip-ansi';
import 'open';
import '@inkjs/ui';
import '../../../../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 { B as BaseGameAndroidCommand } from '../../../../baseGameAndroidCommand-DRzVMKuG.js';
import { i as importCredential } from '../../../../import-Dk2ywOVU.js';
import '@expo/apple-utils/build/index.js';
import 'deepmerge';
import 'ini';
import 'fs';
import 'path';
class GameAndroidApiKeyImport extends BaseGameAndroidCommand {
static args = {
file: Args.string({
description: "Name of the ZIP file to import (must be in the same format as the export)",
required: true
})
};
static description = "Imports an Android Service Account API Key to your ShipThis account for the specified game.";
static examples = ["<%= config.bin %> <%= command.id %>"];
static flags = {
force: Flags.boolean({ char: "f" }),
gameId: Flags.string({ char: "g", description: "The ID of the game" })
};
async run() {
const game = await this.getGame();
const { args, flags } = this;
const { file } = args;
const { force } = flags;
const zipFound = fs.existsSync(file);
if (!zipFound) {
this.error(`The file ${file} does not exist.`);
}
const projectCredentials = await getProjectCredentials(game.id);
const hasAndroidApiKey = projectCredentials.some(
(cred) => cred.platform === Platform.ANDROID && cred.isActive && cred.type === CredentialsType.KEY
);
if (hasAndroidApiKey && !force) {
this.error("An Android Service Account API Key is already set on this game. Use --force to overwrite it.");
}
const handleComplete = async () => {
await this.config.runCommand(`game:android:apiKey:status`, ["--gameId", game.id]);
};
render(
/* @__PURE__ */ jsx(Command, { command: this, children: /* @__PURE__ */ jsx(
RunWithSpinner,
{
executeMethod: () => importCredential({
platform: Platform.ANDROID,
projectId: game.id,
type: CredentialsType.KEY,
zipPath: file
}),
msgComplete: `Android Service Account API Key imported from ${file}`,
msgInProgress: `Importing Android Service Account API Key from ${file}...`,
onComplete: handleComplete
}
) })
);
}
}
export { GameAndroidApiKeyImport as default };