shipthis 0.1.31 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AppleBundleIdDetails-eoK5F8Qn.js → AppleBundleIdDetails-6H3cNWxw.js} +17 -19
- package/dist/Command-WPpmLPkL.js +29 -0
- package/dist/CommandGame-cxzWG4nT.js +7 -0
- package/dist/{Create-ISdroJ3G.js → Create-3Ob8sjik.js} +20 -20
- package/dist/GameStatus-BQEtVKvv.js +137 -0
- package/dist/{Import-CfThJF6k.js → Import-CFuPDI0K.js} +33 -35
- package/dist/{JobLogTail-BWzbQBZz.js → JobLogTail-0CBLoG8N.js} +53 -52
- package/dist/{JobProgress-DjIkuk5U.js → JobProgress-lKqVT88m.js} +35 -36
- package/dist/{JobStatusTable-CEqWU73q.js → JobStatusTable-C_ZsZJCm.js} +14 -13
- package/dist/{NextSteps-CK9zHOCt.js → NextSteps-DbJHmscQ.js} +1 -3
- package/dist/{ProgressSpinner-6pw1T8Iw.js → ProgressSpinner-DGcakQSK.js} +1 -1
- package/dist/{ProjectCredentialsTable-u9ruZ9mN.js → ProjectCredentialsTable-B5pHOnGu.js} +11 -10
- package/dist/{StatusTable-Dm5St4g-.js → StatusTable-DzRWcMr4.js} +7 -9
- package/dist/{Table-CvM6pccN.js → Table-FaNgpyeq.js} +15 -15
- package/dist/{UserCredentialsTable-Q7u9M-ap.js → UserCredentialsTable-3W3qesh7.js} +18 -19
- package/dist/{baseAppleCommand-zhkGlKq0.js → baseAppleCommand-BGV088--.js} +1 -1
- package/dist/{baseGameAndroidCommand-DJ-cMLa_.js → baseGameAndroidCommand-CsemgVjp.js} +23 -23
- package/dist/commands/apple/apiKey/create.js +35 -35
- package/dist/commands/apple/apiKey/export.js +26 -26
- package/dist/commands/apple/apiKey/import.js +27 -27
- package/dist/commands/apple/apiKey/status.js +31 -31
- package/dist/commands/apple/certificate/create.js +39 -39
- package/dist/commands/apple/certificate/export.js +26 -26
- package/dist/commands/apple/certificate/import.js +27 -27
- package/dist/commands/apple/certificate/status.js +31 -31
- package/dist/commands/apple/login.js +15 -16
- package/dist/commands/apple/status.js +27 -27
- package/dist/commands/dashboard.js +10 -11
- package/dist/commands/game/android/apiKey/connect.js +28 -28
- package/dist/commands/game/android/apiKey/create.js +28 -28
- package/dist/commands/game/android/apiKey/export.js +29 -29
- package/dist/commands/game/android/apiKey/import.js +31 -31
- package/dist/commands/game/android/apiKey/invite.js +14 -15
- package/dist/commands/game/android/apiKey/status.js +29 -29
- package/dist/commands/game/android/keyStore/create.js +24 -24
- package/dist/commands/game/android/keyStore/export.js +28 -28
- package/dist/commands/game/android/keyStore/import.js +35 -35
- package/dist/commands/game/android/keyStore/status.js +26 -26
- package/dist/commands/game/android/status.js +14 -58
- package/dist/commands/game/build/download.js +24 -24
- package/dist/commands/game/build/list.js +37 -37
- package/dist/commands/game/create.js +15 -16
- package/dist/commands/game/details.js +35 -36
- package/dist/commands/game/export.js +12 -13
- package/dist/commands/game/ios/app/addTester.js +24 -24
- package/dist/commands/game/ios/app/create.js +24 -24
- package/dist/commands/game/ios/app/status.js +29 -29
- package/dist/commands/game/ios/app/sync.js +31 -31
- package/dist/commands/game/ios/profile/create.js +30 -30
- package/dist/commands/game/ios/profile/export.js +28 -28
- package/dist/commands/game/ios/profile/import.js +32 -32
- package/dist/commands/game/ios/profile/status.js +36 -36
- package/dist/commands/game/ios/status.js +46 -58
- package/dist/commands/game/ios/wizard.js +31 -31
- package/dist/commands/game/job/list.js +34 -34
- package/dist/commands/game/job/status.js +31 -31
- package/dist/commands/game/list.js +37 -39
- package/dist/commands/game/ship.js +73 -71
- package/dist/commands/game/status.js +38 -85
- package/dist/commands/game/wizard.js +250 -239
- package/dist/commands/internal/fastlane.js +15 -18
- package/dist/commands/internal/readme.js +38 -37
- package/dist/commands/login.js +14 -15
- package/dist/commands/status.js +32 -30
- package/dist/{export-DZxo2_e_.js → export-CXsVPXA1.js} +5 -5
- package/dist/{git-DREGq-jc.js → git-BpsfNFZ_.js} +8 -8
- package/dist/{import-8pL1AF47.js → import-DGvG5REx.js} +14 -14
- package/dist/{index-w3lHxk5O.js → index-BhhiXbey.js} +240 -224
- package/dist/{index-BHh0BZvD.js → index-C03TV1_J.js} +37 -55
- package/dist/{index-CyvGh-kt.js → index-C66Dd8Xc.js} +77 -87
- package/dist/{index-DJ078v-U.js → index-CGBdOm1q.js} +43 -28
- package/dist/{index-DKQjnJrC.js → index-CS9Gwcb0.js} +41 -43
- package/dist/{index-C6aAyrXW.js → index-CtTI85m-.js} +6 -6
- package/dist/{upload-BTpxj3QP.js → upload-8y5MQEm9.js} +22 -22
- package/dist/{useAndroidServiceAccountTestResult-Dy3Ag7_r.js → useAndroidServiceAccountTestResult-DZk5SMxI.js} +11 -13
- package/dist/{useAppleApp-h1Ogi_qc.js → useAppleApp-DWYGURwU.js} +4 -4
- package/dist/{useAppleBundleId-B3TTNap0.js → useAppleBundleId-PsTJ2g1B.js} +6 -6
- package/dist/{useProjectCredentials-DpeXZcHP.js → useProjectCredentials-BEphqa18.js} +10 -12
- package/dist/{useWebSocket-gyuCsore.js → useWebSocket-5PYa2QER.js} +1 -1
- package/dist/utils/help.js +4 -4
- package/package.json +4 -3
- package/dist/Command-DFdHXDiU.js +0 -44
- package/dist/CommandGame-Dif-oSky.js +0 -9
- package/dist/{RunWithSpinner-BVXNWGD3.js → RunWithSpinner-gMVA07bZ.js} +2 -2
|
@@ -2,16 +2,17 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import { Text, useInput, Box } from 'ink';
|
|
3
3
|
import open from 'open';
|
|
4
4
|
import { useState, useEffect, useContext } from 'react';
|
|
5
|
-
import
|
|
6
|
-
import 'crypto';
|
|
7
|
-
import 'fs';
|
|
8
|
-
import 'readline-sync';
|
|
9
|
-
import 'node:readline';
|
|
5
|
+
import 'ink-spinner';
|
|
6
|
+
import 'node:crypto';
|
|
7
|
+
import 'node:fs';
|
|
10
8
|
import 'node:path';
|
|
9
|
+
import 'node:readline';
|
|
11
10
|
import 'node:url';
|
|
11
|
+
import 'readline-sync';
|
|
12
12
|
import 'luxon';
|
|
13
13
|
import 'axios';
|
|
14
14
|
import 'isomorphic-git';
|
|
15
|
+
import { Q as getGoogleStatus, a2 as getShortAuthRequiredUrl, a3 as getGoogleAuthUrl, W as WEB_URL } from './index-BhhiXbey.js';
|
|
15
16
|
import '@oclif/core';
|
|
16
17
|
import { useQuery } from '@tanstack/react-query';
|
|
17
18
|
import 'crypto-js';
|
|
@@ -19,70 +20,52 @@ import 'uuid';
|
|
|
19
20
|
import 'fast-glob';
|
|
20
21
|
import 'yazl';
|
|
21
22
|
import 'socket.io-client';
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import
|
|
25
|
-
import { b as GameContext, M as Markdown } from './index-CyvGh-kt.js';
|
|
26
|
-
import 'ink-spinner';
|
|
27
|
-
import '@inkjs/ui';
|
|
23
|
+
import { c as cacheKeys } from './useAndroidServiceAccountTestResult-DZk5SMxI.js';
|
|
24
|
+
import { u as useWebSocket } from './useWebSocket-5PYa2QER.js';
|
|
25
|
+
import 'fullscreen-ink';
|
|
28
26
|
import 'string-length';
|
|
29
27
|
import 'strip-ansi';
|
|
28
|
+
import '@inkjs/ui';
|
|
29
|
+
import { G as GameContext, M as Markdown } from './index-C66Dd8Xc.js';
|
|
30
30
|
import 'marked';
|
|
31
31
|
import 'marked-terminal';
|
|
32
|
-
import 'path';
|
|
33
32
|
import qrcode from 'qrcode';
|
|
34
33
|
|
|
35
|
-
const useGoogleStatus = () => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
};
|
|
34
|
+
const useGoogleStatus = () => useQuery({
|
|
35
|
+
queryFn: getGoogleStatus,
|
|
36
|
+
queryKey: cacheKeys.googleStatus()
|
|
37
|
+
});
|
|
41
38
|
|
|
42
39
|
function useGoogleStatusWatching({
|
|
43
|
-
projectId,
|
|
44
40
|
isWatching,
|
|
45
|
-
onGoogleStatusUpdate
|
|
41
|
+
onGoogleStatusUpdate,
|
|
42
|
+
projectId
|
|
46
43
|
}) {
|
|
47
44
|
const [wsGoogleStatus, setWsGoogleStatus] = useState(null);
|
|
48
45
|
const listener = {
|
|
49
|
-
|
|
50
|
-
eventHandler: async (pattern, data2) => {
|
|
46
|
+
async eventHandler(pattern, data2) {
|
|
51
47
|
setWsGoogleStatus(data2);
|
|
52
48
|
if (onGoogleStatusUpdate) onGoogleStatusUpdate(data2);
|
|
53
|
-
}
|
|
49
|
+
},
|
|
50
|
+
getPattern: () => `project.${projectId}:google-status`
|
|
54
51
|
};
|
|
55
52
|
useWebSocket([listener] );
|
|
56
|
-
const {
|
|
53
|
+
const { data: googleStatus, isLoading } = useGoogleStatus();
|
|
57
54
|
useEffect(() => {
|
|
58
55
|
setWsGoogleStatus(null);
|
|
59
56
|
}, [projectId, isWatching, googleStatus]);
|
|
60
57
|
const fetchedGoogleStatus = googleStatus ? googleStatus : null;
|
|
61
58
|
const data = wsGoogleStatus ? wsGoogleStatus : fetchedGoogleStatus;
|
|
62
59
|
return {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const WIDE_BREAKPOINT = 100;
|
|
69
|
-
const TALL_BREAKPOINT = 35;
|
|
70
|
-
function useResponsive() {
|
|
71
|
-
const { width, height } = useScreenSize();
|
|
72
|
-
const isWide = width >= WIDE_BREAKPOINT;
|
|
73
|
-
const isTall = height >= TALL_BREAKPOINT;
|
|
74
|
-
return {
|
|
75
|
-
width,
|
|
76
|
-
height,
|
|
77
|
-
isWide,
|
|
78
|
-
isTall
|
|
60
|
+
data,
|
|
61
|
+
isLoading
|
|
79
62
|
};
|
|
80
63
|
}
|
|
81
64
|
|
|
82
65
|
const QRCodeTerminal = ({ url }) => {
|
|
83
66
|
const [code, setCode] = useState(null);
|
|
84
67
|
const handleLoad = async () => {
|
|
85
|
-
const codeString = await qrcode.toString(url, {
|
|
68
|
+
const codeString = await qrcode.toString(url, { errorCorrectionLevel: "L", small: true, type: "terminal" });
|
|
86
69
|
setCode(codeString);
|
|
87
70
|
};
|
|
88
71
|
useEffect(() => {
|
|
@@ -112,31 +95,30 @@ const ConnectGoogle = (props) => {
|
|
|
112
95
|
const { gameId } = useContext(GameContext);
|
|
113
96
|
return /* @__PURE__ */ jsx(Fragment, { children: gameId && /* @__PURE__ */ jsx(ConnectForGame, { gameId, ...props }) });
|
|
114
97
|
};
|
|
115
|
-
const ConnectForGame = ({
|
|
116
|
-
const
|
|
117
|
-
const [showQRCode, setShowQRCode] = useState(isTall);
|
|
98
|
+
const ConnectForGame = ({ gameId, helpPage, onComplete, onError, ...boxProps }) => {
|
|
99
|
+
const [showQRCode, setShowQRCode] = useState(false);
|
|
118
100
|
useGoogleStatusWatching({
|
|
119
|
-
projectId: gameId,
|
|
120
101
|
isWatching: true,
|
|
121
|
-
onGoogleStatusUpdate
|
|
102
|
+
onGoogleStatusUpdate(status) {
|
|
122
103
|
if (status.isAuthenticated) return onComplete();
|
|
123
|
-
}
|
|
104
|
+
},
|
|
105
|
+
projectId: gameId
|
|
124
106
|
});
|
|
125
107
|
useInput(async (input) => {
|
|
126
108
|
switch (input) {
|
|
127
|
-
case "q":
|
|
109
|
+
case "q": {
|
|
128
110
|
setShowQRCode(true);
|
|
129
111
|
return;
|
|
130
|
-
|
|
112
|
+
}
|
|
113
|
+
case "x": {
|
|
131
114
|
setShowQRCode(false);
|
|
132
115
|
return;
|
|
133
|
-
|
|
116
|
+
}
|
|
117
|
+
case "b": {
|
|
134
118
|
if (!gameId) return;
|
|
135
119
|
const url = await getConnectUrl(gameId, true);
|
|
136
120
|
await open(url);
|
|
137
|
-
|
|
138
|
-
default:
|
|
139
|
-
return;
|
|
121
|
+
}
|
|
140
122
|
}
|
|
141
123
|
});
|
|
142
124
|
const templateVars = {
|
|
@@ -150,10 +132,10 @@ const ConnectForGame = ({ onComplete, onError, helpPage, gameId, ...boxProps })
|
|
|
150
132
|
] }),
|
|
151
133
|
showQRCode && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: 1, children: [
|
|
152
134
|
/* @__PURE__ */ jsx(Text, { children: "Scan the QR code below to connect your Google account to ShipThis:" }),
|
|
153
|
-
gameId && /* @__PURE__ */ jsx(GoogleAuthQRCode, { gameId, helpPage:
|
|
135
|
+
gameId && /* @__PURE__ */ jsx(GoogleAuthQRCode, { gameId, helpPage: Boolean(helpPage) }),
|
|
154
136
|
/* @__PURE__ */ jsx(Text, { bold: true, color: "#4CE64C", children: "Press X to hide the QR code" })
|
|
155
137
|
] })
|
|
156
138
|
] });
|
|
157
139
|
};
|
|
158
140
|
|
|
159
|
-
export { ConnectGoogle as C
|
|
141
|
+
export { ConnectGoogle as C };
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { Text, useInput, Box } from 'ink';
|
|
3
|
-
import React, { useState, useEffect, useContext, useRef } from 'react';
|
|
4
3
|
import Spinner from 'ink-spinner';
|
|
5
4
|
import open from 'open';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import '@inkjs/ui';
|
|
10
|
-
import axios from 'axios';
|
|
5
|
+
import React, { useState, useEffect, useContext, useRef } from 'react';
|
|
6
|
+
import { p as getAuthedHeaders, o as API_URL, I as castArrayObjectDates, P as Platform, a6 as getShortDateTime, J as JobStatus, a7 as getShortTimeDelta, z as getJob, E as getProject, a2 as getShortAuthRequiredUrl, K as queryClient, a8 as BuildType, W as WEB_URL } from './index-BhhiXbey.js';
|
|
7
|
+
import { h as getPlatformName, g as getShortUUID, s as scriptDir } from './index-CGBdOm1q.js';
|
|
11
8
|
import { useQuery } from '@tanstack/react-query';
|
|
12
|
-
import
|
|
9
|
+
import axios from 'axios';
|
|
10
|
+
import { c as cacheKeys, u as useAndroidServiceAccountTestResult, K as KeyTestStatus, a as KeyTestError } from './useAndroidServiceAccountTestResult-DZk5SMxI.js';
|
|
11
|
+
import 'luxon';
|
|
12
|
+
import fs__default from 'node:fs';
|
|
13
|
+
import 'fast-glob';
|
|
13
14
|
import 'uuid';
|
|
14
15
|
import 'yazl';
|
|
16
|
+
import 'socket.io-client';
|
|
17
|
+
import 'fullscreen-ink';
|
|
18
|
+
import 'string-length';
|
|
19
|
+
import 'strip-ansi';
|
|
20
|
+
import '@inkjs/ui';
|
|
21
|
+
import path from 'node:path';
|
|
15
22
|
import { setOptions, parse } from 'marked';
|
|
16
23
|
import TerminalRenderer from 'marked-terminal';
|
|
17
|
-
import path from 'path';
|
|
18
24
|
import 'qrcode';
|
|
19
|
-
import 'string-length';
|
|
20
|
-
import 'strip-ansi';
|
|
21
|
-
import 'luxon';
|
|
22
|
-
import 'fast-glob';
|
|
23
|
-
import 'socket.io-client';
|
|
24
25
|
|
|
25
26
|
async function queryBuilds({ projectId, ...pageAndSortParams }) {
|
|
26
27
|
try {
|
|
@@ -43,15 +44,15 @@ function getBuildSummary(build) {
|
|
|
43
44
|
id: getShortUUID(build.id),
|
|
44
45
|
jobId: getShortUUID(build.jobId),
|
|
45
46
|
...getJobDetailsSummary(build.jobDetails),
|
|
46
|
-
|
|
47
|
+
cmd: `shipthis game build download ${getShortUUID(build.id)} ${filename}`,
|
|
47
48
|
createdAt: getShortDateTime(build.createdAt),
|
|
48
|
-
|
|
49
|
+
type: `${getPlatformName(build.platform)} ${build.buildType || ""}`.trim()
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
52
|
const useBuilds = (props) => {
|
|
52
53
|
const queryResult = useQuery({
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
queryFn: async () => queryBuilds(props),
|
|
55
|
+
queryKey: cacheKeys.builds(props)
|
|
55
56
|
});
|
|
56
57
|
return queryResult;
|
|
57
58
|
};
|
|
@@ -62,8 +63,8 @@ function getJobDetailsSummary(jobDetails) {
|
|
|
62
63
|
const gitCommit = jobDetails?.gitCommitHash ? getShortUUID(jobDetails?.gitCommitHash) : "";
|
|
63
64
|
const gitBranch = jobDetails?.gitBranch || "";
|
|
64
65
|
return {
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
gitInfo: gitCommit ? `${gitCommit} (${gitBranch})` : "",
|
|
67
|
+
version: `${semanticVersion} (${buildNumber})`
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
70
|
function getJobSummary(job, timeNow) {
|
|
@@ -71,65 +72,22 @@ function getJobSummary(job, timeNow) {
|
|
|
71
72
|
return {
|
|
72
73
|
id: getShortUUID(job.id),
|
|
73
74
|
...getJobDetailsSummary(job.details),
|
|
74
|
-
platform: getPlatformName(job.type),
|
|
75
|
-
status: job.status,
|
|
76
75
|
createdAt: getShortDateTime(job.createdAt),
|
|
77
|
-
|
|
76
|
+
platform: getPlatformName(job.type),
|
|
77
|
+
runtime: getShortTimeDelta(job.createdAt, inProgress ? timeNow : job.updatedAt),
|
|
78
|
+
status: job.status
|
|
78
79
|
};
|
|
79
80
|
}
|
|
80
|
-
const useJob = (props) => {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
queryFn: () => getJob(props.jobId, props.projectId)
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const CommandContext = React.createContext({
|
|
88
|
-
command: null,
|
|
89
|
-
setCommand: (command) => {
|
|
90
|
-
}
|
|
81
|
+
const useJob = (props) => useQuery({
|
|
82
|
+
queryFn: () => getJob(props.jobId, props.projectId),
|
|
83
|
+
queryKey: cacheKeys.job(props)
|
|
91
84
|
});
|
|
92
|
-
const CommandProvider = (props) => {
|
|
93
|
-
const [command, setCommand] = useState(props.command || null);
|
|
94
|
-
return /* @__PURE__ */ jsx(CommandContext.Provider, { value: { command, setCommand }, children: props.children });
|
|
95
|
-
};
|
|
96
85
|
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
103
|
-
const GameProvider = ({ children }) => {
|
|
104
|
-
const [gameId, setGameId] = useState(null);
|
|
105
|
-
const [game, setGame] = useState(null);
|
|
106
|
-
const { command } = React.useContext(CommandContext);
|
|
107
|
-
const handleLoad = async () => {
|
|
108
|
-
if (command) {
|
|
109
|
-
const commandGameId = await command.getGameId();
|
|
110
|
-
if (commandGameId) setGameId(commandGameId);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
const handleGameIdChange = async () => {
|
|
114
|
-
if (!gameId) {
|
|
115
|
-
setGame(null);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
const game2 = await getProject(gameId);
|
|
119
|
-
setGame(game2);
|
|
120
|
-
};
|
|
121
|
-
useEffect(() => {
|
|
122
|
-
handleGameIdChange();
|
|
123
|
-
}, [gameId]);
|
|
124
|
-
useEffect(() => {
|
|
125
|
-
handleLoad();
|
|
126
|
-
}, [command]);
|
|
127
|
-
return /* @__PURE__ */ jsx(GameContext.Provider, { value: { gameId, game, setGameId }, children });
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const cleanHyperlinks = (input) => {
|
|
131
|
-
return input.replace(/\x1b]8;;[^\x07]*\x07/g, "").replace(/\x1b]8;;\x07/g, "");
|
|
132
|
-
};
|
|
86
|
+
const cleanHyperlinks = (input) => (
|
|
87
|
+
// When we run in a <ScrollArea> the links break
|
|
88
|
+
// Remove OSC 8 hyperlink wrappers but preserve the styled content inside
|
|
89
|
+
input.replaceAll(/\u001B]8;;[^\u0007]*\u0007/g, "").replaceAll("\x1B]8;;\x07", "")
|
|
90
|
+
);
|
|
133
91
|
const getRenderedMarkdown = ({ filename, templateVars, ...options }) => {
|
|
134
92
|
setOptions({
|
|
135
93
|
renderer: new TerminalRenderer({
|
|
@@ -142,10 +100,8 @@ const getRenderedMarkdown = ({ filename, templateVars, ...options }) => {
|
|
|
142
100
|
const mdTemplate = fs__default.readFileSync(mdPath, "utf8").trim();
|
|
143
101
|
let markdown = mdTemplate;
|
|
144
102
|
if (templateVars) {
|
|
145
|
-
markdown = markdown.
|
|
146
|
-
|
|
147
|
-
});
|
|
148
|
-
markdown = markdown.replace(/\${(.*?)}/g, (_, key) => {
|
|
103
|
+
markdown = markdown.replaceAll(/\${if (.*?)}([\S\s]*?)\${endif}/g, (_, key, content) => templateVars[key.trim()] ? content : "");
|
|
104
|
+
markdown = markdown.replaceAll(/\${(.*?)}/g, (_, key) => {
|
|
149
105
|
const trimmed = key.trim();
|
|
150
106
|
return templateVars[trimmed] ? String(templateVars[trimmed]) : "";
|
|
151
107
|
});
|
|
@@ -163,6 +119,40 @@ const Markdown = ({ filename, templateVars, ...options }) => {
|
|
|
163
119
|
return /* @__PURE__ */ jsx(Text, { children: text });
|
|
164
120
|
};
|
|
165
121
|
|
|
122
|
+
const CommandContext = React.createContext({
|
|
123
|
+
command: null,
|
|
124
|
+
setCommand(command) {
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
const CommandProvider = (props) => {
|
|
128
|
+
const [command, setCommand] = useState(props.command || null);
|
|
129
|
+
return /* @__PURE__ */ jsx(CommandContext.Provider, { value: { command, setCommand }, children: props.children });
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const GameContext = React.createContext({
|
|
133
|
+
game: null,
|
|
134
|
+
gameId: null,
|
|
135
|
+
setGameId(gameId) {
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
const GameProvider = ({ children }) => {
|
|
139
|
+
const { command } = React.useContext(CommandContext);
|
|
140
|
+
const [gameId, setGameId] = useState(command?.getGameId() || null);
|
|
141
|
+
const [game, setGame] = useState(null);
|
|
142
|
+
const handleGameIdChange = async () => {
|
|
143
|
+
if (!gameId) {
|
|
144
|
+
setGame(null);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const game2 = await getProject(gameId);
|
|
148
|
+
setGame(game2);
|
|
149
|
+
};
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
handleGameIdChange();
|
|
152
|
+
}, [gameId]);
|
|
153
|
+
return /* @__PURE__ */ jsx(GameContext.Provider, { value: { game, gameId, setGameId }, children });
|
|
154
|
+
};
|
|
155
|
+
|
|
166
156
|
scriptDir(import.meta);
|
|
167
157
|
const getIsAppFound = (result) => {
|
|
168
158
|
const isFound = result?.status === KeyTestStatus.SUCCESS || result?.status === KeyTestStatus.ERROR && result?.error === KeyTestError.NOT_INVITED;
|
|
@@ -172,9 +162,9 @@ const CreateGooglePlayGame = (props) => {
|
|
|
172
162
|
const { gameId } = useContext(GameContext);
|
|
173
163
|
return /* @__PURE__ */ jsx(Fragment, { children: gameId && /* @__PURE__ */ jsx(Create, { gameId, ...props }) });
|
|
174
164
|
};
|
|
175
|
-
const Create = ({ onComplete, onError,
|
|
165
|
+
const Create = ({ gameId, onComplete, onError, ...boxProps }) => {
|
|
176
166
|
const { data: result, isFetching } = useAndroidServiceAccountTestResult({ projectId: gameId });
|
|
177
|
-
const { data: builds } = useBuilds({
|
|
167
|
+
const { data: builds } = useBuilds({ pageNumber: 0, projectId: gameId });
|
|
178
168
|
const previousIsFound = useRef(false);
|
|
179
169
|
useEffect(() => {
|
|
180
170
|
const isFound = getIsAppFound(result);
|
|
@@ -186,27 +176,27 @@ const Create = ({ onComplete, onError, gameId, ...boxProps }) => {
|
|
|
186
176
|
useInput(async (input) => {
|
|
187
177
|
if (!gameId) return;
|
|
188
178
|
switch (input) {
|
|
189
|
-
case "r":
|
|
179
|
+
case "r": {
|
|
190
180
|
queryClient.invalidateQueries({
|
|
191
181
|
queryKey: cacheKeys.androidKeyTestResult({ projectId: gameId })
|
|
192
182
|
});
|
|
193
183
|
break;
|
|
194
|
-
|
|
184
|
+
}
|
|
185
|
+
case "d": {
|
|
195
186
|
const dashUrl = await getShortAuthRequiredUrl(`/games/${getShortUUID(gameId)}/builds`);
|
|
196
187
|
await open(dashUrl);
|
|
188
|
+
}
|
|
197
189
|
}
|
|
198
190
|
if (input !== "r") return;
|
|
199
191
|
queryClient.invalidateQueries({
|
|
200
192
|
queryKey: cacheKeys.androidKeyTestResult({ projectId: gameId })
|
|
201
193
|
});
|
|
202
194
|
});
|
|
203
|
-
const initialBuild = builds?.data.find((build) =>
|
|
204
|
-
return build.platform === Platform.ANDROID && build.buildType === BuildType.AAB;
|
|
205
|
-
});
|
|
195
|
+
const initialBuild = builds?.data.find((build) => build.platform === Platform.ANDROID && build.buildType === BuildType.AAB);
|
|
206
196
|
const downloadCmd = initialBuild ? `${getBuildSummary(initialBuild).cmd}` : "Initial AAB build not found!";
|
|
207
197
|
const templateVars = {
|
|
208
|
-
|
|
209
|
-
|
|
198
|
+
dashboardURL: new URL(`/games/${getShortUUID(gameId)}/builds`, WEB_URL).toString(),
|
|
199
|
+
downloadCmd
|
|
210
200
|
};
|
|
211
201
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: 1, ...boxProps, children: [
|
|
212
202
|
/* @__PURE__ */ jsxs(Box, { flexDirection: "row", gap: 1, children: [
|
|
@@ -217,4 +207,4 @@ const Create = ({ onComplete, onError, gameId, ...boxProps }) => {
|
|
|
217
207
|
] }) });
|
|
218
208
|
};
|
|
219
209
|
|
|
220
|
-
export {
|
|
210
|
+
export { CommandContext as C, GameContext as G, Markdown as M, getJobSummary as a, CommandProvider as b, GameProvider as c, getBuildSummary as d, useJob as e, CreateGooglePlayGame as f, getRenderedMarkdown as g, queryBuilds as q, useBuilds as u };
|
|
@@ -1,64 +1,76 @@
|
|
|
1
|
-
import crypto from 'crypto';
|
|
2
|
-
import fs__default from 'fs';
|
|
3
|
-
import readlineSync from 'readline-sync';
|
|
4
|
-
import { promises } from 'node:readline';
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import fs__default from 'node:fs';
|
|
5
3
|
import path from 'node:path';
|
|
4
|
+
import { promises } from 'node:readline';
|
|
6
5
|
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import
|
|
6
|
+
import readlineSync from 'readline-sync';
|
|
7
|
+
import { L as JobStage, P as Platform, M as LogLevel, J as JobStatus } from './index-BhhiXbey.js';
|
|
8
8
|
import 'luxon';
|
|
9
9
|
import 'axios';
|
|
10
10
|
import 'isomorphic-git';
|
|
11
11
|
import '@oclif/core';
|
|
12
|
-
import 'react';
|
|
13
12
|
import '@tanstack/react-query';
|
|
13
|
+
import 'react';
|
|
14
14
|
import 'crypto-js';
|
|
15
15
|
import 'uuid';
|
|
16
16
|
import 'fast-glob';
|
|
17
17
|
import 'yazl';
|
|
18
18
|
import 'socket.io-client';
|
|
19
|
-
import 'ink';
|
|
19
|
+
import 'fullscreen-ink';
|
|
20
20
|
|
|
21
21
|
function getShortUUID(originalUuid) {
|
|
22
22
|
return originalUuid.slice(0, 8);
|
|
23
23
|
}
|
|
24
24
|
function getStageColor(stage) {
|
|
25
25
|
switch (stage) {
|
|
26
|
-
case JobStage.SETUP:
|
|
26
|
+
case JobStage.SETUP: {
|
|
27
27
|
return "#FFB3B3";
|
|
28
|
+
}
|
|
28
29
|
// pastel red
|
|
29
|
-
case JobStage.CONFIGURE:
|
|
30
|
+
case JobStage.CONFIGURE: {
|
|
30
31
|
return "#FFD9B3";
|
|
32
|
+
}
|
|
31
33
|
// pastel orange
|
|
32
|
-
case JobStage.EXPORT:
|
|
34
|
+
case JobStage.EXPORT: {
|
|
33
35
|
return "#FFFACD";
|
|
36
|
+
}
|
|
34
37
|
// pastel yellow
|
|
35
|
-
case JobStage.BUILD:
|
|
38
|
+
case JobStage.BUILD: {
|
|
36
39
|
return "#B3FFB3";
|
|
40
|
+
}
|
|
37
41
|
// pastel green
|
|
38
|
-
case JobStage.PUBLISH:
|
|
42
|
+
case JobStage.PUBLISH: {
|
|
39
43
|
return "#B3D9FF";
|
|
44
|
+
}
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
47
|
function getMessageColor(level) {
|
|
43
48
|
switch (level) {
|
|
44
|
-
case LogLevel.INFO:
|
|
49
|
+
case LogLevel.INFO: {
|
|
45
50
|
return "white";
|
|
46
|
-
|
|
51
|
+
}
|
|
52
|
+
case LogLevel.WARN: {
|
|
47
53
|
return "yellow";
|
|
48
|
-
|
|
54
|
+
}
|
|
55
|
+
case LogLevel.ERROR: {
|
|
49
56
|
return "red";
|
|
57
|
+
}
|
|
50
58
|
}
|
|
51
59
|
}
|
|
52
60
|
function getJobStatusColor(status) {
|
|
53
61
|
switch (status) {
|
|
54
|
-
case JobStatus.PENDING:
|
|
62
|
+
case JobStatus.PENDING: {
|
|
55
63
|
return "yellow";
|
|
56
|
-
|
|
64
|
+
}
|
|
65
|
+
case JobStatus.PROCESSING: {
|
|
57
66
|
return "blue";
|
|
58
|
-
|
|
67
|
+
}
|
|
68
|
+
case JobStatus.COMPLETED: {
|
|
59
69
|
return "green";
|
|
60
|
-
|
|
70
|
+
}
|
|
71
|
+
case JobStatus.FAILED: {
|
|
61
72
|
return "red";
|
|
73
|
+
}
|
|
62
74
|
}
|
|
63
75
|
}
|
|
64
76
|
async function getFileHash(filename) {
|
|
@@ -72,9 +84,9 @@ async function getFileHash(filename) {
|
|
|
72
84
|
}
|
|
73
85
|
function isValidSemVer(versionString) {
|
|
74
86
|
const [semVer, major, minor, patch, prerelease, buildmetadata] = versionString.match(
|
|
75
|
-
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[
|
|
87
|
+
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/
|
|
76
88
|
) ?? [];
|
|
77
|
-
return
|
|
89
|
+
return Boolean(semVer);
|
|
78
90
|
}
|
|
79
91
|
function makeHumanReadable(rawObject) {
|
|
80
92
|
const getLabel = (key) => {
|
|
@@ -89,12 +101,15 @@ function makeHumanReadable(rawObject) {
|
|
|
89
101
|
}
|
|
90
102
|
function getPlatformName(platform) {
|
|
91
103
|
switch (platform) {
|
|
92
|
-
case Platform.IOS:
|
|
104
|
+
case Platform.IOS: {
|
|
93
105
|
return "iOS";
|
|
94
|
-
|
|
106
|
+
}
|
|
107
|
+
case Platform.ANDROID: {
|
|
95
108
|
return "Android";
|
|
96
|
-
|
|
109
|
+
}
|
|
110
|
+
default: {
|
|
97
111
|
throw new Error(`Unknown platform: ${platform}`);
|
|
112
|
+
}
|
|
98
113
|
}
|
|
99
114
|
}
|
|
100
115
|
async function getMaskedInput(message) {
|
|
@@ -115,11 +130,11 @@ async function getInput(message) {
|
|
|
115
130
|
}
|
|
116
131
|
function generatePackageName(gameName) {
|
|
117
132
|
let normalizedGameName = gameName.trim().toLowerCase();
|
|
118
|
-
normalizedGameName = normalizedGameName.
|
|
119
|
-
normalizedGameName = normalizedGameName.
|
|
120
|
-
normalizedGameName = normalizedGameName.
|
|
133
|
+
normalizedGameName = normalizedGameName.replaceAll(/[\s_\-]+/g, ".");
|
|
134
|
+
normalizedGameName = normalizedGameName.replaceAll(/[^\d.a-z]/g, "");
|
|
135
|
+
normalizedGameName = normalizedGameName.replaceAll(/\.+/g, ".");
|
|
121
136
|
normalizedGameName = normalizedGameName.replace(/^\./, "").replace(/\.$/, "");
|
|
122
|
-
if (
|
|
137
|
+
if (/^\d/.test(normalizedGameName)) {
|
|
123
138
|
normalizedGameName = "app." + normalizedGameName;
|
|
124
139
|
}
|
|
125
140
|
const prefix = "com.";
|