shipthis 0.1.10 → 0.1.11
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/assets/markdown/create-or-import-keystore.md +7 -0
- package/dist/AppleBundleIdDetails-DymjrhOZ.js +73 -0
- package/dist/Command-BiB9MqbJ.js +204 -0
- package/dist/CommandGame-C1oTlfdb.js +8 -0
- package/dist/Create-DIaSKUpl.js +56 -0
- package/dist/Import-BIOsf8AA.js +107 -0
- package/dist/JobProgress-W0QQR49T.js +108 -0
- package/dist/JobStatusTable-DqoppRro.js +75 -0
- package/dist/commands/apple/apiKey/create.js +4 -4
- package/dist/commands/apple/apiKey/export.js +3 -3
- package/dist/commands/apple/apiKey/import.js +4 -4
- package/dist/commands/apple/apiKey/status.js +3 -3
- package/dist/commands/apple/certificate/create.js +4 -4
- package/dist/commands/apple/certificate/export.js +3 -3
- package/dist/commands/apple/certificate/import.js +4 -4
- package/dist/commands/apple/certificate/status.js +3 -3
- package/dist/commands/apple/status.js +3 -3
- package/dist/commands/game/android/apiKey/connect.js +6 -6
- package/dist/commands/game/android/apiKey/create.js +6 -6
- package/dist/commands/game/android/apiKey/export.js +3 -3
- package/dist/commands/game/android/apiKey/import.js +4 -4
- package/dist/commands/game/android/apiKey/status.js +3 -3
- package/dist/commands/game/android/keyStore/create.js +7 -7
- package/dist/commands/game/android/keyStore/export.js +3 -3
- package/dist/commands/game/android/keyStore/import.js +45 -25
- package/dist/commands/game/android/keyStore/status.js +3 -3
- package/dist/commands/game/android/status.js +5 -5
- package/dist/commands/game/build/download.js +4 -4
- package/dist/commands/game/build/list.js +4 -4
- package/dist/commands/game/details.js +3 -3
- package/dist/commands/game/ios/app/addTester.js +3 -3
- package/dist/commands/game/ios/app/create.js +3 -3
- package/dist/commands/game/ios/app/status.js +4 -4
- package/dist/commands/game/ios/app/sync.js +3 -3
- package/dist/commands/game/ios/profile/create.js +4 -4
- package/dist/commands/game/ios/profile/export.js +3 -3
- package/dist/commands/game/ios/profile/import.js +4 -4
- package/dist/commands/game/ios/profile/status.js +3 -3
- package/dist/commands/game/ios/status.js +6 -6
- package/dist/commands/game/job/list.js +5 -5
- package/dist/commands/game/job/status.js +7 -7
- package/dist/commands/game/list.js +5 -5
- package/dist/commands/game/ship.js +7 -7
- package/dist/commands/game/status.js +5 -5
- package/dist/commands/game/wizard.js +116 -17
- package/dist/commands/status.js +3 -3
- package/dist/import-v54PM_Qg.js +47 -0
- package/dist/index-D6BH5UAM.js +135 -0
- package/dist/index-o9Y-84Rj.js +122 -0
- package/dist/useJobWatching-I_A3b36f.js +45 -0
- package/npm-shrinkwrap.json +2 -2
- package/oclif.manifest.json +27 -4
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Create or import an Android Keystore
|
|
2
|
+
|
|
3
|
+
ShipThis can create an **Android Keystore file** for you, which is used by Google Play to verify that you are the known uploader of your game. This keystore is called the upload key. After you upload a new build, Google Play internally processes and re-signs the app for Distribution with a different key called the Google Play signing key.
|
|
4
|
+
|
|
5
|
+
Read more at [https://developer.android.com/privacy-and-security/keystore](https://developer.android.com/privacy-and-security/keystore)
|
|
6
|
+
|
|
7
|
+
**Note: If you have previously published your game to Google Play, then you may want to import an existing keystore file.**
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import Spinner from 'ink-spinner';
|
|
4
|
+
import './index-BB7X1Pqp.js';
|
|
5
|
+
import 'axios';
|
|
6
|
+
import '@tanstack/react-query';
|
|
7
|
+
import 'crypto';
|
|
8
|
+
import 'fs';
|
|
9
|
+
import 'readline-sync';
|
|
10
|
+
import 'node:readline';
|
|
11
|
+
import 'node:path';
|
|
12
|
+
import 'node:url';
|
|
13
|
+
import 'react';
|
|
14
|
+
import 'crypto-js';
|
|
15
|
+
import 'uuid';
|
|
16
|
+
import 'luxon';
|
|
17
|
+
import 'socket.io-client';
|
|
18
|
+
import 'isomorphic-git';
|
|
19
|
+
import '@oclif/core';
|
|
20
|
+
import { u as useAppleApp } from './useAppleApp-BEtLQa7n.js';
|
|
21
|
+
import 'fast-glob';
|
|
22
|
+
import 'yazl';
|
|
23
|
+
import '@inkjs/ui';
|
|
24
|
+
import './Command-BiB9MqbJ.js';
|
|
25
|
+
import 'open';
|
|
26
|
+
import { T as Table } from './Table-CvM6pccN.js';
|
|
27
|
+
import { T as Title } from './Title-BCQtayg6.js';
|
|
28
|
+
import 'string-length';
|
|
29
|
+
import 'strip-ansi';
|
|
30
|
+
import 'qrcode';
|
|
31
|
+
import { u as useAppleBundleId } from './useAppleBundleId-DXbMDRLd.js';
|
|
32
|
+
|
|
33
|
+
const AppleAppDetails = (props) => {
|
|
34
|
+
const { data, isLoading } = useAppleApp(props);
|
|
35
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
|
|
36
|
+
/* @__PURE__ */ jsx(Title, { children: "App Details (in the Apple Developer Portal)" }),
|
|
37
|
+
isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }),
|
|
38
|
+
data && data.summary && /* @__PURE__ */ jsx(Table, { data: [data.summary] })
|
|
39
|
+
] });
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const AppleBundleIdDetails = (props) => {
|
|
43
|
+
const { data, isLoading } = useAppleBundleId(props);
|
|
44
|
+
const { bundleIdSummary, capabilitiesTable, shouldSyncCapabilities, capabilities } = data || {};
|
|
45
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
46
|
+
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
|
|
47
|
+
/* @__PURE__ */ jsx(Title, { children: "BundleId Details (in the Apple Developer Portal)" }),
|
|
48
|
+
isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }),
|
|
49
|
+
bundleIdSummary && /* @__PURE__ */ jsx(Table, { data: [bundleIdSummary] })
|
|
50
|
+
] }),
|
|
51
|
+
capabilities && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
|
|
52
|
+
/* @__PURE__ */ jsx(Title, { children: "Capabilities enabled in the BundleId" }),
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
Table,
|
|
55
|
+
{
|
|
56
|
+
data: capabilities.map((c) => {
|
|
57
|
+
return { capability: `${c}` };
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
] }),
|
|
62
|
+
capabilitiesTable && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
|
|
63
|
+
/* @__PURE__ */ jsx(Title, { children: "BundleId Capability Check" }),
|
|
64
|
+
/* @__PURE__ */ jsx(Table, { data: capabilitiesTable })
|
|
65
|
+
] }),
|
|
66
|
+
shouldSyncCapabilities && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
67
|
+
/* @__PURE__ */ jsx(Text, { bold: true, children: "The capabilities are out of sync with the Apple Developer Portal." }),
|
|
68
|
+
/* @__PURE__ */ jsx(Text, { bold: true, children: "Run shipthis game ios app sync" })
|
|
69
|
+
] })
|
|
70
|
+
] });
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export { AppleAppDetails as A, AppleBundleIdDetails as a };
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Text, useInput, Box } from 'ink';
|
|
3
|
+
import React, { useState, useEffect, useContext, useRef } from 'react';
|
|
4
|
+
import Spinner from 'ink-spinner';
|
|
5
|
+
import open from 'open';
|
|
6
|
+
import { g as getShortUUID, h as getPlatformName, s as scriptDir } from './index-Cz_KLwWf.js';
|
|
7
|
+
import { c as cacheKeys, u as useAndroidServiceAccountTestResult, K as KeyTestStatus, a as KeyTestError } from './useAndroidServiceAccountTestResult-Ce1x0Eh8.js';
|
|
8
|
+
import { p as getAuthedHeaders, q as API_URL, K as castArrayObjectDates, P as Platform, a6 as getShortDateTime, a5 as getJob, J as JobStatus, a7 as getShortTimeDelta, H as getProject, a2 as getShortAuthRequiredUrl, $ as queryClient, X as WEB_URL } from './index-BB7X1Pqp.js';
|
|
9
|
+
import '@inkjs/ui';
|
|
10
|
+
import axios from 'axios';
|
|
11
|
+
import { useQuery, QueryClientProvider } from '@tanstack/react-query';
|
|
12
|
+
import fs__default from 'fs';
|
|
13
|
+
import 'uuid';
|
|
14
|
+
import 'yazl';
|
|
15
|
+
import { setOptions, parse } from 'marked';
|
|
16
|
+
import TerminalRenderer from 'marked-terminal';
|
|
17
|
+
import path from 'path';
|
|
18
|
+
import 'qrcode';
|
|
19
|
+
import 'string-length';
|
|
20
|
+
import 'strip-ansi';
|
|
21
|
+
import 'luxon';
|
|
22
|
+
import 'fast-glob';
|
|
23
|
+
import 'socket.io-client';
|
|
24
|
+
import 'crypto';
|
|
25
|
+
import 'readline-sync';
|
|
26
|
+
import 'node:readline';
|
|
27
|
+
import 'node:path';
|
|
28
|
+
import 'node:url';
|
|
29
|
+
import 'crypto-js';
|
|
30
|
+
import 'isomorphic-git';
|
|
31
|
+
import '@oclif/core';
|
|
32
|
+
|
|
33
|
+
async function queryBuilds({ projectId, ...pageAndSortParams }) {
|
|
34
|
+
try {
|
|
35
|
+
const headers = getAuthedHeaders();
|
|
36
|
+
const url = `${API_URL}/projects/${projectId}/builds`;
|
|
37
|
+
const response = await axios.get(url, { headers, params: pageAndSortParams });
|
|
38
|
+
return {
|
|
39
|
+
...response.data,
|
|
40
|
+
data: castArrayObjectDates(response.data.data)
|
|
41
|
+
};
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.warn("queryBuilds Error", error);
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function getBuildSummary(build) {
|
|
48
|
+
const filename = build.platform == Platform.IOS ? "output.ipa" : "output.aab";
|
|
49
|
+
return {
|
|
50
|
+
id: getShortUUID(build.id),
|
|
51
|
+
...getJobDetailsSummary(build.jobDetails),
|
|
52
|
+
platform: getPlatformName(build.platform),
|
|
53
|
+
jobId: getShortUUID(build.jobId),
|
|
54
|
+
createdAt: getShortDateTime(build.createdAt),
|
|
55
|
+
cmd: `shipthis game build download ${getShortUUID(build.id)} ${filename}`
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const useBuilds = (props) => {
|
|
59
|
+
const queryResult = useQuery({
|
|
60
|
+
queryKey: cacheKeys.builds(props),
|
|
61
|
+
queryFn: async () => queryBuilds(props)
|
|
62
|
+
});
|
|
63
|
+
return queryResult;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
function getJobDetailsSummary(jobDetails) {
|
|
67
|
+
const semanticVersion = jobDetails?.semanticVersion || "N/A";
|
|
68
|
+
const buildNumber = jobDetails?.buildNumber || "N/A";
|
|
69
|
+
const gitCommit = jobDetails?.gitCommitHash ? getShortUUID(jobDetails?.gitCommitHash) : "N/A";
|
|
70
|
+
const gitBranch = jobDetails?.gitBranch || "N/A";
|
|
71
|
+
return {
|
|
72
|
+
version: `${semanticVersion} (${buildNumber})`,
|
|
73
|
+
gitInfo: `${gitCommit} (${gitBranch})`
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function getJobSummary(job, timeNow) {
|
|
77
|
+
const inProgress = ![JobStatus.COMPLETED, JobStatus.FAILED].includes(job.status);
|
|
78
|
+
return {
|
|
79
|
+
id: getShortUUID(job.id),
|
|
80
|
+
...getJobDetailsSummary(job.details),
|
|
81
|
+
platform: getPlatformName(job.type),
|
|
82
|
+
status: job.status,
|
|
83
|
+
createdAt: getShortDateTime(job.createdAt),
|
|
84
|
+
runtime: getShortTimeDelta(job.createdAt, inProgress ? timeNow : job.updatedAt)
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const useJob = (props) => {
|
|
88
|
+
return useQuery({
|
|
89
|
+
queryKey: cacheKeys.job(props),
|
|
90
|
+
queryFn: () => getJob(props.jobId, props.projectId)
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const CommandContext = React.createContext({
|
|
95
|
+
command: null,
|
|
96
|
+
setCommand: (command) => {
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
const CommandProvider = (props) => {
|
|
100
|
+
const [command, setCommand] = useState(props.command || null);
|
|
101
|
+
return /* @__PURE__ */ jsx(CommandContext.Provider, { value: { command, setCommand }, children: props.children });
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const GameContext = React.createContext({
|
|
105
|
+
gameId: null,
|
|
106
|
+
game: null,
|
|
107
|
+
setGameId: (gameId) => {
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
const GameProvider = ({ children }) => {
|
|
111
|
+
const [gameId, setGameId] = useState(null);
|
|
112
|
+
const [game, setGame] = useState(null);
|
|
113
|
+
const { command } = React.useContext(CommandContext);
|
|
114
|
+
const handleLoad = async () => {
|
|
115
|
+
if (command) {
|
|
116
|
+
const commandGameId = await command.getGameId();
|
|
117
|
+
if (commandGameId) setGameId(commandGameId);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const handleGameIdChange = async () => {
|
|
121
|
+
if (!gameId) {
|
|
122
|
+
setGame(null);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const game2 = await getProject(gameId);
|
|
126
|
+
setGame(game2);
|
|
127
|
+
};
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
handleGameIdChange();
|
|
130
|
+
}, [gameId]);
|
|
131
|
+
useEffect(() => {
|
|
132
|
+
handleLoad();
|
|
133
|
+
}, [command]);
|
|
134
|
+
return /* @__PURE__ */ jsx(GameContext.Provider, { value: { gameId, game, setGameId }, children });
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const entrypointPath = fs__default.realpathSync(process.argv[1]);
|
|
138
|
+
const root = path.dirname(entrypointPath);
|
|
139
|
+
const Markdown = ({ filename, templateVars, ...options }) => {
|
|
140
|
+
setOptions({ renderer: new TerminalRenderer(options) });
|
|
141
|
+
const mdPath = path.join(root, "..", "assets", "markdown", filename);
|
|
142
|
+
const mdTemplate = fs__default.readFileSync(mdPath, "utf8").trim();
|
|
143
|
+
const markdown = !templateVars ? mdTemplate : mdTemplate.replace(/\${(.*?)}/g, (_, key) => templateVars[key.trim()] || "");
|
|
144
|
+
return /* @__PURE__ */ jsx(Text, { children: parse(markdown).trim() });
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
scriptDir(import.meta);
|
|
148
|
+
const getIsAppFound = (result) => {
|
|
149
|
+
const isFound = result?.status === KeyTestStatus.SUCCESS || result?.status === KeyTestStatus.ERROR && result?.error === KeyTestError.NOT_INVITED;
|
|
150
|
+
return isFound;
|
|
151
|
+
};
|
|
152
|
+
const CreateGooglePlayGame = (props) => {
|
|
153
|
+
const { gameId } = useContext(GameContext);
|
|
154
|
+
return /* @__PURE__ */ jsx(Fragment, { children: gameId && /* @__PURE__ */ jsx(Create, { gameId, ...props }) });
|
|
155
|
+
};
|
|
156
|
+
const Create = ({ onComplete, onError, gameId, ...boxProps }) => {
|
|
157
|
+
const { data: result, isFetching } = useAndroidServiceAccountTestResult({ projectId: gameId });
|
|
158
|
+
const { data: builds } = useBuilds({ projectId: gameId, pageNumber: 0 });
|
|
159
|
+
const previousIsFound = useRef(false);
|
|
160
|
+
useEffect(() => {
|
|
161
|
+
const isFound = getIsAppFound(result);
|
|
162
|
+
if (previousIsFound.current === false && isFound) {
|
|
163
|
+
onComplete();
|
|
164
|
+
}
|
|
165
|
+
previousIsFound.current = isFound;
|
|
166
|
+
}, [result]);
|
|
167
|
+
useInput(async (input) => {
|
|
168
|
+
if (!gameId) return;
|
|
169
|
+
switch (input) {
|
|
170
|
+
case "r":
|
|
171
|
+
queryClient.invalidateQueries({
|
|
172
|
+
queryKey: cacheKeys.androidKeyTestResult({ projectId: gameId })
|
|
173
|
+
});
|
|
174
|
+
break;
|
|
175
|
+
case "d":
|
|
176
|
+
const dashUrl = await getShortAuthRequiredUrl(`/games/${getShortUUID(gameId)}/builds`);
|
|
177
|
+
await open(dashUrl);
|
|
178
|
+
}
|
|
179
|
+
if (input !== "r") return;
|
|
180
|
+
queryClient.invalidateQueries({
|
|
181
|
+
queryKey: cacheKeys.androidKeyTestResult({ projectId: gameId })
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
const initialBuild = builds?.data.find((build) => build.platform === Platform.ANDROID);
|
|
185
|
+
const downloadCmd = initialBuild ? `${getBuildSummary(initialBuild).cmd}` : "";
|
|
186
|
+
const templateVars = {
|
|
187
|
+
downloadCmd,
|
|
188
|
+
dashboardURL: new URL(`/games/${getShortUUID(gameId)}/builds`, WEB_URL).toString()
|
|
189
|
+
};
|
|
190
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: 1, ...boxProps, children: [
|
|
191
|
+
/* @__PURE__ */ jsxs(Box, { flexDirection: "row", gap: 1, children: [
|
|
192
|
+
/* @__PURE__ */ jsx(Text, { bold: true, children: isFetching ? "Checking..." : "ShipThis has not detected your game in Google Play. Press R to test again." }),
|
|
193
|
+
isFetching && /* @__PURE__ */ jsx(Spinner, { type: "dots" })
|
|
194
|
+
] }),
|
|
195
|
+
/* @__PURE__ */ jsx(Markdown, { filename: "create-google-play-game.md", templateVars })
|
|
196
|
+
] }) });
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const Command = ({ children, command }) => {
|
|
200
|
+
const width = Math.min(160, process.stdout.columns || 80);
|
|
201
|
+
return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(CommandProvider, { command, children: /* @__PURE__ */ jsx(Box, { width, flexDirection: "column", children }) }) });
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export { Command as C, GameProvider as G, Markdown as M, getBuildSummary as a, GameContext as b, CommandContext as c, useBuilds as d, CreateGooglePlayGame as e, getJobSummary as g, queryBuilds as q, useJob as u };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { C as Command, G as GameProvider } from './Command-BiB9MqbJ.js';
|
|
3
|
+
|
|
4
|
+
const CommandGame = ({ children, command }) => {
|
|
5
|
+
return /* @__PURE__ */ jsx(Command, { command, children: /* @__PURE__ */ jsx(GameProvider, { children }) });
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export { CommandGame as C };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Box } from 'ink';
|
|
3
|
+
import axios from 'axios';
|
|
4
|
+
import { useContext } from 'react';
|
|
5
|
+
import { useQueryClient } from '@tanstack/react-query';
|
|
6
|
+
import { p as getAuthedHeaders, q as API_URL } from './index-BB7X1Pqp.js';
|
|
7
|
+
import { c as cacheKeys } from './useAndroidServiceAccountTestResult-Ce1x0Eh8.js';
|
|
8
|
+
import { b as GameContext } from './Command-BiB9MqbJ.js';
|
|
9
|
+
import 'ink-spinner';
|
|
10
|
+
import '@inkjs/ui';
|
|
11
|
+
import 'fs';
|
|
12
|
+
import 'uuid';
|
|
13
|
+
import 'yazl';
|
|
14
|
+
import 'crypto';
|
|
15
|
+
import 'readline-sync';
|
|
16
|
+
import 'node:readline';
|
|
17
|
+
import 'node:path';
|
|
18
|
+
import 'node:url';
|
|
19
|
+
import 'luxon';
|
|
20
|
+
import 'fast-glob';
|
|
21
|
+
import 'socket.io-client';
|
|
22
|
+
import 'isomorphic-git';
|
|
23
|
+
import '@oclif/core';
|
|
24
|
+
import 'open';
|
|
25
|
+
import 'qrcode';
|
|
26
|
+
import { R as RunWithSpinner } from './RunWithSpinner-BVXNWGD3.js';
|
|
27
|
+
import 'string-length';
|
|
28
|
+
import 'strip-ansi';
|
|
29
|
+
|
|
30
|
+
const CreateKeystore = ({ onComplete, onError, ...boxProps }) => {
|
|
31
|
+
const { gameId } = useContext(GameContext);
|
|
32
|
+
const queryClient = useQueryClient();
|
|
33
|
+
const handleCreate = async () => {
|
|
34
|
+
try {
|
|
35
|
+
if (!gameId) throw new Error("No game");
|
|
36
|
+
const headers = await getAuthedHeaders();
|
|
37
|
+
await axios.post(`${API_URL}/projects/${gameId}/credentials/android/certificate`, null, {
|
|
38
|
+
headers
|
|
39
|
+
});
|
|
40
|
+
queryClient.invalidateQueries({ queryKey: cacheKeys.projectCredentials({ projectId: gameId, pageNumber: 0 }) });
|
|
41
|
+
} catch (err) {
|
|
42
|
+
onError(err);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
return /* @__PURE__ */ jsx(Box, { flexDirection: "column", gap: 1, ...boxProps, children: /* @__PURE__ */ jsx(
|
|
46
|
+
RunWithSpinner,
|
|
47
|
+
{
|
|
48
|
+
executeMethod: handleCreate,
|
|
49
|
+
msgInProgress: "Creating Keystore...",
|
|
50
|
+
msgComplete: "Keystore created",
|
|
51
|
+
onComplete
|
|
52
|
+
}
|
|
53
|
+
) });
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { CreateKeystore as C };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext, useState, useEffect } from 'react';
|
|
3
|
+
import { Box, Text } from 'ink';
|
|
4
|
+
import Spinner from 'ink-spinner';
|
|
5
|
+
import { b as GameContext } from './Command-BiB9MqbJ.js';
|
|
6
|
+
import { $ as queryClient, P as Platform, C as CredentialsType } from './index-BB7X1Pqp.js';
|
|
7
|
+
import 'axios';
|
|
8
|
+
import 'crypto-js';
|
|
9
|
+
import { v4 } from 'uuid';
|
|
10
|
+
import 'luxon';
|
|
11
|
+
import fs__default from 'fs';
|
|
12
|
+
import '@inkjs/ui';
|
|
13
|
+
import { useMutation } from '@tanstack/react-query';
|
|
14
|
+
import yazl from 'yazl';
|
|
15
|
+
import { c as cacheKeys } from './useAndroidServiceAccountTestResult-Ce1x0Eh8.js';
|
|
16
|
+
import { i as importCredential } from './import-v54PM_Qg.js';
|
|
17
|
+
import 'crypto';
|
|
18
|
+
import 'readline-sync';
|
|
19
|
+
import 'node:readline';
|
|
20
|
+
import 'node:path';
|
|
21
|
+
import 'node:url';
|
|
22
|
+
import 'fast-glob';
|
|
23
|
+
import 'socket.io-client';
|
|
24
|
+
import 'isomorphic-git';
|
|
25
|
+
import '@oclif/core';
|
|
26
|
+
import 'open';
|
|
27
|
+
import 'qrcode';
|
|
28
|
+
import 'string-length';
|
|
29
|
+
import 'strip-ansi';
|
|
30
|
+
|
|
31
|
+
async function importKeystore({ log = () => {
|
|
32
|
+
}, ...opt }) {
|
|
33
|
+
if (!opt.zipFilePath && !opt.jksFilePath) {
|
|
34
|
+
throw new Error("You must provide either a zipFilePath or a jksFilePath");
|
|
35
|
+
}
|
|
36
|
+
if (opt.zipFilePath && opt.jksFilePath) {
|
|
37
|
+
throw new Error("You cannot provide both a zipFilePath and a jksFilePath");
|
|
38
|
+
}
|
|
39
|
+
if (opt.jksFilePath && (!opt.keystorePassword || !opt.keyPassword)) {
|
|
40
|
+
throw new Error("You must provide both keystorePassword and keyPassword when importing a jks file");
|
|
41
|
+
}
|
|
42
|
+
const toDelete = [];
|
|
43
|
+
if (opt.jksFilePath) {
|
|
44
|
+
log("Creating zip file from jks file...");
|
|
45
|
+
const outputZipToFile = (zip, fileName) => new Promise((resolve) => {
|
|
46
|
+
const outputStream = fs__default.createWriteStream(fileName);
|
|
47
|
+
zip.outputStream.pipe(outputStream).on("close", () => resolve());
|
|
48
|
+
zip.end();
|
|
49
|
+
});
|
|
50
|
+
const zipFile = new yazl.ZipFile();
|
|
51
|
+
log("Adding keyStore.jks to zip file...");
|
|
52
|
+
zipFile.addFile(opt.jksFilePath, "keyStore.jks");
|
|
53
|
+
log("Adding password.txt and keyPassword.txt to zip file...");
|
|
54
|
+
zipFile.addBuffer(Buffer.from(`${opt.keystorePassword}`), "password.txt");
|
|
55
|
+
zipFile.addBuffer(Buffer.from(`${opt.keyPassword}`), "keyPassword.txt");
|
|
56
|
+
const tmpZipFile = `${process.cwd()}/shipthis-keyStore-${v4()}.zip`;
|
|
57
|
+
log(`Writing zip file: ${tmpZipFile}`);
|
|
58
|
+
await outputZipToFile(zipFile, tmpZipFile);
|
|
59
|
+
toDelete.push(tmpZipFile);
|
|
60
|
+
opt.zipFilePath = tmpZipFile;
|
|
61
|
+
}
|
|
62
|
+
log("Uploading and importing zip file...");
|
|
63
|
+
const keyStore = await importCredential({
|
|
64
|
+
projectId: opt.gameId,
|
|
65
|
+
zipPath: `${opt.zipFilePath}`,
|
|
66
|
+
type: CredentialsType.CERTIFICATE,
|
|
67
|
+
platform: Platform.ANDROID
|
|
68
|
+
});
|
|
69
|
+
log("Imported successfully");
|
|
70
|
+
toDelete.forEach((file) => {
|
|
71
|
+
log(`Deleting temporary file: ${file}`);
|
|
72
|
+
fs__default.unlinkSync(file);
|
|
73
|
+
});
|
|
74
|
+
return keyStore;
|
|
75
|
+
}
|
|
76
|
+
const useImportKeystore = () => {
|
|
77
|
+
return useMutation({
|
|
78
|
+
mutationFn: importKeystore,
|
|
79
|
+
onSuccess: async (data) => {
|
|
80
|
+
const projectId = data.projectId;
|
|
81
|
+
queryClient.invalidateQueries({
|
|
82
|
+
queryKey: cacheKeys.projectCredentials({ projectId, pageNumber: 0 })
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const ImportKeystore = ({ onComplete, onError, importKeystoreProps }) => {
|
|
89
|
+
const { gameId } = useContext(GameContext);
|
|
90
|
+
const importMutation = useImportKeystore();
|
|
91
|
+
const [log, setLog] = useState(null);
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
if (!gameId) return;
|
|
94
|
+
const importOpts = {
|
|
95
|
+
...importKeystoreProps,
|
|
96
|
+
gameId,
|
|
97
|
+
log: setLog
|
|
98
|
+
};
|
|
99
|
+
importMutation.mutateAsync(importOpts).catch(onError).then(onComplete);
|
|
100
|
+
}, [gameId]);
|
|
101
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", gap: 1, children: [
|
|
102
|
+
/* @__PURE__ */ jsx(Spinner, { type: "dots" }),
|
|
103
|
+
log && /* @__PURE__ */ jsx(Text, { children: log })
|
|
104
|
+
] });
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export { ImportKeystore as I };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { v4 } from 'uuid';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import fg from 'fast-glob';
|
|
4
|
+
import fs__default from 'fs';
|
|
5
|
+
import yazl from 'yazl';
|
|
6
|
+
import { useMutation } from '@tanstack/react-query';
|
|
7
|
+
import { c as cacheKeys } from './useAndroidServiceAccountTestResult-Ce1x0Eh8.js';
|
|
8
|
+
import { $ as queryClient, x as DEFAULT_SHIPPED_FILES_GLOBS, w as DEFAULT_IGNORED_FILES_GLOBS, a0 as getNewUploadTicket, a1 as startJobsFromUpload, J as JobStatus } from './index-BB7X1Pqp.js';
|
|
9
|
+
import { f as getFileHash, h as getPlatformName } from './index-Cz_KLwWf.js';
|
|
10
|
+
import { g as getCWDGitInfo } from './git-DREGq-jc.js';
|
|
11
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
12
|
+
import { useRef } from 'react';
|
|
13
|
+
import 'ink';
|
|
14
|
+
import './Command-BiB9MqbJ.js';
|
|
15
|
+
import 'ink-spinner';
|
|
16
|
+
import 'crypto-js';
|
|
17
|
+
import 'luxon';
|
|
18
|
+
import '@inkjs/ui';
|
|
19
|
+
import 'open';
|
|
20
|
+
import { P as ProgressSpinner } from './ProgressSpinner-6pw1T8Iw.js';
|
|
21
|
+
import 'qrcode';
|
|
22
|
+
import 'string-length';
|
|
23
|
+
import 'strip-ansi';
|
|
24
|
+
import 'socket.io-client';
|
|
25
|
+
import { u as useJobWatching } from './useJobWatching-I_A3b36f.js';
|
|
26
|
+
|
|
27
|
+
async function ship({ command, log = () => {
|
|
28
|
+
} }) {
|
|
29
|
+
log("Fetching project config...");
|
|
30
|
+
const projectConfig = await command.getProjectConfig();
|
|
31
|
+
if (!projectConfig.project) throw new Error("No project found in project config");
|
|
32
|
+
log("Retrieving file globs...");
|
|
33
|
+
const shippedFilesGlobs = projectConfig.shippedFilesGlobs || DEFAULT_SHIPPED_FILES_GLOBS;
|
|
34
|
+
const ignoredFilesGlobs = projectConfig.ignoredFilesGlobs || DEFAULT_IGNORED_FILES_GLOBS;
|
|
35
|
+
log("Finding files to include in zip...");
|
|
36
|
+
const files = await fg(shippedFilesGlobs, { dot: true, ignore: ignoredFilesGlobs });
|
|
37
|
+
log(`Found ${files.length} files, adding to zip...`);
|
|
38
|
+
const zipFile = new yazl.ZipFile();
|
|
39
|
+
for (const file of files) {
|
|
40
|
+
zipFile.addFile(file, file);
|
|
41
|
+
}
|
|
42
|
+
const outputZipToFile = (zip, fileName) => new Promise((resolve) => {
|
|
43
|
+
const outputStream = fs__default.createWriteStream(fileName);
|
|
44
|
+
zip.outputStream.pipe(outputStream).on("close", () => resolve());
|
|
45
|
+
zip.end();
|
|
46
|
+
});
|
|
47
|
+
const tmpZipFile = `${process.cwd()}/shipthis-${v4()}.zip`;
|
|
48
|
+
log(`Creating zip file: ${tmpZipFile}`);
|
|
49
|
+
await outputZipToFile(zipFile, tmpZipFile);
|
|
50
|
+
log("Reading zip file buffer...");
|
|
51
|
+
const zipBuffer = fs__default.readFileSync(tmpZipFile);
|
|
52
|
+
const { size } = fs__default.statSync(tmpZipFile);
|
|
53
|
+
log("Requesting upload ticket...");
|
|
54
|
+
const uploadTicket = await getNewUploadTicket(projectConfig.project.id);
|
|
55
|
+
log("Uploading zip file...");
|
|
56
|
+
await axios.put(uploadTicket.url, zipBuffer, {
|
|
57
|
+
headers: {
|
|
58
|
+
"Content-length": size,
|
|
59
|
+
"Content-Type": "application/zip"
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
log("Fetching Git info...");
|
|
63
|
+
const gitInfo = await getCWDGitInfo();
|
|
64
|
+
log("Computing file hash...");
|
|
65
|
+
const zipFileMd5 = await getFileHash(tmpZipFile);
|
|
66
|
+
const uploadDetails = {
|
|
67
|
+
...gitInfo,
|
|
68
|
+
zipFileMd5
|
|
69
|
+
};
|
|
70
|
+
log("Starting jobs from upload...");
|
|
71
|
+
const jobs = await startJobsFromUpload(uploadTicket.id, uploadDetails);
|
|
72
|
+
log("Cleaning up temporary zip file...");
|
|
73
|
+
fs__default.unlinkSync(tmpZipFile);
|
|
74
|
+
log("Job submission complete.");
|
|
75
|
+
return jobs;
|
|
76
|
+
}
|
|
77
|
+
const useShip = () => {
|
|
78
|
+
return useMutation({
|
|
79
|
+
mutationFn: ship,
|
|
80
|
+
onSuccess: async (data) => {
|
|
81
|
+
queryClient.invalidateQueries({
|
|
82
|
+
queryKey: cacheKeys.jobs({ projectId: data[0].project.id, pageNumber: 0 })
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const JobProgress = (props) => {
|
|
89
|
+
const prevJobStatus = useRef(props.job.status);
|
|
90
|
+
const handleJobUpdate = (job) => {
|
|
91
|
+
const completed = [JobStatus.COMPLETED, JobStatus.FAILED];
|
|
92
|
+
const wasRunning = !completed.includes(prevJobStatus.current);
|
|
93
|
+
if (completed.includes(job.status) && wasRunning) {
|
|
94
|
+
props.onComplete();
|
|
95
|
+
}
|
|
96
|
+
prevJobStatus.current = job.status;
|
|
97
|
+
};
|
|
98
|
+
const { progress } = useJobWatching({
|
|
99
|
+
projectId: props.job.project.id,
|
|
100
|
+
jobId: props.job.id,
|
|
101
|
+
isWatching: true,
|
|
102
|
+
onJobUpdate: handleJobUpdate
|
|
103
|
+
});
|
|
104
|
+
const label = `${getPlatformName(props.job.type)} build progress...`;
|
|
105
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ProgressSpinner, { progress, label, spinnerType: "dots" }) });
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export { JobProgress as J, useShip as u };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { Box, Text } from 'ink';
|
|
4
|
+
import { DateTime } from 'luxon';
|
|
5
|
+
import Spinner from 'ink-spinner';
|
|
6
|
+
import { d as getStageColor, c as getJobStatusColor } from './index-Cz_KLwWf.js';
|
|
7
|
+
import { J as JobStatus } from './index-BB7X1Pqp.js';
|
|
8
|
+
import 'axios';
|
|
9
|
+
import '@tanstack/react-query';
|
|
10
|
+
import 'crypto-js';
|
|
11
|
+
import 'uuid';
|
|
12
|
+
import 'fs';
|
|
13
|
+
import { g as getJobSummary, a as getBuildSummary } from './Command-BiB9MqbJ.js';
|
|
14
|
+
import 'fast-glob';
|
|
15
|
+
import 'yazl';
|
|
16
|
+
import 'socket.io-client';
|
|
17
|
+
import { u as useJobWatching } from './useJobWatching-I_A3b36f.js';
|
|
18
|
+
import { T as Title } from './Title-BCQtayg6.js';
|
|
19
|
+
import { a as StatusRow, b as StatusRowLabel } from './StatusTable-Dm5St4g-.js';
|
|
20
|
+
|
|
21
|
+
const JobStatusSpinner = ({ status, showSpinner }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22
|
+
/* @__PURE__ */ jsx(Text, { color: getJobStatusColor(status), children: `${status}` }),
|
|
23
|
+
showSpinner && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
25
|
+
/* @__PURE__ */ jsx(Spinner, { type: "dots" })
|
|
26
|
+
] })
|
|
27
|
+
] });
|
|
28
|
+
const JobStatusTable = ({ jobId, projectId, isWatching, onJobUpdate }) => {
|
|
29
|
+
const { data: job, stage, isLoading } = useJobWatching({ projectId, jobId, isWatching, onJobUpdate });
|
|
30
|
+
const [time, setTime] = useState(DateTime.now());
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!isWatching) return;
|
|
33
|
+
const interval = setInterval(() => setTime(DateTime.now()), 1e3);
|
|
34
|
+
return () => {
|
|
35
|
+
clearInterval(interval);
|
|
36
|
+
};
|
|
37
|
+
}, []);
|
|
38
|
+
const isJobInProgress = job && ![JobStatus.COMPLETED, JobStatus.FAILED].includes(job.status);
|
|
39
|
+
const summary = job ? getJobSummary(job, time) : null;
|
|
40
|
+
const buildSummary = job && job.build ? getBuildSummary(job.build) : null;
|
|
41
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
|
|
42
|
+
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
|
|
43
|
+
/* @__PURE__ */ jsx(Title, { children: "Job Details" }),
|
|
44
|
+
isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }),
|
|
45
|
+
summary && job && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [
|
|
46
|
+
/* @__PURE__ */ jsx(StatusRow, { label: "ID", value: summary.id }),
|
|
47
|
+
/* @__PURE__ */ jsx(StatusRow, { label: "Name", value: job.project.name }),
|
|
48
|
+
/* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
|
|
49
|
+
/* @__PURE__ */ jsx(StatusRowLabel, { label: "Status" }),
|
|
50
|
+
/* @__PURE__ */ jsx(JobStatusSpinner, { status: job.status, showSpinner: isWatching && !!isJobInProgress })
|
|
51
|
+
] }),
|
|
52
|
+
/* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
|
|
53
|
+
/* @__PURE__ */ jsx(StatusRowLabel, { label: "Stage" }),
|
|
54
|
+
stage && /* @__PURE__ */ jsx(Text, { color: getStageColor(stage), children: `${stage}` })
|
|
55
|
+
] }),
|
|
56
|
+
/* @__PURE__ */ jsx(StatusRow, { label: "Version", value: summary.version }),
|
|
57
|
+
/* @__PURE__ */ jsx(StatusRow, { label: "Git Info", value: summary.gitInfo }),
|
|
58
|
+
/* @__PURE__ */ jsx(StatusRow, { label: "Platform", value: summary.platform }),
|
|
59
|
+
/* @__PURE__ */ jsx(StatusRow, { label: "Started At", value: summary.createdAt }),
|
|
60
|
+
/* @__PURE__ */ jsx(StatusRow, { label: "Runtime", value: summary.runtime })
|
|
61
|
+
] })
|
|
62
|
+
] }),
|
|
63
|
+
buildSummary && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, marginLeft: 3, borderStyle: "single", padding: 1, children: [
|
|
64
|
+
/* @__PURE__ */ jsx(Title, { children: "Build Details" }),
|
|
65
|
+
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [
|
|
66
|
+
/* @__PURE__ */ jsx(StatusRow, { label: "ID", value: buildSummary.id }),
|
|
67
|
+
/* @__PURE__ */ jsx(StatusRow, { label: "Platform", value: buildSummary.platform }),
|
|
68
|
+
/* @__PURE__ */ jsx(StatusRow, { label: "Type", value: buildSummary.type }),
|
|
69
|
+
/* @__PURE__ */ jsx(StatusRow, { label: "CMD", value: buildSummary.cmd })
|
|
70
|
+
] })
|
|
71
|
+
] })
|
|
72
|
+
] });
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export { JobStatusTable as J };
|
|
@@ -4,7 +4,7 @@ import { render } from 'ink';
|
|
|
4
4
|
import { P as Platform, C as CredentialsType, A as ApiKey, a as ApiKeyType, U as UserRole } from '../../../index-BB7X1Pqp.js';
|
|
5
5
|
import { g as getUserCredentials } from '../../../index-DOgF4dFK.js';
|
|
6
6
|
import 'react';
|
|
7
|
-
import { C as Command } from '../../../Command-
|
|
7
|
+
import { C as Command } from '../../../Command-BiB9MqbJ.js';
|
|
8
8
|
import 'ink-spinner';
|
|
9
9
|
import 'axios';
|
|
10
10
|
import 'crypto-js';
|
|
@@ -12,17 +12,17 @@ import 'uuid';
|
|
|
12
12
|
import 'luxon';
|
|
13
13
|
import '@inkjs/ui';
|
|
14
14
|
import '@tanstack/react-query';
|
|
15
|
-
import 'open';
|
|
16
|
-
import 'crypto';
|
|
17
15
|
import 'fs';
|
|
16
|
+
import 'yazl';
|
|
17
|
+
import 'crypto';
|
|
18
18
|
import 'readline-sync';
|
|
19
19
|
import 'node:readline';
|
|
20
20
|
import 'node:path';
|
|
21
21
|
import 'node:url';
|
|
22
22
|
import 'fast-glob';
|
|
23
|
-
import 'yazl';
|
|
24
23
|
import 'socket.io-client';
|
|
25
24
|
import 'isomorphic-git';
|
|
25
|
+
import 'open';
|
|
26
26
|
import 'qrcode';
|
|
27
27
|
import { R as RunWithSpinner } from '../../../RunWithSpinner-BVXNWGD3.js';
|
|
28
28
|
import 'string-length';
|