shipthis 0.1.25 → 0.1.26
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-mPUG2R4N.js +76 -0
- package/dist/Command-B3AmRt2w.js +28 -0
- package/dist/CommandGame-BCMzP9pc.js +9 -0
- package/dist/Create-CsJxpzUs.js +59 -0
- package/dist/Import-v0M_ygyF.js +110 -0
- package/dist/JobProgress-9uvq8IBn.js +121 -0
- package/dist/JobStatusTable-Bf7J9WXe.js +191 -0
- package/dist/NextSteps-CK9zHOCt.js +18 -0
- package/dist/ProgressSpinner-6pw1T8Iw.js +16 -0
- package/dist/ProjectCredentialsTable-CTkP1mvy.js +37 -0
- package/dist/RunWithSpinner-BVXNWGD3.js +27 -0
- package/dist/StatusTable-Dm5St4g-.js +33 -0
- package/dist/Table-CvM6pccN.js +101 -0
- package/dist/Title-BCQtayg6.js +6 -0
- package/dist/UserCredentialsTable-DhtM_iTG.js +82 -0
- package/dist/baseAppleCommand-IGl6KTvv.js +10 -0
- package/dist/baseGameAndroidCommand-DFn4zMvq.js +43 -0
- package/dist/commands/apple/apiKey/create.js +103 -0
- package/dist/commands/apple/apiKey/export.js +81 -0
- package/dist/commands/apple/apiKey/import.js +85 -0
- package/dist/commands/apple/apiKey/status.js +122 -0
- package/dist/commands/apple/certificate/create.js +133 -0
- package/dist/commands/apple/certificate/export.js +81 -0
- package/dist/commands/apple/certificate/import.js +85 -0
- package/dist/commands/apple/certificate/status.js +130 -0
- package/dist/commands/apple/login.js +76 -0
- package/dist/commands/apple/status.js +79 -0
- package/dist/commands/dashboard.js +38 -0
- package/dist/commands/game/android/apiKey/connect.js +74 -0
- package/dist/commands/game/android/apiKey/create.js +74 -0
- package/dist/commands/game/android/apiKey/export.js +84 -0
- package/dist/commands/game/android/apiKey/import.js +93 -0
- package/dist/commands/game/android/apiKey/invite.js +81 -0
- package/dist/commands/game/android/apiKey/status.js +87 -0
- package/dist/commands/game/android/keyStore/create.js +69 -0
- package/dist/commands/game/android/keyStore/export.js +83 -0
- package/dist/commands/game/android/keyStore/import.js +112 -0
- package/dist/commands/game/android/keyStore/status.js +70 -0
- package/dist/commands/game/android/status.js +84 -0
- package/dist/commands/game/build/download.js +80 -0
- package/dist/commands/game/build/list.js +94 -0
- package/dist/commands/game/create.js +67 -0
- package/dist/commands/game/details.js +113 -0
- package/dist/commands/game/export.js +58 -0
- package/dist/commands/game/ios/app/addTester.js +124 -0
- package/dist/commands/game/ios/app/create.js +117 -0
- package/dist/commands/game/ios/app/status.js +66 -0
- package/dist/commands/game/ios/app/sync.js +95 -0
- package/dist/commands/game/ios/profile/create.js +129 -0
- package/dist/commands/game/ios/profile/export.js +83 -0
- package/dist/commands/game/ios/profile/import.js +92 -0
- package/dist/commands/game/ios/profile/status.js +139 -0
- package/dist/commands/game/ios/status.js +92 -0
- package/dist/commands/game/ios/wizard.js +153 -0
- package/dist/commands/game/job/list.js +91 -0
- package/dist/commands/game/job/status.js +91 -0
- package/dist/commands/game/list.js +83 -0
- package/dist/commands/game/ship.js +216 -0
- package/dist/commands/game/status.js +114 -0
- package/dist/commands/game/wizard.js +686 -0
- package/dist/commands/internal/fastlane.js +74 -0
- package/dist/commands/internal/readme.js +937 -0
- package/dist/commands/login.js +92 -0
- package/dist/commands/status.js +76 -0
- package/dist/export-CVs_xoDN.js +36 -0
- package/dist/git-DREGq-jc.js +32 -0
- package/dist/import-Ch5O7xfN.js +47 -0
- package/dist/index-BB00V5oF.js +136 -0
- package/dist/index-BD1WLuFJ.js +125 -0
- package/dist/index-CIa2EDQ6.js +24 -0
- package/dist/index-CboPN9aq.js +138 -0
- package/dist/index-DkNQs11R.js +711 -0
- package/dist/index-nnzhQ3nY.js +209 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/upload-CRE2nVdd.js +60 -0
- package/dist/useAndroidServiceAccountTestResult-DcYDam-p.js +52 -0
- package/dist/useAppleApp-B16WbUxJ.js +32 -0
- package/dist/useAppleBundleId-DobPATan.js +64 -0
- package/dist/useJobWatching--BvVn7xS.js +45 -0
- package/dist/useProjectCredentials-Btnr7WK3.js +54 -0
- package/dist/useWebSocket-ByuNoqRw.js +36 -0
- package/dist/utils/help.js +14 -0
- package/package.json +1 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { useState, useRef, useEffect, useContext } from 'react';
|
|
4
|
+
import Spinner from 'ink-spinner';
|
|
5
|
+
import { b as GameContext } from './index-nnzhQ3nY.js';
|
|
6
|
+
import { p as getAuthedHeaders, q as API_URL, H as castObjectDates, P as Platform, C as CredentialsType, T as getGoogleStatus } from './index-DkNQs11R.js';
|
|
7
|
+
import axios from 'axios';
|
|
8
|
+
import 'crypto-js';
|
|
9
|
+
import 'uuid';
|
|
10
|
+
import 'fs';
|
|
11
|
+
import 'luxon';
|
|
12
|
+
import '@inkjs/ui';
|
|
13
|
+
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
14
|
+
import 'yazl';
|
|
15
|
+
import 'crypto';
|
|
16
|
+
import 'readline-sync';
|
|
17
|
+
import 'node:readline';
|
|
18
|
+
import 'node:path';
|
|
19
|
+
import 'node:url';
|
|
20
|
+
import 'isomorphic-git';
|
|
21
|
+
import '@oclif/core';
|
|
22
|
+
import { c as cacheKeys } from './useAndroidServiceAccountTestResult-DcYDam-p.js';
|
|
23
|
+
import 'fast-glob';
|
|
24
|
+
import 'socket.io-client';
|
|
25
|
+
import { u as useWebSocket } from './useWebSocket-ByuNoqRw.js';
|
|
26
|
+
import { u as useProjectCredentials } from './useProjectCredentials-Btnr7WK3.js';
|
|
27
|
+
import 'open';
|
|
28
|
+
import 'marked';
|
|
29
|
+
import 'marked-terminal';
|
|
30
|
+
import 'path';
|
|
31
|
+
import { P as ProgressSpinner } from './ProgressSpinner-6pw1T8Iw.js';
|
|
32
|
+
import 'qrcode';
|
|
33
|
+
import 'string-length';
|
|
34
|
+
import 'strip-ansi';
|
|
35
|
+
|
|
36
|
+
async function fetchStatus({ projectId }) {
|
|
37
|
+
try {
|
|
38
|
+
if (!projectId) throw new Error("projectId is required");
|
|
39
|
+
const headers = getAuthedHeaders();
|
|
40
|
+
const url = `${API_URL}/projects/${projectId}/credentials/android/key/status/`;
|
|
41
|
+
const response = await axios.get(url, { headers });
|
|
42
|
+
return castObjectDates(response.data);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.warn("fetchStatus Error", error);
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const useAndroidServiceAccountSetupStatus = (props) => {
|
|
49
|
+
return useQuery({
|
|
50
|
+
queryKey: cacheKeys.androidSetupStatus(props),
|
|
51
|
+
queryFn: () => fetchStatus(props),
|
|
52
|
+
// Status changes frequently, so we want to keep it fresh
|
|
53
|
+
refetchInterval: 1e3 * 5,
|
|
54
|
+
staleTime: 1e3 * 5
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const ERR_NOT_AUTHENTICATED = "You must be connected to Google to create a Service Account Key";
|
|
59
|
+
const useHasServiceAccountKey = (projectId) => {
|
|
60
|
+
const { data, isSuccess } = useProjectCredentials({ projectId, platform: Platform.ANDROID });
|
|
61
|
+
return isSuccess && data.data.some((cred) => cred.isActive && cred.platform === Platform.ANDROID && cred.type == CredentialsType.KEY);
|
|
62
|
+
};
|
|
63
|
+
const useAndroidServiceAccount = ({ projectId, onError, onComplete }) => {
|
|
64
|
+
const queryClient = useQueryClient();
|
|
65
|
+
const [isStarting, setIsStarting] = useState(false);
|
|
66
|
+
const hasServiceAccountKey = useHasServiceAccountKey(projectId);
|
|
67
|
+
const listener = {
|
|
68
|
+
getPattern: () => `project.${projectId}:android-setup-status`,
|
|
69
|
+
eventHandler: async (pattern, data) => {
|
|
70
|
+
const key = cacheKeys.androidSetupStatus({ projectId });
|
|
71
|
+
queryClient.setQueryData(key, () => data);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
useWebSocket([listener]);
|
|
75
|
+
const { data: setupStatus } = useAndroidServiceAccountSetupStatus({ projectId });
|
|
76
|
+
const prevSetupStatusRef = useRef("unknown");
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (["running", "queued"].includes(prevSetupStatusRef.current)) {
|
|
79
|
+
if (setupStatus?.status === "complete") onComplete();
|
|
80
|
+
if (setupStatus?.status === "error") onError(new Error(setupStatus.errorMessage));
|
|
81
|
+
}
|
|
82
|
+
prevSetupStatusRef.current = setupStatus?.status || "unknown";
|
|
83
|
+
}, [setupStatus]);
|
|
84
|
+
const handleStart = async () => {
|
|
85
|
+
try {
|
|
86
|
+
setIsStarting(true);
|
|
87
|
+
const currentStatus = await getGoogleStatus();
|
|
88
|
+
if (!currentStatus.isAuthenticated) throw new Error(ERR_NOT_AUTHENTICATED);
|
|
89
|
+
const headers = getAuthedHeaders();
|
|
90
|
+
const androidKeyApiBase = `${API_URL}/projects/${projectId}/credentials/android/key`;
|
|
91
|
+
const startUrl = `${androidKeyApiBase}/setup/`;
|
|
92
|
+
const { data: updatedStatus } = await axios.post(startUrl, {}, { headers });
|
|
93
|
+
queryClient.invalidateQueries({
|
|
94
|
+
queryKey: cacheKeys.projectCredentials({ projectId, pageNumber: 0 })
|
|
95
|
+
});
|
|
96
|
+
await queryClient.setQueryData(cacheKeys.androidSetupStatus({ projectId }), (_) => updatedStatus);
|
|
97
|
+
setIsStarting(false);
|
|
98
|
+
return true;
|
|
99
|
+
} catch (error) {
|
|
100
|
+
setIsStarting(false);
|
|
101
|
+
console.warn("useAndroidServiceAccount.handleStart Error", error);
|
|
102
|
+
onError(error);
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const isCreating = isStarting || setupStatus?.status === "queued" || setupStatus?.status === "running";
|
|
107
|
+
return {
|
|
108
|
+
handleStart,
|
|
109
|
+
setupStatus,
|
|
110
|
+
isCreating,
|
|
111
|
+
hasServiceAccountKey
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const CreateServiceAccountKey = (props) => {
|
|
116
|
+
const { gameId } = useContext(GameContext);
|
|
117
|
+
return /* @__PURE__ */ jsx(Fragment, { children: gameId && /* @__PURE__ */ jsx(CreateForGame, { gameId, ...props }) });
|
|
118
|
+
};
|
|
119
|
+
const CreateForGame = ({ onComplete, onError, gameId, ...boxProps }) => {
|
|
120
|
+
const [didStart, setDidStart] = useState(false);
|
|
121
|
+
const { handleStart, setupStatus, isCreating } = useAndroidServiceAccount({
|
|
122
|
+
projectId: gameId,
|
|
123
|
+
onError,
|
|
124
|
+
onComplete
|
|
125
|
+
});
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
handleStart().then(() => setDidStart(true));
|
|
128
|
+
}, [gameId]);
|
|
129
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: 1, ...boxProps, children: [
|
|
130
|
+
/* @__PURE__ */ jsxs(Box, { flexDirection: "row", gap: 1, children: [
|
|
131
|
+
/* @__PURE__ */ jsx(Text, { children: "Creating a Service Account and API Key..." }),
|
|
132
|
+
isCreating && /* @__PURE__ */ jsx(Spinner, { type: "dots" })
|
|
133
|
+
] }),
|
|
134
|
+
didStart && /* @__PURE__ */ jsx(ProgressSpinner, { progress: (setupStatus?.progress || 0) * 100, spinnerType: "dots" })
|
|
135
|
+
] }) });
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export { CreateServiceAccountKey as C };
|