shipthis 0.1.34 → 0.1.36

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.
Files changed (105) hide show
  1. package/README.md +223 -80
  2. package/assets/markdown/agreement-update.md.ejs +12 -0
  3. package/assets/markdown/{android-success.md → android-success.md.ejs} +2 -2
  4. package/assets/markdown/{apikey-create.md → apikey-create.md.ejs} +4 -4
  5. package/assets/markdown/{create-google-play-game.md → create-google-play-game.md.ejs} +2 -2
  6. package/assets/markdown/{invite-service-account.md → invite-service-account.md.ejs} +1 -1
  7. package/assets/markdown/{ios-success.md → ios-success.md.ejs} +2 -2
  8. package/assets/markdown/{privacy-notification.md → privacy-notification.md.ejs} +1 -1
  9. package/assets/markdown/service-account-policy-wizard.md.ejs +26 -0
  10. package/assets/markdown/service-account-policy.md.ejs +30 -0
  11. package/assets/markdown/{ship-failure.md → ship-failure.md.ejs} +1 -1
  12. package/assets/markdown/{ship-success.md → ship-success.md.ejs} +2 -2
  13. package/dist/{AppleBundleIdDetails-By-sSGNl.js → AppleBundleIdDetails-pEVOUXTQ.js} +3 -4
  14. package/dist/{Command-VWMnGslo.js → Command-DhAVAdiI.js} +1 -2
  15. package/dist/{CommandGame-BSVPZzNl.js → CommandGame-C-oV-hb4.js} +2 -2
  16. package/dist/{Create-SR1Mq7BY.js → Create-Dg9ZlwEd.js} +1 -3
  17. package/dist/{GameStatus-1ntFyxEx.js → GameStatus-Dm9TqFfW.js} +9 -17
  18. package/dist/{Import-cedOWPDz.js → Import-BFNNkN-I.js} +2 -4
  19. package/dist/{JobLogTail-C_W8UAMg.js → JobLogTail-RTNIiAUk.js} +2 -5
  20. package/dist/{JobProgress-CI385G53.js → JobProgress-dFWcT0CQ.js} +16 -17
  21. package/dist/{JobStatusTable-CdbKtwJE.js → JobStatusTable-BlvMuWF7.js} +2 -4
  22. package/dist/{ProjectCredentialsTable-ZnuIfcDB.js → ProjectCredentialsTable-CMBnYLou.js} +2 -2
  23. package/dist/{UserCredentialsTable-DRkAYgEA.js → UserCredentialsTable-oxE3mDmE.js} +8 -10
  24. package/dist/{baseAppleCommand-CsO-_Yzn.js → baseAppleCommand-cnLvBz95.js} +1 -1
  25. package/dist/{baseGameAndroidCommand-CdjaAbNX.js → baseGameAndroidCommand-DUDYisYm.js} +1 -2
  26. package/dist/commands/apiKey/create.js +15 -16
  27. package/dist/commands/apiKey/list.js +6 -7
  28. package/dist/commands/apiKey/revoke.js +7 -8
  29. package/dist/commands/apple/apiKey/create.js +7 -8
  30. package/dist/commands/apple/apiKey/export.js +6 -7
  31. package/dist/commands/apple/apiKey/import.js +6 -7
  32. package/dist/commands/apple/apiKey/status.js +12 -13
  33. package/dist/commands/apple/certificate/create.js +7 -8
  34. package/dist/commands/apple/certificate/export.js +6 -7
  35. package/dist/commands/apple/certificate/import.js +6 -7
  36. package/dist/commands/apple/certificate/status.js +12 -13
  37. package/dist/commands/apple/login.js +12 -2
  38. package/dist/commands/apple/status.js +4 -5
  39. package/dist/commands/dashboard.js +11 -1
  40. package/dist/commands/game/android/apiKey/connect.js +9 -9
  41. package/dist/commands/game/android/apiKey/create.js +11 -11
  42. package/dist/commands/game/android/apiKey/export.js +7 -8
  43. package/dist/commands/game/android/apiKey/import.js +7 -8
  44. package/dist/commands/game/android/apiKey/invite.js +13 -4
  45. package/dist/commands/game/android/apiKey/policy.js +83 -0
  46. package/dist/commands/game/android/apiKey/status.js +7 -8
  47. package/dist/commands/game/android/keyStore/create.js +8 -9
  48. package/dist/commands/game/android/keyStore/export.js +6 -7
  49. package/dist/commands/game/android/keyStore/import.js +9 -10
  50. package/dist/commands/game/android/keyStore/status.js +6 -7
  51. package/dist/commands/game/android/status.js +12 -1
  52. package/dist/commands/game/build/download.js +4 -5
  53. package/dist/commands/game/build/list.js +5 -6
  54. package/dist/commands/game/create.js +12 -2
  55. package/dist/commands/game/details.js +4 -5
  56. package/dist/commands/game/export.js +12 -1
  57. package/dist/commands/game/ios/app/addTester.js +11 -12
  58. package/dist/commands/game/ios/app/create.js +4 -5
  59. package/dist/commands/game/ios/app/status.js +7 -8
  60. package/dist/commands/game/ios/app/sync.js +5 -6
  61. package/dist/commands/game/ios/profile/create.js +7 -8
  62. package/dist/commands/game/ios/profile/export.js +6 -7
  63. package/dist/commands/game/ios/profile/import.js +6 -7
  64. package/dist/commands/game/ios/profile/status.js +6 -7
  65. package/dist/commands/game/ios/status.js +9 -10
  66. package/dist/commands/game/ios/wizard.js +5 -6
  67. package/dist/commands/game/job/list.js +4 -5
  68. package/dist/commands/game/job/status.js +7 -8
  69. package/dist/commands/game/list.js +11 -10
  70. package/dist/commands/game/ship.js +18 -13
  71. package/dist/commands/game/status.js +6 -7
  72. package/dist/commands/game/wizard.js +19 -19
  73. package/dist/commands/internal/fastlane.js +12 -1
  74. package/dist/commands/internal/readme.js +12 -715
  75. package/dist/commands/login.js +26 -4
  76. package/dist/commands/status.js +12 -14
  77. package/dist/{export-B5Yfd9vw.js → export-Bd552LBe.js} +1 -1
  78. package/dist/{import-A2WcStHl.js → import-D-EL9sQJ.js} +1 -1
  79. package/dist/{index-CgzANgJt.js → index-1H48f5j2.js} +1 -1
  80. package/dist/index-BtPf4vzY.js +1903 -0
  81. package/dist/{index-Bz1qt_8T.js → index-DCN43FhY.js} +5 -11
  82. package/dist/{index-BBLtvl1Y.js → index-DwATmUTQ.js} +57 -16
  83. package/dist/{upload-BIsFZzBO.js → upload-Dm38PqhN.js} +1 -1
  84. package/dist/{useAppleApp-BZR94exU.js → useAppleApp-BKPntZPm.js} +1 -1
  85. package/dist/{useAppleBundleId-Dg5DsItN.js → useAppleBundleId-DvQKEEy4.js} +1 -1
  86. package/dist/useGoogleStatus-D9jjGa--.js +9 -0
  87. package/dist/{useProjectCredentials-jQYGcDhT.js → useProjectCredentials-BjsS28hP.js} +12 -11
  88. package/dist/{useWebSocket-CIxkPaYi.js → useWebSocket-CIeyHqxG.js} +1 -1
  89. package/docs/README.md +3 -2
  90. package/docs/apiKey.md +12 -2
  91. package/docs/assets/st.png +0 -0
  92. package/docs/game/android/apiKey/policy.md +28 -0
  93. package/docs/game/android/keyStore.md +14 -4
  94. package/docs/game/android/status.md +4 -0
  95. package/docs/game/android.md +9 -305
  96. package/docs/game/ship.md +43 -11
  97. package/docs/game.md +7 -1
  98. package/docs/login.md +6 -2
  99. package/docs/status.md +1 -1
  100. package/package.json +10 -2
  101. package/dist/index-CA6-uLMn.js +0 -221
  102. package/dist/index-CO_ssVFA.js +0 -772
  103. package/dist/index-CYjZ26If.js +0 -153
  104. package/dist/useAndroidServiceAccountTestResult-DueKynFy.js +0 -50
  105. /package/assets/markdown/{create-or-import-keystore.md → create-or-import-keystore.md.ejs} +0 -0
