shipthis
Version:
ShipThis manages building and uploading your Godot games to the App Store and Google Play.
87 lines (84 loc) • 2.95 kB
JavaScript
import fs__default, { promises } from 'node:fs';
import path__default from 'node:path';
import { Args, Flags } from '@oclif/core';
import 'axios';
import 'crypto-js';
import 'uuid';
import { B as BaseCommand } from '../../baseCommand-CTn3KGH3.js';
import 'luxon';
import 'react/jsx-runtime';
import 'ink';
import 'ink-spinner';
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 'string-length';
import 'strip-ansi';
import 'open';
import '@inkjs/ui';
import '../../baseGameCommand-8VL7xe-O.js';
import 'marked';
import 'marked-terminal';
import 'qrcode';
import 'chalk';
import '@expo/apple-utils/build/index.js';
import 'deepmerge';
import 'ini';
import 'fs';
import 'path';
function generateFastlaneSession(cookieData) {
return cookieData.cookies.map((cookie) => `- !ruby/object:HTTP::Cookie
name: ${cookie.key}
value: ${cookie.value}
domain: ${cookie.domain}
for_domain: ${cookie.hostOnly ? "false" : "true"}
path: "${cookie.path}"
secure: ${cookie.secure || false}
httponly: ${cookie.httpOnly || false}
expires: ${cookie.expires ? `"${cookie.expires}"` : ""}
max_age: ${cookie.maxAge || ""}
created_at: ${cookie.creation}
accessed_at: ${cookie.lastAccessed}`).join("\n");
}
class AppleFastlane extends BaseCommand {
static args = {
file: Args.string({ description: "Path where the fastlane session will be written", required: true }),
username: Args.string({ description: "Your Apple email address", required: true })
};
static description = "Output a fastlane session file which can be used with xcodes";
static examples = [
"<%= config.bin %> <%= command.id %>",
"<%= config.bin %> <%= command.id %> --force --username me@email.nowhere"
];
static flags = {
force: Flags.boolean({ char: "f" })
};
async run() {
const { args } = this;
const { file, username } = args;
const homeDirectory = this.config.home;
const inputFilePath = path__default.join(homeDirectory, ".app-store", "auth", username, "cookie");
if (!fs__default.existsSync(inputFilePath)) {
throw new Error(`No expo auth file found for ${username}`);
}
if (fs__default.existsSync(file) && !this.flags.force) {
throw new Error(`The file ${file} already exists. Use --force to overwrite it.`);
}
const outputFilePath = file;
const fileContent = await promises.readFile(inputFilePath, "utf8");
const cookieData = JSON.parse(fileContent);
const yamlContent = generateFastlaneSession(cookieData);
await promises.mkdir(path__default.dirname(outputFilePath), { recursive: true });
await promises.writeFile(outputFilePath, yamlContent, "utf-8");
console.log(`FASTLANE_SESSION written to ${outputFilePath}`);
}
}
export { AppleFastlane as default };