UNPKG

shipthis

Version:

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

99 lines (96 loc) 3.48 kB
import { jsxs, jsx } from 'react/jsx-runtime'; import { Flags } from '@oclif/core'; import { render, Box, Text } from 'ink'; import { DateTime } from 'luxon'; import { c as BaseGameCommand, y as getProjectJobs } from '../../../index-BwnzoldS.js'; import 'ink-spinner'; import { c as getJobStatusColor } from '../../../index-CJWMt1s-.js'; import { T as Table } from '../../../Table-FaNgpyeq.js'; import { T as Title } from '../../../Title-BCQtayg6.js'; import 'react'; import '@tanstack/react-query'; import 'axios'; import { a as getJobSummary } from '../../../index-hoHfGrjg.js'; import 'node:fs'; import 'fast-glob'; import 'uuid'; import 'yazl'; import 'socket.io-client'; import 'fullscreen-ink'; import 'string-length'; import 'strip-ansi'; import 'open'; import '@inkjs/ui'; import 'node:path'; import '../../../ejs-DirFZbza.js'; import 'marked'; import 'marked-terminal'; import 'qrcode'; import { C as Command } from '../../../Command-DN1j3tjt.js'; import 'crypto-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 '../../../useAndroidServiceAccountTestResult-CwKeW0ED.js'; import 'fs'; import 'path'; class GameJobList extends BaseGameCommand { static args = {}; static description = "Lists the jobs for a game."; static examples = [ "<%= config.bin %> <%= command.id %>", "<%= config.bin %> <%= command.id %> --gameId 0c179fc4" ]; 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 jobListResponse = await getProjectJobs(game.id, params); const data = jobListResponse.data.map((j) => getJobSummary(j, DateTime.now())); const hasJobs = data.length > 0; render( /* @__PURE__ */ jsxs(Command, { command: this, children: [ /* @__PURE__ */ jsx(Title, { children: "Jobs for this game" }), !hasJobs && /* @__PURE__ */ jsx(Box, { flexDirection: "column", marginLeft: 2, marginTop: 1, children: /* @__PURE__ */ jsx(Text, { children: "You DO NOT have any jobs for this game." }) }), hasJobs && /* @__PURE__ */ jsx( Table, { data, getTextProps: (col, val) => { if (col.key !== "status") return {}; return { color: getJobStatusColor(val) }; } } ), jobListResponse.pageCount > 1 && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [ /* @__PURE__ */ jsx(Text, { children: `Showing page ${flags.pageNumber + 1} of ${jobListResponse.pageCount}.` }), /* @__PURE__ */ jsx(Text, { children: "Use the --pageNumber parameter to see other pages." }) ] }) ] }) ); } } export { GameJobList as default };