@@ -1,221 +0,0 @@
1
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
- import { useStdin, useInput, Text, Box } from 'ink';
3
- import Spinner from 'ink-spinner';
4
- import open from 'open';
5
- import React, { useState, useEffect, useContext, useRef } from 'react';
6
- import { P as Platform, a9 as getShortDateTime, p as getAuthedHeaders, o as API_URL, I as castArrayObjectDates, J as JobStatus, aa as getShortTimeDelta, z as getJob, E as getProject, a5 as getShortAuthRequiredUrl, K as queryClient, ab as BuildType, W as WEB_URL } from './index-CO_ssVFA.js';
7
- import { h as getPlatformName, g as getShortUUID, s as scriptDir } from './index-CYjZ26If.js';
8
- import { useQuery } from '@tanstack/react-query';
9
- import axios from 'axios';
10
- import { c as cacheKeys, u as useAndroidServiceAccountTestResult, K as KeyTestStatus, a as KeyTestError } from './useAndroidServiceAccountTestResult-DueKynFy.js';
11
- import 'luxon';
12
- import fs__default from 'node:fs';
13
- import 'fast-glob';
14
- import 'uuid';
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';
22
- import { setOptions, parse } from 'marked';
23
- import TerminalRenderer from 'marked-terminal';
24
- import 'qrcode';
25
-
26
- async function queryBuilds({ projectId, ...pageAndSortParams }) {
27
- try {
28
- const headers = getAuthedHeaders();
29
- const url = `${API_URL}/projects/${projectId}/builds`;
30
- const response = await axios.get(url, { headers, params: pageAndSortParams });
31
- return {
32
- ...response.data,
33
- data: castArrayObjectDates(response.data.data)
34
- };
35
- } catch (error) {
36
- console.warn("queryBuilds Error", error);
37
- throw error;
38
- }
39
- }
40
- function getBuildSummary(build) {
41
- const ext = build.buildType || (build.platform === Platform.IOS ? "IPA" : "AAB");
42
- const filename = `game.${ext.toLowerCase()}`;
43
- return {
44
- id: getShortUUID(build.id),
45
- jobId: getShortUUID(build.jobId),
46
- ...getJobDetailsSummary(build.jobDetails),
47
- cmd: `shipthis game build download ${getShortUUID(build.id)} ${filename}`,
48
- createdAt: getShortDateTime(build.createdAt),
49
- type: `${getPlatformName(build.platform)} ${build.buildType || ""}`.trim()
50
- };
51
- }
52
- const useBuilds = (props) => {
53
- const queryResult = useQuery({
54
- queryFn: async () => queryBuilds(props),
55
- queryKey: cacheKeys.builds(props)
56
- });
57
- return queryResult;
58
- };
59
-
60
- function getJobDetailsSummary(jobDetails) {
61
- const semanticVersion = jobDetails?.semanticVersion || "N/A";
62
- const buildNumber = jobDetails?.buildNumber || "N/A";
63
- const gitCommit = jobDetails?.gitCommitHash ? getShortUUID(jobDetails?.gitCommitHash) : "";
64
- const gitBranch = jobDetails?.gitBranch || "";
65
- return {
66
- gitInfo: gitCommit ? `${gitCommit} (${gitBranch})` : "",
67
- version: `${semanticVersion} (${buildNumber})`
68
- };
69
- }
70
- function getJobSummary(job, timeNow) {
71
- const inProgress = ![JobStatus.COMPLETED, JobStatus.FAILED].includes(job.status);
72
- return {
73
- id: getShortUUID(job.id),
74
- ...getJobDetailsSummary(job.details),
75
- createdAt: getShortDateTime(job.createdAt),
76
- platform: getPlatformName(job.type),
77
- runtime: getShortTimeDelta(job.createdAt, inProgress ? timeNow : job.updatedAt),
78
- status: job.status
79
- };
80
- }
81
- const useJob = (props) => useQuery({
82
- queryFn: () => getJob(props.jobId, props.projectId),
83
- queryKey: cacheKeys.job(props)
84
- });
85
-
86
- const useSafeInput = (handler, options = { isActive: true }) => {
87
- const { isRawModeSupported } = useStdin();
88
- const isActive = isRawModeSupported === true && options.isActive !== false;
89
- useInput(
90
- (input, key) => {
91
- const lowerInput = input.toLowerCase();
92
- return handler(lowerInput, key);
93
- },
94
- { isActive }
95
- );
96
- };
97
-
98
- const cleanHyperlinks = (input) => (
99
- // When we run in a <ScrollArea> the links break
100
- // Remove OSC 8 hyperlink wrappers but preserve the styled content inside
101
- input.replaceAll(/\u001B]8;;[^\u0007]*\u0007/g, "").replaceAll("\x1B]8;;\x07", "")
102
- );
103
- const getRenderedMarkdown = ({ filename, templateVars, ...options }) => {
104
- setOptions({
105
- renderer: new TerminalRenderer({
106
- ...options
107
- })
108
- });
109
- const entrypointPath = fs__default.realpathSync(process.argv[1]);
110
- const root = path.dirname(entrypointPath);
111
- const mdPath = path.join(root, "..", "assets", "markdown", filename);
112
- const mdTemplate = fs__default.readFileSync(mdPath, "utf8").trim();
113
- let markdown = mdTemplate;
114
- if (templateVars) {
115
- markdown = markdown.replaceAll(/\${if (.*?)}([\S\s]*?)\${endif}/g, (_, key, content) => templateVars[key.trim()] ? content : "");
116
- markdown = markdown.replaceAll(/\${(.*?)}/g, (_, key) => {
117
- const trimmed = key.trim();
118
- return templateVars[trimmed] ? String(templateVars[trimmed]) : "";
119
- });
120
- }
121
- const rendered = parse(markdown).trim();
122
- const cleaned = cleanHyperlinks(rendered);
123
- return cleaned;
124
- };
125
- const Markdown = ({ filename, templateVars, ...options }) => {
126
- const [text, setText] = useState("");
127
- useEffect(() => {
128
- const cleaned = getRenderedMarkdown({ filename, templateVars, ...options });
129
- setText(cleaned);
130
- }, [filename, templateVars, options]);
131
- return /* @__PURE__ */ jsx(Text, { children: text });
132
- };
133
-
134
- const CommandContext = React.createContext({
135
- command: null,
136
- setCommand(command) {
137
- }
138
- });
139
- const CommandProvider = (props) => {
140
- const [command, setCommand] = useState(props.command || null);
141
- return /* @__PURE__ */ jsx(CommandContext.Provider, { value: { command, setCommand }, children: props.children });
142
- };
143
-
144
- const GameContext = React.createContext({
145
- game: null,
146
- gameId: null,
147
- setGameId(gameId) {
148
- }
149
- });
150
- const GameProvider = ({ children }) => {
151
- const { command } = React.useContext(CommandContext);
152
- const [gameId, setGameId] = useState(command?.getGameId() || null);
153
- const [game, setGame] = useState(null);
154
- const handleGameIdChange = async () => {
155
- if (!gameId) {
156
- setGame(null);
157
- return;
158
- }
159
- const game2 = await getProject(gameId);
160
- setGame(game2);
161
- };
162
- useEffect(() => {
163
- handleGameIdChange();
164
- }, [gameId]);
165
- return /* @__PURE__ */ jsx(GameContext.Provider, { value: { game, gameId, setGameId }, children });
166
- };
167
-
168
- scriptDir(import.meta);
169
- const getIsAppFound = (result) => {
170
- const isFound = result?.status === KeyTestStatus.SUCCESS || result?.status === KeyTestStatus.ERROR && result?.error === KeyTestError.NOT_INVITED;
171
- return isFound;
172
- };
173
- const CreateGooglePlayGame = (props) => {
174
- const { gameId } = useContext(GameContext);
175
- return /* @__PURE__ */ jsx(Fragment, { children: gameId && /* @__PURE__ */ jsx(Create, { gameId, ...props }) });
176
- };
177
- const Create = ({ gameId, onComplete, onError, ...boxProps }) => {
178
- const { data: result, isFetching } = useAndroidServiceAccountTestResult({ projectId: gameId });
179
- const { data: builds } = useBuilds({ pageNumber: 0, projectId: gameId });
180
- const previousIsFound = useRef(false);
181
- useEffect(() => {
182
- const isFound = getIsAppFound(result);
183
- if (previousIsFound.current === false && isFound) {
184
- onComplete();
185
- }
186
- previousIsFound.current = isFound;
187
- }, [result]);
188
- useSafeInput(async (input) => {
189
- if (!gameId) return;
190
- switch (input) {
191
- case "r": {
192
- queryClient.invalidateQueries({
193
- queryKey: cacheKeys.androidKeyTestResult({ projectId: gameId })
194
- });
195
- break;
196
- }
197
- case "d": {
198
- const dashUrl = await getShortAuthRequiredUrl(`/games/${getShortUUID(gameId)}/builds`);
199
- await open(dashUrl);
200
- break;
201
- }
202
- }
203
- });
204
- const initialBuild = builds?.data.find(
205
- (build) => build.platform === Platform.ANDROID && build.buildType === BuildType.AAB
206
- );
207
- const downloadCmd = initialBuild ? `${getBuildSummary(initialBuild).cmd}` : "Initial AAB build not found!";
208
- const templateVars = {
209
- dashboardURL: new URL(`/games/${getShortUUID(gameId)}/builds`, WEB_URL).toString(),
210
- downloadCmd
211
- };
212
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: 1, ...boxProps, children: [
213
- /* @__PURE__ */ jsxs(Box, { flexDirection: "row", gap: 1, children: [
214
- /* @__PURE__ */ jsx(Text, { bold: true, children: isFetching ? "Checking..." : "ShipThis has not detected your game in Google Play. Press R to test again." }),
215
- isFetching && /* @__PURE__ */ jsx(Spinner, { type: "dots" })
216
- ] }),
217
- /* @__PURE__ */ jsx(Markdown, { filename: "create-google-play-game.md", templateVars })
218
- ] }) });
219
- };
220
-
221
- export { CommandContext as C, GameContext as G, Markdown as M, getJobSummary as a, CommandProvider as b, GameProvider as c, getBuildSummary as d, useSafeInput as e, useJob as f, getRenderedMarkdown as g, CreateGooglePlayGame as h, queryBuilds as q, useBuilds as u };