UNPKG

shipthis

Version:

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

98 lines (94 loc) 3.65 kB
import { jsxs, jsx } from 'react/jsx-runtime'; import { Flags } from '@oclif/core'; import { Box, Text, render } from 'ink'; import 'node:fs'; import 'axios'; import 'crypto-js'; import 'uuid'; import '../../../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 Spinner from 'ink-spinner'; import { u as useBuilds, v as getBuildSummary, c as BaseGameCommand } from '../../../baseGameCommand-8VL7xe-O.js'; import { T as Table } from '../../../Table-FaNgpyeq.js'; import { T as Title } from '../../../Title-BCQtayg6.js'; import 'string-length'; import 'strip-ansi'; import 'open'; import '@inkjs/ui'; import 'marked'; import 'marked-terminal'; import 'qrcode'; import { C as CommandGame } from '../../../CommandGame-CuvuH-z6.js'; import '@expo/apple-utils/build/index.js'; import 'deepmerge'; import 'ini'; import 'fs'; import 'path'; import '../../../Command-Cj6F5B5a.js'; const BuildsTable = ({ queryProps, ...boxProps }) => { const { data, isLoading } = useBuilds(queryProps); const hasBuilds = (data?.data?.length ?? 0) > 0; return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, ...boxProps, children: [ /* @__PURE__ */ jsx(Title, { children: `Builds uploaded to ShipThis from completed jobs for this game.` }), !isLoading && !hasBuilds && /* @__PURE__ */ jsx(Box, { flexDirection: "column", marginLeft: 2, marginTop: 1, children: /* @__PURE__ */ jsx(Text, { children: "You DO NOT have any builds uploaded to ShipThis from completed jobs for this game." }) }), isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }), data && hasBuilds && /* @__PURE__ */ jsx(Table, { data: data.data.map(getBuildSummary) }), data && data.pageCount > 1 && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [ /* @__PURE__ */ jsx(Text, { children: `Showing page ${(queryProps.pageNumber || 0) + 1} of ${data.pageCount}.` }), /* @__PURE__ */ jsx(Text, { children: "Use the --pageNumber parameter to see other pages." }) ] }) ] }); }; class GameBuildList extends BaseGameCommand { static args = {}; static description = "Lists the builds for successful jobs of a game."; static examples = [ "<%= config.bin %> <%= command.id %>", "<%= config.bin %> <%= command.id %> --gameId 0c179fc4", "<%= config.bin %> <%= command.id %> --gameId 0c179fc4 --pageSize 20 --pageNumber 1" ]; static flags = { ...super.flags, order: Flags.string({ char: "r", default: "desc", description: "The order to sort by", options: ["asc", "desc"] }), orderBy: Flags.string({ char: "o", default: "createdAt", description: "The field to order by", options: ["createdAt", "updatedAt"] }), pageNumber: Flags.integer({ char: "p", default: 0, description: "The page number to show (starts at 0)" }), pageSize: Flags.integer({ char: "s", default: 10, description: "The number of items to show per page" }) }; async run() { const game = await this.getGame(); const { flags } = this; const { gameId, ...otherFlags } = flags; const params = otherFlags; const queryProps = { projectId: game.id, ...params }; render( /* @__PURE__ */ jsx(CommandGame, { command: this, children: /* @__PURE__ */ jsx(BuildsTable, { queryProps }) }) ); } } export { GameBuildList as default };