shipthis 0.1.11 → 0.1.13

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 (190) hide show
  1. package/assets/markdown/ship-failure.md +13 -0
  2. package/assets/markdown/ship-success.md +12 -0
  3. package/dist/{AppleBundleIdDetails-DymjrhOZ.js → AppleBundleIdDetails-DxWVnxa5.js} +4 -4
  4. package/dist/{Command-1YAl_0zS.js → Command-zfJ7qIJI.js} +8 -8
  5. package/dist/{CommandGame--SAa3wEL.js → CommandGame-DVsNreSF.js} +1 -1
  6. package/dist/{Create-DIaSKUpl.js → Create-DdF29mIS.js} +3 -3
  7. package/dist/{Import-BIOsf8AA.js → Import-D8ik724M.js} +4 -4
  8. package/dist/{JobProgress-biiLhigg.js → JobProgress-D1Pe4YJc.js} +10 -7
  9. package/dist/JobStatusTable-D-daiV-I.js +203 -0
  10. package/dist/{ProjectCredentialsTable-Ch8022rs.js → ProjectCredentialsTable-Ch2s5qF1.js} +2 -2
  11. package/dist/{UserCredentialsTable-CeJS3_hd.js → UserCredentialsTable-DzyAHhLB.js} +3 -3
  12. package/dist/{baseAppleCommand-1isaFxCQ.js → baseAppleCommand-BGXyWK-R.js} +1 -1
  13. package/dist/{baseGameAndroidCommand-6vsMpE7a.js → baseGameAndroidCommand-mdFhxanf.js} +2 -2
  14. package/dist/commands/apple/apiKey/create.js +7 -7
  15. package/dist/commands/apple/apiKey/export.js +6 -6
  16. package/dist/commands/apple/apiKey/import.js +6 -6
  17. package/dist/commands/apple/apiKey/status.js +5 -5
  18. package/dist/commands/apple/certificate/create.js +7 -7
  19. package/dist/commands/apple/certificate/export.js +6 -6
  20. package/dist/commands/apple/certificate/import.js +6 -6
  21. package/dist/commands/apple/certificate/status.js +5 -5
  22. package/dist/commands/apple/login.js +2 -2
  23. package/dist/commands/apple/status.js +4 -4
  24. package/dist/commands/dashboard.js +1 -1
  25. package/dist/commands/game/android/apiKey/connect.js +9 -9
  26. package/dist/commands/game/android/apiKey/create.js +10 -10
  27. package/dist/commands/game/android/apiKey/export.js +7 -7
  28. package/dist/commands/game/android/apiKey/import.js +9 -9
  29. package/dist/commands/game/android/apiKey/invite.js +4 -4
  30. package/dist/commands/game/android/apiKey/status.js +7 -7
  31. package/dist/commands/game/android/keyStore/create.js +8 -8
  32. package/dist/commands/game/android/keyStore/export.js +6 -6
  33. package/dist/commands/game/android/keyStore/import.js +9 -9
  34. package/dist/commands/game/android/keyStore/status.js +6 -6
  35. package/dist/commands/game/android/status.js +4 -4
  36. package/dist/commands/game/build/download.js +4 -4
  37. package/dist/commands/game/build/list.js +5 -5
  38. package/dist/commands/game/create.js +2 -2
  39. package/dist/commands/game/details.js +4 -4
  40. package/dist/commands/game/export.js +1 -1
  41. package/dist/commands/game/ios/app/addTester.js +5 -5
  42. package/dist/commands/game/ios/app/create.js +4 -4
  43. package/dist/commands/game/ios/app/status.js +7 -7
  44. package/dist/commands/game/ios/app/sync.js +5 -5
  45. package/dist/commands/game/ios/profile/create.js +7 -7
  46. package/dist/commands/game/ios/profile/export.js +6 -6
  47. package/dist/commands/game/ios/profile/import.js +6 -6
  48. package/dist/commands/game/ios/profile/status.js +6 -6
  49. package/dist/commands/game/ios/status.js +7 -7
  50. package/dist/commands/game/ios/wizard.js +2 -2
  51. package/dist/commands/game/job/list.js +4 -4
  52. package/dist/commands/game/job/status.js +17 -131
  53. package/dist/commands/game/list.js +4 -4
  54. package/dist/commands/game/ship.js +74 -19
  55. package/dist/commands/game/status.js +4 -4
  56. package/dist/commands/game/wizard.js +14 -14
  57. package/dist/commands/internal/fastlane.js +1 -1
  58. package/dist/commands/internal/readme.js +1 -1
  59. package/dist/commands/login.js +2 -2
  60. package/dist/commands/status.js +4 -4
  61. package/dist/{export-BDxGDZdh.js → export-Cin4rLWR.js} +1 -1
  62. package/dist/{import-v54PM_Qg.js → import-CXTv9E84.js} +1 -1
  63. package/dist/{index-BDFKyTPb.js → index-B4v66AKo.js} +1 -1
  64. package/dist/{index-ByOvCs4O.js → index-BVvcTBnj.js} +4 -4
  65. package/dist/{index-m4HTrJ5J.js → index-Cx_2qTdS.js} +7 -7
  66. package/dist/{index-BB7X1Pqp.js → index-Dhx6FAHt.js} +1 -1
  67. package/dist/{index-wyPoxiTc.js → index-Dj-chiHz.js} +2 -2
  68. package/dist/{upload-2naN75Zu.js → upload-DZCIfnwf.js} +1 -1
  69. package/dist/{useAndroidServiceAccountTestResult-BDc7XpKE.js → useAndroidServiceAccountTestResult-L4oozjag.js} +1 -1
  70. package/dist/{useAppleApp-DgE0wEaq.js → useAppleApp-DcSr-q-w.js} +1 -1
  71. package/dist/{useAppleBundleId-BNI8swhC.js → useAppleBundleId-BnJVPVIz.js} +1 -1
  72. package/dist/{useJobWatching-BIG6fnTN.js → useJobWatching-DS0qHqPA.js} +3 -3
  73. package/dist/{useProjectCredentials-B5ZmpIxL.js → useProjectCredentials-CI_AoXmH.js} +3 -3
  74. package/dist/{useWebSocket-Bep1zAVG.js → useWebSocket-ZEZvtpT_.js} +1 -1
  75. package/npm-shrinkwrap.json +2 -2
  76. package/oclif.manifest.json +141 -223
  77. package/package.json +1 -1
  78. package/dist/AppleBundleIdDetails-C0XqjxKJ.js +0 -72
  79. package/dist/AppleBundleIdDetails-CjP5y0cj.js +0 -74
  80. package/dist/AppleBundleIdDetails-CztWY_mT.js +0 -73
  81. package/dist/AppleBundleIdDetails-DKeSAte9.js +0 -73
  82. package/dist/AppleBundleIdDetails-Df30MPFC.js +0 -73
  83. package/dist/AppleBundleIdDetails-Dxo99Sgu.js +0 -72
  84. package/dist/Command-BiB9MqbJ.js +0 -204
  85. package/dist/Command-Cl-JfhTy.js +0 -203
  86. package/dist/Command-D6rWEZRM.js +0 -204
  87. package/dist/Command-Dn0P_KOV.js +0 -205
  88. package/dist/Command-DxmQn3XT.js +0 -204
  89. package/dist/Command-YJJp90ru.js +0 -204
  90. package/dist/CommandGame-C1oTlfdb.js +0 -8
  91. package/dist/CommandGame-CZUx_VQu.js +0 -8
  92. package/dist/CommandGame-DspVLTPZ.js +0 -8
  93. package/dist/CommandGame-cPaTk1wh.js +0 -8
  94. package/dist/CommandGame-k04mHiDl.js +0 -8
  95. package/dist/CommandGame-pI9VXKxi.js +0 -8
  96. package/dist/CreateKeystore-BnNdeDUa.js +0 -57
  97. package/dist/CreateKeystore-BqJdpvsI.js +0 -56
  98. package/dist/CreateKeystore-Cf-nsK_M.js +0 -56
  99. package/dist/CreateKeystore-D8uTRamD.js +0 -56
  100. package/dist/CreateKeystore-Dm0KVh85.js +0 -56
  101. package/dist/CreateKeystore-g1z6DsU5.js +0 -56
  102. package/dist/JobProgress-CPkWVSlH.js +0 -108
  103. package/dist/JobProgress-Dk0UoNah.js +0 -108
  104. package/dist/JobProgress-W0QQR49T.js +0 -108
  105. package/dist/JobProgress-jmGAzvxS.js +0 -108
  106. package/dist/JobStatusTable-BA_q-kgE.js +0 -75
  107. package/dist/JobStatusTable-ByW0bN6c.js +0 -75
  108. package/dist/JobStatusTable-CgaTS7jS.js +0 -75
  109. package/dist/JobStatusTable-DqoppRro.js +0 -75
  110. package/dist/JobStatusTable-q4atKzhu.js +0 -75
  111. package/dist/ProjectCredentialsTable-8kXt7sTS.js +0 -37
  112. package/dist/ProjectCredentialsTable-BIWBAXCh.js +0 -37
  113. package/dist/ProjectCredentialsTable-DRMK_SNw.js +0 -37
  114. package/dist/ProjectCredentialsTable-DfkpvTf8.js +0 -37
  115. package/dist/UserCredentialsTable-DMh8Wpy7.js +0 -82
  116. package/dist/UserCredentialsTable-DgHZJSHG.js +0 -82
  117. package/dist/UserCredentialsTable-TflQvTEP.js +0 -82
  118. package/dist/UserCredentialsTable-ysmM5dlV.js +0 -82
  119. package/dist/baseAppleCommand-B3WQtlx-.js +0 -10
  120. package/dist/baseAppleCommand-B9wyIqdL.js +0 -10
  121. package/dist/baseAppleCommand-D-G4h8zQ.js +0 -10
  122. package/dist/baseAppleCommand-DpasCbje.js +0 -10
  123. package/dist/baseGameAndroidCommand-B-CFhPnE.js +0 -43
  124. package/dist/baseGameAndroidCommand-B3LRG701.js +0 -43
  125. package/dist/baseGameAndroidCommand-C9BuS2Sr.js +0 -43
  126. package/dist/baseGameAndroidCommand-DD0H8iy-.js +0 -43
  127. package/dist/commands/game/android/wizard.js +0 -509
  128. package/dist/export-B_F6vXIK.js +0 -36
  129. package/dist/export-BiLHgSJ9.js +0 -36
  130. package/dist/export-C_lu1FD9.js +0 -36
  131. package/dist/export-rS9o87LD.js +0 -36
  132. package/dist/import-7T3J63j2.js +0 -38
  133. package/dist/import-Brg3zYmT.js +0 -38
  134. package/dist/import-BrlJuE2Z.js +0 -38
  135. package/dist/import-CxNikF1c.js +0 -38
  136. package/dist/import-DPbg8WvS.js +0 -38
  137. package/dist/index-B5XHQfs2.js +0 -122
  138. package/dist/index-B6V7vGOj.js +0 -136
  139. package/dist/index-BL-1G60K.js +0 -135
  140. package/dist/index-BQRxiyqn.js +0 -693
  141. package/dist/index-BQnkBr1Q.js +0 -136
  142. package/dist/index-BX9h2vPV.js +0 -123
  143. package/dist/index-BjGSEqP5.js +0 -135
  144. package/dist/index-BuZmCvZh.js +0 -24
  145. package/dist/index-Bv3x8c78.js +0 -693
  146. package/dist/index-BzffuqPa.js +0 -24
  147. package/dist/index-C9734Cj2.js +0 -693
  148. package/dist/index-CKYExssR.js +0 -136
  149. package/dist/index-CgBgZUkL.js +0 -144
  150. package/dist/index-Cz_KLwWf.js +0 -136
  151. package/dist/index-D6BH5UAM.js +0 -135
  152. package/dist/index-DBrQda8r.js +0 -122
  153. package/dist/index-DE2Hvx2o.js +0 -122
  154. package/dist/index-DOgF4dFK.js +0 -24
  155. package/dist/index-DdABTtYO.js +0 -693
  156. package/dist/index-DgbQBx6x.js +0 -122
  157. package/dist/index-DxHPjZav.js +0 -136
  158. package/dist/index-X__XH_Fd.js +0 -144
  159. package/dist/index-o9Y-84Rj.js +0 -122
  160. package/dist/upload-CMo3hUhl.js +0 -60
  161. package/dist/upload-Cx71802W.js +0 -60
  162. package/dist/upload-DvAE1vDq.js +0 -60
  163. package/dist/upload-LXRr4pMa.js +0 -60
  164. package/dist/useAndroidServiceAccountTestResult-B_ekRewZ.js +0 -52
  165. package/dist/useAndroidServiceAccountTestResult-Ce1x0Eh8.js +0 -52
  166. package/dist/useAndroidServiceAccountTestResult-D_30xIJA.js +0 -52
  167. package/dist/useAndroidServiceAccountTestResult-InDf5WSl.js +0 -52
  168. package/dist/useAppleApp-BEtLQa7n.js +0 -32
  169. package/dist/useAppleApp-CApC0-4Q.js +0 -32
  170. package/dist/useAppleApp-CETIcsJS.js +0 -32
  171. package/dist/useAppleApp-DnSjUfSs.js +0 -32
  172. package/dist/useAppleBundleId-DXbMDRLd.js +0 -64
  173. package/dist/useAppleBundleId-DtLODy3p.js +0 -64
  174. package/dist/useAppleBundleId-SmzY6rkm.js +0 -64
  175. package/dist/useAppleBundleId-gPBzJwQg.js +0 -64
  176. package/dist/useJobWatching-BcBJ5dy1.js +0 -43
  177. package/dist/useJobWatching-Bz1e6xOv.js +0 -43
  178. package/dist/useJobWatching-Cp-CYd90.js +0 -45
  179. package/dist/useJobWatching-D-YzSlK8.js +0 -45
  180. package/dist/useJobWatching-I_A3b36f.js +0 -45
  181. package/dist/useJobWatching-P5oC7mNB.js +0 -45
  182. package/dist/useProjectCredentials-BRffcsO3.js +0 -54
  183. package/dist/useProjectCredentials-CKngz2rd.js +0 -54
  184. package/dist/useProjectCredentials-EapDge1I.js +0 -54
  185. package/dist/useProjectCredentials-vjedBbKl.js +0 -54
  186. package/dist/useWebSocket-CBqsjHbt.js +0 -36
  187. package/dist/useWebSocket-D8PojLtx.js +0 -36
  188. package/dist/useWebSocket-DoImIdTy.js +0 -36
  189. package/dist/useWebSocket-rBLiZsKb.js +0 -36
  190. package/dist/wizard-ChPegnMW.js +0 -133
