UNPKG

shipthis

Version:

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

82 lines (79 loc) 2.77 kB
import { Flags } from '@oclif/core'; import { D as DetailsFlags, j as isCWDGodotGame, s as GameEngine, t as getGodotVersion, u as createProject, v as DEFAULT_SHIPPED_FILES_GLOBS, w as DEFAULT_IGNORED_FILES_GLOBS, x as getGodotProjectName } from '../../baseCommand-CTn3KGH3.js'; import { B as BaseAuthenticatedCommand, b as getInput } from '../../baseGameCommand-8VL7xe-O.js'; import 'node:fs'; import 'node:path'; import 'chalk'; import 'axios'; import 'crypto-js'; import 'uuid'; import 'luxon'; 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 '@tanstack/react-query'; import 'react'; import 'fast-glob'; import 'yazl'; import 'socket.io-client'; import 'fullscreen-ink'; import 'ink'; import 'react/jsx-runtime'; import 'ink-spinner'; import 'string-length'; import 'strip-ansi'; import 'open'; import '@inkjs/ui'; import 'fs'; import 'path'; import 'marked'; import 'marked-terminal'; import 'qrcode'; class GameCreate extends BaseAuthenticatedCommand { static args = {}; static description = "Create a new game in ShipThis."; static examples = ["<%= config.bin %> <%= command.id %>"]; static flags = { force: Flags.boolean({ char: "f" }), quiet: Flags.boolean({ char: "q", description: "Avoid output except for interactions and errors" }), ...DetailsFlags }; async run() { const { flags } = this; const { force, name: flagName, quiet, ...details } = flags; if (this.hasProjectConfig() && !force) { throw new Error("This directory already has a ShipThis project. Use --force to overwrite."); } if (!isCWDGodotGame()) { this.error("No Godot project detected. Please run this from a godot project directory.", { exit: 1 }); } const getName = async () => { if (flagName) return flagName; const suggested = getGodotProjectName() || "My Awesome Game"; const entered = await getInput(`Please enter the name of the game, or press enter to use ${suggested}: `); return entered || suggested; }; const name = await getName(); const gameEngine = GameEngine.GODOT; const gameEngineVersion = getGodotVersion(); const projectDetails = { ...details, useDemoCredentials: details.useDemoCredentials === "true", gameEngine, gameEngineVersion }; const project = await createProject({ details: projectDetails, name }); await this.setProjectConfig({ ignoredFilesGlobs: DEFAULT_IGNORED_FILES_GLOBS, project, shippedFilesGlobs: DEFAULT_SHIPPED_FILES_GLOBS }); if (!flags.quiet) await this.config.runCommand("game:status"); } } export { GameCreate as default };