@@ -1,693 +0,0 @@
1
- import path from 'path';
2
- import fs__default from 'fs';
3
- import { Command, Flags } from '@oclif/core';
4
- import * as expo from '@expo/apple-utils/build/index.js';
5
- import axios from 'axios';
6
- import CryptoJS from 'crypto-js';
7
- import { v4 } from 'uuid';
8
- import { DateTime } from 'luxon';
9
- import 'crypto';
10
- import 'readline-sync';
11
- import 'node:readline';
12
- import 'node:path';
13
- import 'node:url';
14
- import 'react';
15
- import { QueryClient } from '@tanstack/react-query';
16
- import { parse } from 'ini';
17
- import merge from 'deepmerge';
18
- import 'fast-glob';
19
- import 'yazl';
20
- import 'socket.io-client';
21
- import 'isomorphic-git';
22
-
23
- const defaultExport = expo.default;
24
- const {
25
- ApiKey,
26
- ApiKeyType,
27
- App,
28
- Auth,
29
- BundleId,
30
- CapabilityType,
31
- CapabilityTypeOption,
32
- Certificate,
33
- CertificateType,
34
- Profile,
35
- ProfileType,
36
- Session,
37
- UserRole,
38
- BetaGroup
39
- } = defaultExport;
40
-
41
- const DEFAULT_SHIPPED_FILES_GLOBS = ["**/*"];
42
- const DEFAULT_IGNORED_FILES_GLOBS = [".git", ".gitignore", "shipthis.json", "shipthis-*.zip"];
43
- const PRIMARY_DOMAIN = "shipthis.cc";
44
- function getUrlsForDomain(domain) {
45
- const isPublic = domain.includes(PRIMARY_DOMAIN);
46
- const apiDomain = (isPublic ? `api.` : "") + domain;
47
- const wsDomain = (isPublic ? `ws.` : "") + domain;
48
- return {
49
- api: `https://${apiDomain}/api/1.0.0`,
50
- ws: `wss://${wsDomain}`,
51
- web: `https://${domain}/`
52
- };
53
- }
54
- const DOMAIN_ENV_VAR_NAME = "SHIPTHIS_DOMAIN";
55
- const DOMAIN = process.env[DOMAIN_ENV_VAR_NAME] || PRIMARY_DOMAIN;
56
- const BACKEND_URLS = getUrlsForDomain(DOMAIN);
57
- const API_URL = BACKEND_URLS.api;
58
- const WS_URL = BACKEND_URLS.ws;
59
- const WEB_URL = BACKEND_URLS.web;
60
-
61
- const DEFAULT_LOCALE = "en-US";
62
- function castObjectDates(apiObject, keys = ["createdAt", "updatedAt"]) {
63
- if (!apiObject) return apiObject;
64
- const datesOnly = Object.keys(apiObject).filter((k) => keys.includes(k)).reduce((a, c) => {
65
- a[c] = DateTime.fromISO(apiObject[c]);
66
- return a;
67
- }, {});
68
- return {
69
- ...apiObject,
70
- ...datesOnly
71
- };
72
- }
73
- function castArrayObjectDates(apiArray, keys = ["createdAt", "updatedAt"]) {
74
- return apiArray.map((apiObject) => castObjectDates(apiObject, keys));
75
- }
76
- function castJobDates(jobObject) {
77
- if (jobObject.build) return castObjectDates({ ...jobObject, build: castObjectDates(jobObject.build) });
78
- return castObjectDates(jobObject);
79
- }
80
- function getDateLocale() {
81
- const fallback = Intl.DateTimeFormat().resolvedOptions().locale.replace(/_/g, "-") || DEFAULT_LOCALE;
82
- try {
83
- const env = process.env;
84
- const fullLocale = env.LC_TIME || env.LANG || env.LANGUAGE || env.LC_ALL || env.LC_MESSAGES;
85
- const shortLocale = fullLocale?.split(".")[0].replace(/_/g, "-");
86
- const finalLocal = shortLocale || fallback;
87
- const _ = DateTime.now().toLocaleString(DateTime.DATE_SHORT, { locale: finalLocal });
88
- return finalLocal;
89
- } catch (e) {
90
- return fallback;
91
- }
92
- }
93
- function getShortDate(inputDate) {
94
- const locale = getDateLocale();
95
- return inputDate.toLocaleString(DateTime.DATE_SHORT, { locale });
96
- }
97
- function getShortDateTime(inputDate, extraFormatOpts = {}) {
98
- const locale = getDateLocale();
99
- const formatOpts = { ...DateTime.DATETIME_SHORT, ...extraFormatOpts };
100
- return inputDate.toLocaleString(formatOpts, { locale });
101
- }
102
- function getShortTime(inputDate, extraFormatOpts = { fractionalSecondDigits: 3 }) {
103
- const locale = getDateLocale();
104
- const formatOpts = { ...DateTime.TIME_24_WITH_SECONDS, ...extraFormatOpts };
105
- return inputDate.toLocaleString(formatOpts, { locale });
106
- }
107
- function getShortTimeDelta(start, end) {
108
- return end.diff(start).rescale().set({ milliseconds: 0 }).shiftTo("minutes", "seconds").toHuman({
109
- listStyle: "short",
110
- unitDisplay: "short"
111
- });
112
- }
113
-
114
- const AUTH_ENV_VAR_NAME = "SHIPTHIS_TOKEN";
115
- function setAuthToken(token) {
116
- process.env[AUTH_ENV_VAR_NAME] = token;
117
- }
118
- function getAuthToken() {
119
- return process.env[AUTH_ENV_VAR_NAME];
120
- }
121
- function getAuthedHeaders() {
122
- return {
123
- Authorization: `Bearer ${process.env[AUTH_ENV_VAR_NAME]}`
124
- };
125
- }
126
- async function createProject(props) {
127
- const headers = getAuthedHeaders();
128
- const opt = { headers };
129
- const { data } = await axios.post(`${API_URL}/projects`, props, opt);
130
- return castObjectDates(data);
131
- }
132
- async function getProject(projectId) {
133
- const headers = getAuthedHeaders();
134
- const opt = { headers };
135
- const { data } = await axios.get(`${API_URL}/projects/${projectId}`, opt);
136
- return castObjectDates(data);
137
- }
138
- async function getProjects(params) {
139
- const headers = getAuthedHeaders();
140
- const opt = { headers, params };
141
- const { data: rawData } = await axios.get(`${API_URL}/projects`, opt);
142
- const data = castArrayObjectDates(rawData.data);
143
- return {
144
- data,
145
- pageCount: rawData.pageCount
146
- };
147
- }
148
- async function updateProject(projectId, edits) {
149
- const headers = getAuthedHeaders();
150
- const opt = { headers };
151
- const { data } = await axios.put(`${API_URL}/projects/${projectId}`, edits, opt);
152
- return castObjectDates(data);
153
- }
154
- async function getProjectPlatformProgress(projectId, platform) {
155
- const headers = getAuthedHeaders();
156
- const opt = { headers };
157
- const { data } = await axios.get(`${API_URL}/projects/${projectId}/${platform}/progress`, opt);
158
- return data;
159
- }
160
- async function getNewUploadTicket(projectId) {
161
- const headers = getAuthedHeaders();
162
- const opt = { headers };
163
- const { data } = await axios.post(`${API_URL}/upload/${projectId}/url`, {}, opt);
164
- return data;
165
- }
166
- async function startJobsFromUpload(uploadTicketId, uploadDetails) {
167
- const headers = getAuthedHeaders();
168
- const opt = { headers };
169
- const { data } = await axios.post(`${API_URL}/upload/start/${uploadTicketId}`, uploadDetails, opt);
170
- return castArrayObjectDates(data);
171
- }
172
- async function getProjectJobs(projectId, params) {
173
- const headers = getAuthedHeaders();
174
- const opt = { headers, params };
175
- const { data: rawData } = await axios.get(`${API_URL}/projects/${projectId}/jobs`, opt);
176
- const data = castArrayObjectDates(rawData.data);
177
- return {
178
- data,
179
- pageCount: rawData.pageCount
180
- };
181
- }
182
- async function getJob(jobId, projectId) {
183
- const headers = getAuthedHeaders();
184
- const opt = { headers };
185
- const { data } = await axios.get(`${API_URL}/projects/${projectId}/jobs/${jobId}`, opt);
186
- return castJobDates(data);
187
- }
188
- async function getSingleUseUrl(destination) {
189
- const headers = await getAuthedHeaders();
190
- const { data } = await axios.post(`${API_URL}/me/otp`, {}, { headers });
191
- const queryString = Object.entries({ ...data, destination }).map(([key, value]) => `${key}=${encodeURIComponent(`${value}`)}`).join("&");
192
- const url = `${WEB_URL}exchange/?${queryString}`;
193
- return url;
194
- }
195
- async function getShortAuthRequiredUrl(destination) {
196
- const { email } = await getSelf();
197
- const key = v4();
198
- const salt = "Na (s) + 1/2 Cl\u2082 (g) \u2192 NaCl (s)";
199
- const fullKey = `${key}${salt}`;
200
- const token = CryptoJS.AES.encrypt(email, fullKey).toString();
201
- const params = {
202
- key,
203
- token,
204
- destination
205
- };
206
- const queryString = Object.entries(params).map(([key2, value]) => `${key2}=${encodeURIComponent(`${value}`)}`).join("&");
207
- const url = `${WEB_URL}login/?${queryString}`;
208
- const headers = await getAuthedHeaders();
209
- const { data } = await axios.post(
210
- `${API_URL}/me/shorten`,
211
- {
212
- url
213
- },
214
- { headers }
215
- );
216
- return data.url;
217
- }
218
- async function getBuild(projectId, buildId) {
219
- const headers = getAuthedHeaders();
220
- const opt = { headers };
221
- const { data } = await axios.get(`${API_URL}/projects/${projectId}/builds/${buildId}`, opt);
222
- return castObjectDates(data);
223
- }
224
- async function getSelf() {
225
- const headers = getAuthedHeaders();
226
- const opt = { headers };
227
- const { data } = await axios.get(`${API_URL}/me`, opt);
228
- return castObjectDates(data);
229
- }
230
- async function acceptTerms() {
231
- const headers = getAuthedHeaders();
232
- const opt = { headers };
233
- const { data } = await axios.post(`${API_URL}/me/acceptTerms`, {}, opt);
234
- return castObjectDates(data);
235
- }
236
- async function getGoogleAuthUrl(projectId) {
237
- const headers = getAuthedHeaders();
238
- const opt = { headers };
239
- const web = encodeURIComponent(new URL("/google/redirect/", WEB_URL).href);
240
- const url = `${API_URL}/projects/${projectId}/credentials/android/key/connect`;
241
- const { data } = await axios.get(`${url}?redirectUri=${web}`, opt);
242
- const response = data;
243
- return await getShortAuthRequiredUrl(response.url);
244
- }
245
- async function disconnectGoogle() {
246
- const headers = getAuthedHeaders();
247
- const opt = { headers };
248
- await axios.delete(`${API_URL}/me/google/connect`, opt);
249
- }
250
- async function getGoogleStatus() {
251
- const headers = getAuthedHeaders();
252
- const opt = { headers };
253
- const { data } = await axios.get(`${API_URL}/me/google/status`, opt);
254
- return data;
255
- }
256
- async function inviteServiceAccount(projectId, developerId) {
257
- try {
258
- const headers = getAuthedHeaders();
259
- const { data } = await axios.post(
260
- `${API_URL}/projects/${projectId}/credentials/android/key/invite/`,
261
- { developerId },
262
- {
263
- headers
264
- }
265
- );
266
- return data;
267
- } catch (error) {
268
- console.error("inviteServiceAccount Error", error);
269
- throw error;
270
- }
271
- }
272
-
273
- var Platform = /* @__PURE__ */ ((Platform2) => {
274
- Platform2["IOS"] = "IOS";
275
- Platform2["ANDROID"] = "ANDROID";
276
- return Platform2;
277
- })(Platform || {});
278
- var GameEngine = /* @__PURE__ */ ((GameEngine2) => {
279
- GameEngine2["GODOT"] = "godot";
280
- return GameEngine2;
281
- })(GameEngine || {});
282
- var JobStatus = /* @__PURE__ */ ((JobStatus2) => {
283
- JobStatus2["PENDING"] = "PENDING";
284
- JobStatus2["PROCESSING"] = "PROCESSING";
285
- JobStatus2["COMPLETED"] = "COMPLETED";
286
- JobStatus2["FAILED"] = "FAILED";
287
- return JobStatus2;
288
- })(JobStatus || {});
289
- var JobStage = /* @__PURE__ */ ((JobStage2) => {
290
- JobStage2["SETUP"] = "SETUP";
291
- JobStage2["EXPORT"] = "EXPORT";
292
- JobStage2["CONFIGURE"] = "CONFIGURE";
293
- JobStage2["BUILD"] = "BUILD";
294
- JobStage2["PUBLISH"] = "PUBLISH";
295
- return JobStage2;
296
- })(JobStage || {});
297
- var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
298
- LogLevel2["INFO"] = "INFO";
299
- LogLevel2["WARN"] = "WARN";
300
- LogLevel2["ERROR"] = "ERROR";
301
- return LogLevel2;
302
- })(LogLevel || {});
303
- var CredentialsType = /* @__PURE__ */ ((CredentialsType2) => {
304
- CredentialsType2["CERTIFICATE"] = "CERTIFICATE";
305
- CredentialsType2["KEY"] = "KEY";
306
- return CredentialsType2;
307
- })(CredentialsType || {});
308
-
309
- const queryClient = new QueryClient({
310
- defaultOptions: {
311
- queries: {
312
- staleTime: 50
313
- }
314
- }
315
- });
316
-
317
- function isCWDGodotGame() {
318
- const cwd = process.cwd();
319
- const godotProject = path.join(cwd, "project.godot");
320
- return fs__default.existsSync(godotProject);
321
- }
322
- const GODOT_CAPABILITIES = [
323
- // TODO: how about capabilities from godot extensions
324
- { name: "Access WiFi", key: "capabilities/access_wifi", type: CapabilityType.ACCESS_WIFI },
325
- { name: "Push Notifications", key: "capabilities/push_notifications", type: CapabilityType.PUSH_NOTIFICATIONS }
326
- ];
327
- function getGodotProjectCapabilities(platform) {
328
- const exportPresets = getGodotExportPresets(platform);
329
- const options = exportPresets.options;
330
- const capabilities = [];
331
- for (const capability of GODOT_CAPABILITIES) {
332
- if (!(capability.key in options)) continue;
333
- if (`${options[capability.key]}`.toLocaleLowerCase() == "true") capabilities.push(capability.type);
334
- }
335
- return capabilities;
336
- }
337
- function getGodotProjectConfig() {
338
- const cwd = process.cwd();
339
- const projectGodotPath = path.join(cwd, "project.godot");
340
- const projectGodotContent = fs__default.readFileSync(projectGodotPath, "utf8");
341
- return parse(projectGodotContent);
342
- }
343
- function getGodotProjectName() {
344
- try {
345
- const projectGodotConfig = getGodotProjectConfig();
346
- return projectGodotConfig["application"]["config/name"];
347
- } catch (e) {
348
- return null;
349
- }
350
- }
351
- function getGodotAppleBundleIdentifier() {
352
- try {
353
- const preset = getGodotExportPresets(Platform.IOS);
354
- return preset.options["application/bundle_identifier"];
355
- } catch (e) {
356
- console.log(e);
357
- return null;
358
- }
359
- }
360
- function getGodotAndroidPackageName() {
361
- try {
362
- const preset = getGodotExportPresets(Platform.ANDROID);
363
- return preset.options["package/unique_name"];
364
- } catch (e) {
365
- console.log(e);
366
- return null;
367
- }
368
- }
369
- function getGodotVersion() {
370
- const projectGodotConfig = getGodotProjectConfig();
371
- if ("config/features" in projectGodotConfig["application"]) {
372
- const features = projectGodotConfig["application"]["config/features"];
373
- const match = features.match(/"(\d+\.\d+)"/);
374
- if (!match) throw new Error("Couldn't find Godot version in project.godot");
375
- return match[1];
376
- }
377
- return "3.6";
378
- }
379
- function getGodotExportPresets(platform) {
380
- const { warn } = console;
381
- let presetConfig = platform === Platform.IOS ? getBaseExportPresets_iOS() : getBaseExportPresets_Android();
382
- const cwd = process.cwd();
383
- const filename = "export_presets.cfg";
384
- const exportPresetsPath = path.join(cwd, filename);
385
- const isFound = fs__default.existsSync(exportPresetsPath);
386
- if (!isFound) {
387
- warn(`${filename} not found at ${exportPresetsPath}`);
388
- } else {
389
- const exportPresetsContent = fs__default.readFileSync(exportPresetsPath, "utf8");
390
- const exportPresetsIni = parse(exportPresetsContent);
391
- const presetIndexes = Object.keys(exportPresetsIni.preset);
392
- const presetIndex = presetIndexes.find((index) => {
393
- const current = exportPresetsIni.preset[index];
394
- return `${current.name}`.toUpperCase() === platform;
395
- });
396
- if (!presetIndex) {
397
- warn(`Preset ${platform} not found in ${filename} - will use defaults`);
398
- } else {
399
- presetConfig = merge(presetConfig, exportPresetsIni.preset[presetIndex]);
400
- }
401
- }
402
- return presetConfig;
403
- }
404
- function getBaseExportPresets_iOS() {
405
- return {
406
- name: "iOS",
407
- platform: "iOS",
408
- runnable: true,
409
- dedicated_server: false,
410
- custom_features: "",
411
- export_filter: "all_resources",
412
- include_filter: "",
413
- exclude_filter: "",
414
- export_path: "output",
415
- encryption_include_filters: "",
416
- encryption_exclude_filters: "",
417
- encrypt_pck: false,
418
- encrypt_directory: false,
419
- options: {
420
- "custom_template/debug": "",
421
- "custom_template/release": "",
422
- "architectures/arm64": true,
423
- "application/signature": "",
424
- "application/icon_interpolation": "4",
425
- "application/launch_screens_interpolation": "4",
426
- "application/export_project_only": true,
427
- "capabilities/access_wifi": false,
428
- "capabilities/push_notifications": false,
429
- "user_data/accessible_from_files_app": false,
430
- "user_data/accessible_from_itunes_sharing": false,
431
- "privacy/camera_usage_description": "",
432
- "privacy/camera_usage_description_localized": "{}",
433
- "privacy/microphone_usage_description": "",
434
- "privacy/microphone_usage_description_localized": "{}",
435
- "privacy/photolibrary_usage_description": "",
436
- "privacy/photolibrary_usage_description_localized": "{}",
437
- "icons/iphone_120x120": "",
438
- "icons/iphone_180x180": "",
439
- "icons/ipad_76x76": "",
440
- "icons/ipad_152x152": "",
441
- "icons/ipad_167x167": "",
442
- "icons/app_store_1024x1024": "",
443
- "icons/spotlight_40x40": "",
444
- "icons/spotlight_80x80": "",
445
- "icons/settings_58x58": "",
446
- "icons/settings_87x87": "",
447
- "icons/notification_40x40": "",
448
- "icons/notification_60x60": "",
449
- "storyboard/use_launch_screen_storyboard": true,
450
- "storyboard/image_scale_mode": "0",
451
- "storyboard/custom_image@2x": "",
452
- "storyboard/custom_image@3x": "",
453
- "storyboard/use_custom_bg_color": false,
454
- "storyboard/custom_bg_color": "Color(0, 0, 0, 1)",
455
- "landscape_launch_screens/iphone_2436x1125": "",
456
- "landscape_launch_screens/iphone_2208x1242": "",
457
- "landscape_launch_screens/ipad_1024x768": "",
458
- "landscape_launch_screens/ipad_2048x1536": "",
459
- "portrait_launch_screens/iphone_640x960": "",
460
- "portrait_launch_screens/iphone_640x1136": "",
461
- "portrait_launch_screens/iphone_750x1334": "",
462
- "portrait_launch_screens/iphone_1125x2436": "",
463
- "portrait_launch_screens/ipad_768x1024": "",
464
- "portrait_launch_screens/ipad_1536x2048": "",
465
- "portrait_launch_screens/iphone_1242x2208": "",
466
- "application/short_version": "1.0.0"
467
- // default version number
468
- }
469
- };
470
- }
471
- function getBaseExportPresets_Android() {
472
- return {
473
- name: "Android",
474
- platform: "Android",
475
- // TODO
476
- options: {
477
- // TODO
478
- }
479
- };
480
- }
481
-
482
- class BaseCommand extends Command {
483
- // add the --json flag
484
- static enableJsonFlag = false;
485
- // define flags that can be inherited by any command that extends BaseCommand
486
- static baseFlags = {};
487
- flags;
488
- args;
489
- async init() {
490
- process.on("SIGINT", () => process.exit(0));
491
- process.on("SIGTERM", () => process.exit(0));
492
- await super.init();
493
- const { args, flags } = await this.parse({
494
- flags: this.ctor.flags,
495
- baseFlags: super.ctor.baseFlags,
496
- enableJsonFlag: this.ctor.enableJsonFlag,
497
- args: this.ctor.args,
498
- strict: this.ctor.strict
499
- });
500
- this.flags = flags;
501
- this.args = args;
502
- if (this.hasAuthConfig()) await this.loadAuthConfig();
503
- }
504
- async catch(err) {
505
- return super.catch(err);
506
- }
507
- async finally(_) {
508
- return super.finally(_);
509
- }
510
- // Exposing it to the react components using the CommandContext
511
- getFlags() {
512
- return this.flags;
513
- }
514
- getAuthConfigPath() {
515
- return path.join(this.config.home, ".shipthis.auth.json");
516
- }
517
- hasAuthConfig() {
518
- const configPath = this.getAuthConfigPath();
519
- return fs__default.existsSync(configPath);
520
- }
521
- async getAuthConfig() {
522
- const baseConfig = {};
523
- const configPath = this.getAuthConfigPath();
524
- if (!fs__default.existsSync(configPath)) return baseConfig;
525
- const raw = await fs__default.promises.readFile(configPath, "utf8");
526
- const typesConfig = JSON.parse(raw);
527
- return {
528
- ...baseConfig,
529
- ...typesConfig
530
- };
531
- }
532
- async setAuthConfig(config) {
533
- const configPath = this.getAuthConfigPath();
534
- await fs__default.promises.writeFile(configPath, JSON.stringify(config, null, 2));
535
- }
536
- async loadAuthConfig() {
537
- const authConfig = await this.getAuthConfig();
538
- if (!authConfig.shipThisUser) {
539
- throw new Error("You must be logged in to use this command");
540
- }
541
- setAuthToken(authConfig.shipThisUser.jwt);
542
- }
543
- getProjectConfigPath() {
544
- return path.join(process.cwd(), "shipthis.json");
545
- }
546
- hasProjectConfig() {
547
- const configPath = this.getProjectConfigPath();
548
- return fs__default.existsSync(configPath);
549
- }
550
- async getProjectConfig() {
551
- if (!this.hasProjectConfig()) throw new Error("No project config found");
552
- return this.getProjectConfigSafe();
553
- }
554
- async getProjectConfigSafe() {
555
- if (!this.hasProjectConfig()) return {};
556
- const configPath = this.getProjectConfigPath();
557
- const raw = await fs__default.promises.readFile(configPath, "utf8");
558
- return JSON.parse(raw);
559
- }
560
- async setProjectConfig(config) {
561
- const configPath = this.getProjectConfigPath();
562
- await fs__default.promises.writeFile(configPath, JSON.stringify(config, null, 2));
563
- }
564
- async updateProjectConfig(update) {
565
- const config = await this.getProjectConfig();
566
- await this.setProjectConfig({ ...config, ...update });
567
- }
568
- // Used in baseGameCommand and the other commands that need to ensure that the CWD is a Godot project
569
- ensureWeAreInAProjectDir() {
570
- if (!isCWDGodotGame()) {
571
- this.error("No Godot project detected. Please run this from a godot project directory.", { exit: 1 });
572
- }
573
- if (!this.hasProjectConfig()) {
574
- this.error(
575
- 'No ShipThis config found. Please run `shipthis game create --name "Space Invaders"` to create a game.',
576
- { exit: 1 }
577
- );
578
- }
579
- }
580
- async refreshAppleAuthState() {
581
- const cookies = await this.getAppleCookies();
582
- const rerunMessage = "Please run shipthis apple login to authenticate with Apple.";
583
- if (!cookies) throw new Error(`No Apple cookies found. ${rerunMessage}`);
584
- const authState = await Auth.loginWithCookiesAsync(
585
- {
586
- cookies
587
- },
588
- {}
589
- );
590
- if (!authState) throw new Error(`Failed to refresh Apple auth state. ${rerunMessage}`);
591
- return authState;
592
- }
593
- // Tests the apple cookies
594
- async hasValidAppleAuthState() {
595
- try {
596
- await this.refreshAppleAuthState();
597
- return true;
598
- } catch (e) {
599
- return false;
600
- }
601
- }
602
- // Used in the apple commands to get the cookies from the auth file
603
- async getAppleCookies() {
604
- const authConfig = await this.getAuthConfig();
605
- if (!authConfig.appleCookies) return null;
606
- return authConfig.appleCookies;
607
- }
608
- async setAppleCookies(cookies) {
609
- const authConfig = await this.getAuthConfig();
610
- await this.setAuthConfig({ ...authConfig, appleCookies: cookies });
611
- }
612
- ensureWeHaveAppleCookies() {
613
- if (!this.hasAuthConfig()) {
614
- this.error("You must be authenticated with Apple in to use this command. Please run shipthis apple login", {
615
- exit: 1
616
- });
617
- }
618
- }
619
- // Returns the values of the flags in DetailsFlags
620
- // This is used to expose the flags to the Android Wizard
621
- getDetailsFlagsValues() {
622
- const keys = Object.keys(DetailsFlags);
623
- const values = {};
624
- for (const key of keys) {
625
- if (this.flags[key]) values[key] = this.flags[key];
626
- }
627
- return values;
628
- }
629
- async getGameId() {
630
- const { flags } = this;
631
- if (flags.gameId) return flags.gameId;
632
- const { project } = await this.getProjectConfigSafe();
633
- if (!project) return null;
634
- return project.id;
635
- }
636
- }
637
-
638
- class BaseAuthenticatedCommand extends BaseCommand {
639
- static flags = {};
640
- async init() {
641
- await super.init();
642
- if (!this.hasAuthConfig()) {
643
- this.error("No auth config found. Please run `shipthis login` to authenticate.", { exit: 1 });
644
- }
645
- const self = await getSelf();
646
- const accepted = !!self.details?.hasAcceptedTerms;
647
- if (!accepted) {
648
- this.error("You must accept the terms and conditions. Please run `shipthis login --force` to re-authenticate", {
649
- exit: 1
650
- });
651
- }
652
- }
653
- }
654
-
655
- class BaseGameCommand extends BaseAuthenticatedCommand {
656
- static flags = {
657
- ...BaseAuthenticatedCommand.flags,
658
- gameId: Flags.string({ char: "g", description: "The ID of the game" })
659
- };
660
- async getGame() {
661
- try {
662
- const gameId = await this.getGameId();
663
- if (!gameId) this.error("No game ID found.");
664
- return await getProject(gameId);
665
- } catch (e) {
666
- if (e?.response?.status === 404) {
667
- this.error("Game not found - please check you have access");
668
- } else throw e;
669
- }
670
- }
671
- async updateGame(update) {
672
- const project = await this.getGame();
673
- const projectUpdate = {
674
- ...project,
675
- ...update
676
- };
677
- const updatedProject = await updateProject(project.id, projectUpdate);
678
- await this.updateProjectConfig({ project: updatedProject });
679
- return updatedProject;
680
- }
681
- }
682
-
683
- const DetailsFlags = {
684
- name: Flags.string({ char: "n", description: "The name of the game" }),
685
- buildNumber: Flags.integer({ char: "b", description: "Set the build number" }),
686
- semanticVersion: Flags.string({ char: "s", description: "Set the semantic version" }),
687
- gameEngine: Flags.string({ char: "e", description: "Set the game engine" }),
688
- gameEngineVersion: Flags.string({ char: "v", description: "Set the game engine version" }),
689
- iosBundleId: Flags.string({ char: "i", description: "Set the iOS bundle ID" }),
690
- androidPackageName: Flags.string({ char: "a", description: "Set the Android package name" })
691
- };
692
-
693
- export { acceptTerms as $, ApiKey as A, BaseAuthenticatedCommand as B, CredentialsType as C, DetailsFlags as D, startJobsFromUpload as E, getProjectJobs as F, GODOT_CAPABILITIES as G, getProject as H, getBuild as I, castArrayObjectDates as J, JobStatus as K, JobStage as L, LogLevel as M, castJobDates as N, castObjectDates as O, Platform as P, getAuthToken as Q, getGodotAndroidPackageName as R, getGoogleStatus as S, inviteServiceAccount as T, UserRole as U, disconnectGoogle as V, WS_URL as W, BaseCommand as X, getSingleUseUrl as Y, WEB_URL as Z, setAuthToken as _, ApiKeyType as a, Auth as a0, getShortAuthRequiredUrl as a1, getGoogleAuthUrl as a2, getShortTime as a3, getJob as a4, getShortDateTime as a5, getShortTimeDelta as a6, queryClient as a7, getShortDate as b, BaseGameCommand as c, getGodotAppleBundleIdentifier as d, BundleId as e, App as f, getProjects as g, CapabilityTypeOption as h, BetaGroup as i, isCWDGodotGame as j, getProjectPlatformProgress as k, Certificate as l, CertificateType as m, Profile as n, ProfileType as o, getAuthedHeaders as p, API_URL as q, getGodotProjectCapabilities as r, CapabilityType as s, GameEngine as t, getGodotVersion as u, createProject as v, DEFAULT_IGNORED_FILES_GLOBS as w, DEFAULT_SHIPPED_FILES_GLOBS as x, getGodotProjectName as y, getNewUploadTicket as z };