shipthis 0.1.39 → 0.1.41

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 (89) hide show
  1. package/README.md +57 -0
  2. package/dist/{AppleBundleIdDetails-Ck7iAjMb.js → AppleBundleIdDetails-BJC7GCx_.js} +4 -3
  3. package/dist/{Command-C84QiOWP.js → Command-Cj6F5B5a.js} +2 -1
  4. package/dist/{CommandGame-CsM9GE5Q.js → CommandGame-CuvuH-z6.js} +2 -2
  5. package/dist/{Create-Dx1nEKmS.js → Create-pfGYcKu4.js} +2 -1
  6. package/dist/{GameStatus-B4WBgoLs.js → GameStatus-ZSe-qG3y.js} +2 -1
  7. package/dist/{Import-BC5XgwRT.js → Import-D046HBaF.js} +3 -2
  8. package/dist/{JobLogTail-mBXpeWMu.js → JobLogTail-Da8GuReK.js} +3 -2
  9. package/dist/{JobProgress-KZ6EkMFi.js → JobProgress-DltCQpzA.js} +3 -2
  10. package/dist/{JobStatusTable-BYIxTt0d.js → JobStatusTable-DVJjHw97.js} +3 -2
  11. package/dist/{ProjectCredentialsTable-DSy1YIWX.js → ProjectCredentialsTable-BJJz7W1P.js} +2 -2
  12. package/dist/{UserCredentialsTable-qNByRE84.js → UserCredentialsTable-CSynIVHU.js} +2 -1
  13. package/dist/{baseAppleCommand-CdROzhyU.js → baseAppleCommand-Aq-Eaw_K.js} +1 -1
  14. package/dist/baseCommand-CTn3KGH3.js +787 -0
  15. package/dist/{baseGameAndroidCommand-B21zS0MN.js → baseGameAndroidCommand-DRzVMKuG.js} +2 -1
  16. package/dist/{index-Cv-92xRd.js → baseGameCommand-8VL7xe-O.js} +18 -755
  17. package/dist/commands/apiKey/create.js +6 -5
  18. package/dist/commands/apiKey/list.js +6 -5
  19. package/dist/commands/apiKey/revoke.js +6 -5
  20. package/dist/commands/apple/apiKey/create.js +13 -12
  21. package/dist/commands/apple/apiKey/delete.js +7 -6
  22. package/dist/commands/apple/apiKey/export.js +14 -13
  23. package/dist/commands/apple/apiKey/import.js +14 -13
  24. package/dist/commands/apple/apiKey/status.js +13 -12
  25. package/dist/commands/apple/certificate/create.js +13 -12
  26. package/dist/commands/apple/certificate/delete.js +7 -6
  27. package/dist/commands/apple/certificate/export.js +14 -13
  28. package/dist/commands/apple/certificate/import.js +14 -13
  29. package/dist/commands/apple/certificate/status.js +13 -12
  30. package/dist/commands/apple/login.js +4 -3
  31. package/dist/commands/apple/status.js +13 -12
  32. package/dist/commands/dashboard.js +9 -8
  33. package/dist/commands/game/android/apiKey/connect.js +11 -10
  34. package/dist/commands/game/android/apiKey/create.js +13 -12
  35. package/dist/commands/game/android/apiKey/delete.js +6 -5
  36. package/dist/commands/game/android/apiKey/export.js +13 -12
  37. package/dist/commands/game/android/apiKey/import.js +13 -12
  38. package/dist/commands/game/android/apiKey/invite.js +21 -20
  39. package/dist/commands/game/android/apiKey/policy.js +8 -7
  40. package/dist/commands/game/android/apiKey/status.js +13 -12
  41. package/dist/commands/game/android/keyStore/create.js +10 -9
  42. package/dist/commands/game/android/keyStore/delete.js +6 -5
  43. package/dist/commands/game/android/keyStore/export.js +12 -11
  44. package/dist/commands/game/android/keyStore/import.js +15 -14
  45. package/dist/commands/game/android/keyStore/status.js +15 -14
  46. package/dist/commands/game/android/status.js +7 -6
  47. package/dist/commands/game/build/download.js +6 -5
  48. package/dist/commands/game/build/list.js +11 -10
  49. package/dist/commands/game/create.js +4 -3
  50. package/dist/commands/game/details.js +15 -11
  51. package/dist/commands/game/export.js +4 -3
  52. package/dist/commands/game/ios/app/addTester.js +8 -7
  53. package/dist/commands/game/ios/app/create.js +7 -6
  54. package/dist/commands/game/ios/app/status.js +13 -12
  55. package/dist/commands/game/ios/app/sync.js +11 -10
  56. package/dist/commands/game/ios/profile/create.js +9 -8
  57. package/dist/commands/game/ios/profile/delete.js +9 -8
  58. package/dist/commands/game/ios/profile/export.js +12 -11
  59. package/dist/commands/game/ios/profile/import.js +12 -11
  60. package/dist/commands/game/ios/profile/status.js +13 -12
  61. package/dist/commands/game/ios/status.js +17 -16
  62. package/dist/commands/game/ios/wizard.js +7 -6
  63. package/dist/commands/game/job/list.js +6 -5
  64. package/dist/commands/game/job/status.js +11 -10
  65. package/dist/commands/game/list.js +6 -5
  66. package/dist/commands/game/ship.js +8 -7
  67. package/dist/commands/game/status.js +14 -13
  68. package/dist/commands/game/wizard.js +24 -23
  69. package/dist/commands/internal/fastlane.js +14 -13
  70. package/dist/commands/internal/readme.js +18 -17
  71. package/dist/commands/login.js +20 -19
  72. package/dist/commands/status.js +9 -8
  73. package/dist/commands/util/glass.js +119 -0
  74. package/dist/{export-BtUjg3Tl.js → export-DtATljiz.js} +1 -1
  75. package/dist/{import-BYSkF-tX.js → import-Dk2ywOVU.js} +1 -1
  76. package/dist/{index-Du6l7ZyV.js → index-BW7z-5sB.js} +1 -1
  77. package/dist/{index-CgGLBt2v.js → index-CuyVBHWc.js} +4 -3
  78. package/dist/{index-CcGRePRU.js → index-cRnjcGxV.js} +5 -4
  79. package/dist/{upload-LoVBuJbT.js → upload-CHaDSvvi.js} +1 -1
  80. package/dist/{useAppleApp-Bg0x6s97.js → useAppleApp-CR847GWc.js} +1 -1
  81. package/dist/{useAppleBundleId-CEOssLqN.js → useAppleBundleId-BnwPmVEu.js} +1 -1
  82. package/dist/{useAppleProfiles-CHf_gHdZ.js → useAppleProfiles-DY-H0420.js} +1 -1
  83. package/dist/{useGoogleStatus-Ch36GbVo.js → useGoogleStatus-WqPgHteE.js} +2 -1
  84. package/dist/{useProjectCredentials-CsQWPdyo.js → useProjectCredentials-TvlolkId.js} +2 -1
  85. package/dist/{useWebSocket-CWeaaLqi.js → useWebSocket-MXDbQHcu.js} +1 -1
  86. package/docs/README.md +1 -0
  87. package/docs/util/glass.md +47 -0
  88. package/docs/util.md +11 -0
  89. package/package.json +3 -1
@@ -1,38 +1,34 @@
1
- import * as fs from 'node:fs';
2
- import fs__default from 'node:fs';
3
- import axios from 'axios';
4
- import CryptoJS from 'crypto-js';
5
- import { v4 } from 'uuid';
6
- import { DateTime } from 'luxon';
7
- import path from 'node:path';
8
- import chalk from 'chalk';
9
- import { Command, Flags } from '@oclif/core';
10
- import * as expo from '@expo/apple-utils/build/index.js';
1
+ import { Flags } from '@oclif/core';
2
+ import { o as API_URL, p as getAuthedHeaders, P as Platform, a9 as getShortDateTime, F as castArrayObjectDates, J as JobStatus, aa as getShortTimeDelta, z as getJob, ab as JobStage, a2 as LogLevel, k as getProject, a3 as getShortAuthRequiredUrl, H as queryClient, ac as BuildType, W as WEB_URL, B as BaseCommand, ad as getSelf, ae as getTerms, a8 as updateProject } from './baseCommand-CTn3KGH3.js';
3
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
4
+ import { useStdin, useInput, Text, Box } from 'ink';
5
+ import Spinner from 'ink-spinner';
11
6
  import crypto from 'node:crypto';
7
+ import fs__default from 'node:fs';
8
+ import path__default from 'node:path';
12
9
  import { promises } from 'node:readline';
13
10
  import { fileURLToPath } from 'node:url';
14
11
  import readlineSync from 'readline-sync';
12
+ import 'luxon';
13
+ import axios from 'axios';
15
14
  import 'isomorphic-git';
16
- import merge from 'deepmerge';
17
- import { parse } from 'ini';
18
- import { QueryClient, useQuery } from '@tanstack/react-query';
15
+ import { useQuery } from '@tanstack/react-query';
19
16
  import React, { useState, useEffect, useContext, useRef } from 'react';
20
17
  import 'fast-glob';
18
+ import 'uuid';
21
19
  import 'yazl';
22
20
  import 'socket.io-client';
23
21
  import 'fullscreen-ink';
24
- import { useStdin, useInput, Text, Box } from 'ink';
25
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
26
- import Spinner from 'ink-spinner';
27
22
  import 'string-length';
28
23
  import 'strip-ansi';
29
24
  import open from 'open';
30
25
  import '@inkjs/ui';
31
26
  import require$$0 from 'fs';
32
27
  import require$$1 from 'path';
33
- import { setOptions, parse as parse$1 } from 'marked';
28
+ import { setOptions, parse } from 'marked';
34
29
  import TerminalRenderer from 'marked-terminal';
35
30
  import 'qrcode';
31
+ import 'crypto-js';
36
32
 
37
33
  const cacheKeys = {
38
34
  androidKeyTestResult: (props) => ["androidKeyTestResult", ...Object.values(props)],
@@ -46,549 +42,6 @@ const cacheKeys = {
46
42
  userCredentials: (props) => ["userCredentials", ...Object.values(props)]
47
43
  };
48
44
 
49
- const AUTH_ENV_VAR_NAME = "SHIPTHIS_TOKEN";
50
- const DOMAIN_ENV_VAR_NAME = "SHIPTHIS_DOMAIN";
51
- const DEFAULT_SHIPPED_FILES_GLOBS = ["**/*"];
52
- const DEFAULT_IGNORED_FILES_GLOBS = [
53
- ".git",
54
- ".gitignore",
55
- "shipthis.json",
56
- "shipthis-*.zip",
57
- ".godot/**",
58
- ".nomedia",
59
- ".import/**",
60
- "export.cfg",
61
- "export_credentials.cfg",
62
- "*.translation",
63
- ".mono/**",
64
- "data_*/**",
65
- "mono_crash.*.json",
66
- "*.apk",
67
- "*.aab"
68
- ];
69
- const PRIMARY_DOMAIN = "shipth.is";
70
- function getUrlsForDomain(domain) {
71
- const isPublic = domain.includes(PRIMARY_DOMAIN);
72
- const apiDomain = (isPublic ? `api.` : "") + domain;
73
- const wsDomain = (isPublic ? `ws.` : "") + domain;
74
- return {
75
- api: `https://${apiDomain}/api/1.0.0`,
76
- web: `https://${domain}/`,
77
- ws: `wss://${wsDomain}`
78
- };
79
- }
80
- const DOMAIN = process.env[DOMAIN_ENV_VAR_NAME] || PRIMARY_DOMAIN;
81
- const BACKEND_URLS = getUrlsForDomain(DOMAIN);
82
- const API_URL = BACKEND_URLS.api;
83
- const WS_URL = BACKEND_URLS.ws;
84
- const WEB_URL = BACKEND_URLS.web;
85
-
86
- const DEFAULT_LOCALE = "en-US";
87
- function castObjectDates(apiObject, keys = ["createdAt", "updatedAt"]) {
88
- if (!apiObject) return apiObject;
89
- const datesOnly = Object.keys(apiObject).filter((k) => keys.includes(k)).reduce((a, c) => {
90
- if (!apiObject[c]) return a;
91
- a[c] = DateTime.fromISO(apiObject[c]);
92
- return a;
93
- }, {});
94
- return {
95
- ...apiObject,
96
- ...datesOnly
97
- };
98
- }
99
- function castArrayObjectDates(apiArray, keys = ["createdAt", "updatedAt"]) {
100
- return apiArray.map((apiObject) => castObjectDates(apiObject, keys));
101
- }
102
- function castJobDates(jobObject) {
103
- if (jobObject.build) return castObjectDates({ ...jobObject, build: castObjectDates(jobObject.build) });
104
- return castObjectDates(jobObject);
105
- }
106
- function getDateLocale() {
107
- const fallback = Intl.DateTimeFormat().resolvedOptions().locale.replaceAll("_", "-") || DEFAULT_LOCALE;
108
- try {
109
- const { env } = process;
110
- const fullLocale = env.LC_TIME || env.LANG || env.LANGUAGE || env.LC_ALL || env.LC_MESSAGES;
111
- const shortLocale = fullLocale?.split(".")[0].replaceAll("_", "-");
112
- const finalLocal = shortLocale || fallback;
113
- const _ = DateTime.now().toLocaleString(DateTime.DATE_SHORT, { locale: finalLocal });
114
- return finalLocal;
115
- } catch {
116
- return fallback;
117
- }
118
- }
119
- function getShortDate(inputDate) {
120
- const locale = getDateLocale();
121
- return inputDate.toLocaleString(DateTime.DATE_SHORT, { locale });
122
- }
123
- function getShortDateTime(inputDate, extraFormatOpts = {}) {
124
- const locale = getDateLocale();
125
- const formatOpts = { ...DateTime.DATETIME_SHORT, ...extraFormatOpts };
126
- return inputDate.toLocaleString(formatOpts, { locale });
127
- }
128
- function getShortTime(inputDate, extraFormatOpts = { fractionalSecondDigits: 3 }) {
129
- const locale = getDateLocale();
130
- const formatOpts = { ...DateTime.TIME_24_WITH_SECONDS, ...extraFormatOpts };
131
- return inputDate.toLocaleString(formatOpts, { locale });
132
- }
133
- function getShortTimeDelta(start, end) {
134
- return end.diff(start).rescale().set({ milliseconds: 0 }).shiftTo("minutes", "seconds").toHuman({
135
- listStyle: "short",
136
- unitDisplay: "short"
137
- });
138
- }
139
-
140
- let currentAuthToken;
141
- function setAuthToken(token) {
142
- currentAuthToken = token;
143
- }
144
- function getAuthToken() {
145
- return currentAuthToken;
146
- }
147
- function getAuthedHeaders() {
148
- return {
149
- Authorization: `Bearer ${currentAuthToken}`
150
- };
151
- }
152
- async function createProject(props) {
153
- const headers = getAuthedHeaders();
154
- const opt = { headers };
155
- const { data } = await axios.post(`${API_URL}/projects`, props, opt);
156
- return castObjectDates(data);
157
- }
158
- async function getProject(projectId) {
159
- const headers = getAuthedHeaders();
160
- const opt = { headers };
161
- const { data } = await axios.get(`${API_URL}/projects/${projectId}`, opt);
162
- return castObjectDates(data);
163
- }
164
- async function getProjects(params) {
165
- const headers = getAuthedHeaders();
166
- const opt = { headers, params };
167
- const { data: rawData } = await axios.get(`${API_URL}/projects`, opt);
168
- const data = castArrayObjectDates(rawData.data);
169
- return {
170
- data,
171
- pageCount: rawData.pageCount
172
- };
173
- }
174
- async function updateProject(projectId, edits) {
175
- const headers = getAuthedHeaders();
176
- const opt = { headers };
177
- const { data } = await axios.put(`${API_URL}/projects/${projectId}`, edits, opt);
178
- return castObjectDates(data);
179
- }
180
- async function getProjectPlatformProgress(projectId, platform) {
181
- const headers = getAuthedHeaders();
182
- const opt = { headers };
183
- const { data } = await axios.get(`${API_URL}/projects/${projectId}/${platform}/progress`, opt);
184
- return data;
185
- }
186
- async function getNewUploadTicket(projectId) {
187
- const headers = getAuthedHeaders();
188
- const opt = { headers };
189
- const { data } = await axios.post(`${API_URL}/upload/${projectId}/url`, {}, opt);
190
- return data;
191
- }
192
- async function startJobsFromUpload(uploadTicketId, startOptions) {
193
- const headers = getAuthedHeaders();
194
- const opt = { headers };
195
- const { data } = await axios.post(`${API_URL}/upload/start/${uploadTicketId}`, startOptions, opt);
196
- return castArrayObjectDates(data);
197
- }
198
- async function getProjectJobs(projectId, params) {
199
- const headers = getAuthedHeaders();
200
- const opt = { headers, params };
201
- const { data: rawData } = await axios.get(`${API_URL}/projects/${projectId}/jobs`, opt);
202
- const data = castArrayObjectDates(rawData.data);
203
- return {
204
- data,
205
- pageCount: rawData.pageCount
206
- };
207
- }
208
- async function getJob(jobId, projectId) {
209
- const headers = getAuthedHeaders();
210
- const opt = { headers };
211
- const { data } = await axios.get(`${API_URL}/projects/${projectId}/jobs/${jobId}`, opt);
212
- return castJobDates(data);
213
- }
214
- async function getSingleUseUrl(destination) {
215
- const headers = await getAuthedHeaders();
216
- const { data } = await axios.post(`${API_URL}/me/otp`, {}, { headers });
217
- const queryString = Object.entries({ ...data, destination }).map(([key, value]) => `${key}=${encodeURIComponent(`${value}`)}`).join("&");
218
- const url = `${WEB_URL}exchange/?${queryString}`;
219
- return url;
220
- }
221
- async function getShortAuthRequiredUrl(destination) {
222
- const { email } = await getSelf();
223
- const key = v4();
224
- const salt = "Na (s) + 1/2 Cl\u2082 (g) \u2192 NaCl (s)";
225
- const fullKey = `${key}${salt}`;
226
- const token = CryptoJS.AES.encrypt(email, fullKey).toString();
227
- const params = {
228
- destination,
229
- key,
230
- token
231
- };
232
- const queryString = Object.entries(params).map(([key2, value]) => `${key2}=${encodeURIComponent(`${value}`)}`).join("&");
233
- const url = `${WEB_URL}login/?${queryString}`;
234
- const headers = await getAuthedHeaders();
235
- const { data } = await axios.post(
236
- `${API_URL}/me/shorten`,
237
- {
238
- url
239
- },
240
- { headers }
241
- );
242
- return data.url;
243
- }
244
- async function getBuild(projectId, buildId) {
245
- const headers = getAuthedHeaders();
246
- const opt = { headers };
247
- const { data } = await axios.get(`${API_URL}/projects/${projectId}/builds/${buildId}`, opt);
248
- return castObjectDates(data);
249
- }
250
- async function getSelf() {
251
- const headers = getAuthedHeaders();
252
- const opt = { headers };
253
- const { data } = await axios.get(`${API_URL}/me`, opt);
254
- return castObjectDates(data);
255
- }
256
- async function getTerms() {
257
- const headers = getAuthedHeaders();
258
- const opt = { headers };
259
- const { data } = await axios.get(`${API_URL}/me/terms`, opt);
260
- return {
261
- // Any agreements which have changed since the user last accepted terms
262
- changes: castArrayObjectDates(data.changes),
263
- // Current versions of any agreements
264
- current: castArrayObjectDates(data.current)
265
- };
266
- }
267
- async function acceptTerms() {
268
- const headers = getAuthedHeaders();
269
- const opt = { headers };
270
- const { data } = await axios.post(`${API_URL}/me/terms`, {}, opt);
271
- return castObjectDates(data);
272
- }
273
- async function getGoogleAuthUrl(projectId) {
274
- const headers = getAuthedHeaders();
275
- const opt = { headers };
276
- const web = encodeURIComponent(new URL("/google/redirect/", WEB_URL).href);
277
- const url = `${API_URL}/projects/${projectId}/credentials/android/key/connect`;
278
- const { data } = await axios.get(`${url}?redirectUri=${web}`, opt);
279
- const response = data;
280
- return await getShortAuthRequiredUrl(response.url);
281
- }
282
- async function disconnectGoogle() {
283
- const headers = getAuthedHeaders();
284
- const opt = { headers };
285
- await axios.delete(`${API_URL}/me/google/connect`, opt);
286
- }
287
- async function getGoogleStatus() {
288
- const headers = getAuthedHeaders();
289
- const opt = { headers };
290
- const { data } = await axios.get(`${API_URL}/me/google/status`, opt);
291
- return castObjectDates(data, ["orgCreatedAt"]);
292
- }
293
- async function enforcePolicy() {
294
- const headers = getAuthedHeaders();
295
- const opt = { headers };
296
- const { data } = await axios.post(`${API_URL}/me/google/policy`, null, opt);
297
- return castObjectDates(data, ["orgCreatedAt"]);
298
- }
299
- async function revokePolicy() {
300
- const headers = getAuthedHeaders();
301
- const opt = { headers };
302
- const { data } = await axios.delete(`${API_URL}/me/google/policy`, opt);
303
- return castObjectDates(data, ["orgCreatedAt"]);
304
- }
305
- async function inviteServiceAccount(projectId, developerId) {
306
- try {
307
- const headers = getAuthedHeaders();
308
- const { data } = await axios.post(
309
- `${API_URL}/projects/${projectId}/credentials/android/key/invite/`,
310
- { developerId },
311
- {
312
- headers
313
- }
314
- );
315
- return data;
316
- } catch (error) {
317
- console.error("inviteServiceAccount Error", error);
318
- throw error;
319
- }
320
- }
321
- async function downloadBuildById(projectId, buildId, fileName) {
322
- const build = await getBuild(projectId, buildId);
323
- const { url } = build;
324
- const writer = fs.createWriteStream(fileName);
325
- const response = await axios({
326
- method: "GET",
327
- responseType: "stream",
328
- url
329
- });
330
- response.data.pipe(writer);
331
- return new Promise((resolve, reject) => {
332
- writer.on("finish", resolve);
333
- writer.on("error", reject);
334
- });
335
- }
336
- const APIKEYS_DATE_FIELDS = ["createdAt", "updatedAt", "expiresAt", "lastUsedAt", "revokedAt"];
337
- async function getAPIKeys(params) {
338
- const headers = getAuthedHeaders();
339
- const opt = { headers, params };
340
- const { data: rawData } = await axios.get(`${API_URL}/me/keys`, opt);
341
- const data = castArrayObjectDates(rawData.data, APIKEYS_DATE_FIELDS);
342
- return {
343
- data,
344
- pageCount: rawData.pageCount
345
- };
346
- }
347
- async function createAPIKey(createProps) {
348
- const headers = getAuthedHeaders();
349
- const opt = { headers };
350
- const { data } = await axios.post(`${API_URL}/me/keys`, createProps, opt);
351
- return castObjectDates(data, APIKEYS_DATE_FIELDS);
352
- }
353
- async function revokeAPIKey(apiKeyId) {
354
- const headers = getAuthedHeaders();
355
- const opt = { headers };
356
- await axios.delete(`${API_URL}/me/keys/${apiKeyId}`, opt);
357
- }
358
-
359
- const defaultExport = expo.default;
360
- const {
361
- ApiKey,
362
- ApiKeyType,
363
- App,
364
- Auth,
365
- BetaGroup,
366
- BundleId,
367
- CapabilityType,
368
- CapabilityTypeOption,
369
- Certificate,
370
- CertificateType,
371
- Profile,
372
- ProfileType,
373
- Session,
374
- UserRole
375
- } = defaultExport;
376
-
377
- var Platform = /* @__PURE__ */ ((Platform2) => {
378
- Platform2["ANDROID"] = "ANDROID";
379
- Platform2["IOS"] = "IOS";
380
- return Platform2;
381
- })(Platform || {});
382
- var GameEngine = /* @__PURE__ */ ((GameEngine2) => {
383
- GameEngine2["GODOT"] = "godot";
384
- return GameEngine2;
385
- })(GameEngine || {});
386
- var JobStatus = /* @__PURE__ */ ((JobStatus2) => {
387
- JobStatus2["COMPLETED"] = "COMPLETED";
388
- JobStatus2["FAILED"] = "FAILED";
389
- JobStatus2["PENDING"] = "PENDING";
390
- JobStatus2["PROCESSING"] = "PROCESSING";
391
- return JobStatus2;
392
- })(JobStatus || {});
393
- var JobStage = /* @__PURE__ */ ((JobStage2) => {
394
- JobStage2["BUILD"] = "BUILD";
395
- JobStage2["CONFIGURE"] = "CONFIGURE";
396
- JobStage2["EXPORT"] = "EXPORT";
397
- JobStage2["PUBLISH"] = "PUBLISH";
398
- JobStage2["SETUP"] = "SETUP";
399
- return JobStage2;
400
- })(JobStage || {});
401
- var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
402
- LogLevel2["ERROR"] = "ERROR";
403
- LogLevel2["INFO"] = "INFO";
404
- LogLevel2["WARN"] = "WARN";
405
- return LogLevel2;
406
- })(LogLevel || {});
407
- var CredentialsType = /* @__PURE__ */ ((CredentialsType2) => {
408
- CredentialsType2["CERTIFICATE"] = "CERTIFICATE";
409
- CredentialsType2["KEY"] = "KEY";
410
- return CredentialsType2;
411
- })(CredentialsType || {});
412
- var BuildType = /* @__PURE__ */ ((BuildType2) => {
413
- BuildType2["AAB"] = "AAB";
414
- BuildType2["APK"] = "APK";
415
- BuildType2["IPA"] = "IPA";
416
- return BuildType2;
417
- })(BuildType || {});
418
-
419
- function isCWDGodotGame() {
420
- const cwd = process.cwd();
421
- const godotProject = path.join(cwd, "project.godot");
422
- return fs__default.existsSync(godotProject);
423
- }
424
- const GODOT_CAPABILITIES = [
425
- // TODO: how about capabilities from godot extensions
426
- { key: "capabilities/access_wifi", name: "Access WiFi", type: CapabilityType.ACCESS_WIFI },
427
- { key: "capabilities/push_notifications", name: "Push Notifications", type: CapabilityType.PUSH_NOTIFICATIONS }
428
- ];
429
- function getGodotProjectCapabilities(platform) {
430
- const exportPresets = getGodotExportPresets(platform);
431
- const options = exportPresets.options || {};
432
- const capabilities = [];
433
- for (const capability of GODOT_CAPABILITIES) {
434
- if (!(capability.key in options)) continue;
435
- if (`${options[capability.key]}`.toLocaleLowerCase() === "true") capabilities.push(capability.type);
436
- }
437
- return capabilities;
438
- }
439
- function getGodotProjectConfig() {
440
- const cwd = process.cwd();
441
- const projectGodotPath = path.join(cwd, "project.godot");
442
- const projectGodotContent = fs__default.readFileSync(projectGodotPath, "utf8");
443
- return parse(projectGodotContent);
444
- }
445
- function getGodotProjectName() {
446
- try {
447
- const projectGodotConfig = getGodotProjectConfig();
448
- return projectGodotConfig.application["config/name"];
449
- } catch {
450
- return null;
451
- }
452
- }
453
- function getGodotAppleBundleIdentifier() {
454
- try {
455
- const preset = getGodotExportPresets(Platform.IOS);
456
- return preset.options["application/bundle_identifier"];
457
- } catch (error) {
458
- console.log(error);
459
- return null;
460
- }
461
- }
462
- function getGodotAndroidPackageName() {
463
- try {
464
- const preset = getGodotExportPresets(Platform.ANDROID);
465
- return preset.options["package/unique_name"];
466
- } catch (error) {
467
- console.log(error);
468
- return null;
469
- }
470
- }
471
- function getGodotVersion() {
472
- const projectGodotConfig = getGodotProjectConfig();
473
- if ("config/features" in projectGodotConfig.application) {
474
- const features = projectGodotConfig.application["config/features"];
475
- const match = features.match(/"(\d+\.\d+)"/);
476
- if (!match) throw new Error("Couldn't find Godot version in project.godot");
477
- return match[1];
478
- }
479
- return "3.6";
480
- }
481
- function getGodotExportPresets(platform) {
482
- const { warn } = console;
483
- let presetConfig = platform === Platform.IOS ? getBaseExportPresets_iOS() : getBaseExportPresets_Android();
484
- const cwd = process.cwd();
485
- const filename = "export_presets.cfg";
486
- const exportPresetsPath = path.join(cwd, filename);
487
- const isFound = fs__default.existsSync(exportPresetsPath);
488
- if (isFound) {
489
- const exportPresetsContent = fs__default.readFileSync(exportPresetsPath, "utf8");
490
- const exportPresetsIni = parse(exportPresetsContent);
491
- const presetIndexes = Object.keys(exportPresetsIni.preset || {});
492
- const presetIndex = presetIndexes.find((index) => {
493
- const current = exportPresetsIni.preset[index];
494
- return `${current.name}`.toUpperCase() === platform;
495
- });
496
- if (presetIndex) {
497
- presetConfig = merge(presetConfig, exportPresetsIni.preset[presetIndex]);
498
- } else {
499
- warn(`Preset ${platform} not found in ${filename} - will use defaults`);
500
- }
501
- } else {
502
- warn(`${filename} not found at ${exportPresetsPath}`);
503
- }
504
- return presetConfig;
505
- }
506
- function getBaseExportPresets_iOS() {
507
- return {
508
- custom_features: "",
509
- dedicated_server: false,
510
- encrypt_directory: false,
511
- encrypt_pck: false,
512
- encryption_exclude_filters: "",
513
- encryption_include_filters: "",
514
- exclude_filter: "",
515
- export_filter: "all_resources",
516
- export_path: "output",
517
- include_filter: "",
518
- name: "iOS",
519
- options: {
520
- "application/export_project_only": true,
521
- "application/icon_interpolation": "4",
522
- "application/launch_screens_interpolation": "4",
523
- "application/short_version": "1.0.0",
524
- // default version number
525
- "application/signature": "",
526
- "architectures/arm64": true,
527
- "capabilities/access_wifi": false,
528
- "capabilities/push_notifications": false,
529
- "custom_template/debug": "",
530
- "custom_template/release": "",
531
- "icons/app_store_1024x1024": "",
532
- "icons/ipad_76x76": "",
533
- "icons/ipad_152x152": "",
534
- "icons/ipad_167x167": "",
535
- "icons/iphone_120x120": "",
536
- "icons/iphone_180x180": "",
537
- "icons/notification_40x40": "",
538
- "icons/notification_60x60": "",
539
- "icons/settings_58x58": "",
540
- "icons/settings_87x87": "",
541
- "icons/spotlight_40x40": "",
542
- "icons/spotlight_80x80": "",
543
- "landscape_launch_screens/ipad_1024x768": "",
544
- "landscape_launch_screens/ipad_2048x1536": "",
545
- "landscape_launch_screens/iphone_2208x1242": "",
546
- "landscape_launch_screens/iphone_2436x1125": "",
547
- "portrait_launch_screens/ipad_768x1024": "",
548
- "portrait_launch_screens/ipad_1536x2048": "",
549
- "portrait_launch_screens/iphone_640x960": "",
550
- "portrait_launch_screens/iphone_640x1136": "",
551
- "portrait_launch_screens/iphone_750x1334": "",
552
- "portrait_launch_screens/iphone_1125x2436": "",
553
- "portrait_launch_screens/iphone_1242x2208": "",
554
- "privacy/camera_usage_description": "",
555
- "privacy/camera_usage_description_localized": "{}",
556
- "privacy/microphone_usage_description": "",
557
- "privacy/microphone_usage_description_localized": "{}",
558
- "privacy/photolibrary_usage_description": "",
559
- "privacy/photolibrary_usage_description_localized": "{}",
560
- "storyboard/custom_bg_color": "Color(0, 0, 0, 1)",
561
- "storyboard/custom_image@2x": "",
562
- "storyboard/custom_image@3x": "",
563
- "storyboard/image_scale_mode": "0",
564
- "storyboard/use_custom_bg_color": false,
565
- "storyboard/use_launch_screen_storyboard": true,
566
- "user_data/accessible_from_files_app": false,
567
- "user_data/accessible_from_itunes_sharing": false
568
- },
569
- platform: "iOS",
570
- runnable: true
571
- };
572
- }
573
- function getBaseExportPresets_Android() {
574
- return {
575
- name: "Android",
576
- // TODO
577
- options: {
578
- // TODO
579
- },
580
- platform: "Android"
581
- };
582
- }
583
-
584
- const queryClient = new QueryClient({
585
- defaultOptions: {
586
- queries: {
587
- staleTime: 50
588
- }
589
- }
590
- });
591
-
592
45
  var KeyTestStatus = /* @__PURE__ */ ((KeyTestStatus2) => {
593
46
  KeyTestStatus2["ERROR"] = "error";
594
47
  KeyTestStatus2["SUCCESS"] = "success";
@@ -825,187 +278,10 @@ function generatePackageName(gameName) {
825
278
  }
826
279
  function scriptDir(importMeta) {
827
280
  const filename = fileURLToPath(importMeta.url);
828
- const dirname = path.dirname(filename);
281
+ const dirname = path__default.dirname(filename);
829
282
  return dirname;
830
283
  }
831
284
 
832
- class BaseCommand extends Command {
833
- // define flags that can be inherited by any command that extends BaseCommand
834
- static baseFlags = {};
835
- // add the --json flag
836
- static enableJsonFlag = false;
837
- args;
838
- flags;
839
- async catch(err) {
840
- return super.catch(err);
841
- }
842
- // Used in baseGameCommand and the other commands that need to ensure that the CWD is a Godot project
843
- ensureWeAreInAProjectDir() {
844
- if (!isCWDGodotGame()) {
845
- this.error("No Godot project detected. Please run this from a godot project directory.", { exit: 1 });
846
- }
847
- if (!this.hasProjectConfig()) {
848
- this.error(
849
- 'No ShipThis config found. Please run `shipthis game create --name "Space Invaders"` to create a game.',
850
- { exit: 1 }
851
- );
852
- }
853
- }
854
- ensureWeHaveAppleCookies() {
855
- if (!this.hasAuthConfigFile()) {
856
- this.error("You must be authenticated with Apple in to use this command. Please run shipthis apple login", {
857
- exit: 1
858
- });
859
- }
860
- }
861
- async finally(_) {
862
- return super.finally(_);
863
- }
864
- // Used in the apple commands to get the cookies from the auth file
865
- async getAppleCookies() {
866
- const authConfig = await this.getAuthConfig();
867
- if (!authConfig.appleCookies) return null;
868
- return authConfig.appleCookies;
869
- }
870
- // Returns the current auth config - prefers to use the env var
871
- async getAuthConfig() {
872
- const envVarValue = process.env[AUTH_ENV_VAR_NAME];
873
- if (!envVarValue) return await this.getAuthConfigFromFile();
874
- setAuthToken(envVarValue);
875
- const self = await getSelf();
876
- const selfWithJwt = {
877
- ...self,
878
- jwt: envVarValue
879
- };
880
- return {
881
- shipThisUser: selfWithJwt
882
- };
883
- }
884
- // Loads the auth config from the file system
885
- async getAuthConfigFromFile() {
886
- const baseConfig = {};
887
- const configPath = this.getAuthConfigPath();
888
- if (!fs__default.existsSync(configPath)) return baseConfig;
889
- const raw = await fs__default.promises.readFile(configPath, "utf8");
890
- const parsed = JSON.parse(raw);
891
- if (parsed.shipThisUser) {
892
- setAuthToken(parsed.shipThisUser.jwt);
893
- }
894
- return {
895
- ...baseConfig,
896
- ...parsed
897
- };
898
- }
899
- // This is used to expose the flags to the Android Wizard
900
- getDetailsFlagsValues() {
901
- const keys = Object.keys(DetailsFlags);
902
- const values = {};
903
- for (const key of keys) {
904
- if (this.flags[key]) values[key] = this.flags[key];
905
- }
906
- return values;
907
- }
908
- // Exposing it to the react components using the CommandContext
909
- getFlags() {
910
- return this.flags;
911
- }
912
- getGameId() {
913
- const { flags } = this;
914
- if (flags.gameId) return flags.gameId;
915
- const { project } = this.getProjectConfigSafe();
916
- if (!project) return null;
917
- return project.id;
918
- }
919
- async getProjectConfig() {
920
- if (!this.hasProjectConfig()) throw new Error("No project config found");
921
- return this.getProjectConfigSafe();
922
- }
923
- getProjectConfigSafe() {
924
- if (!this.hasProjectConfig()) return {};
925
- const configPath = this.getProjectConfigPath();
926
- const raw = fs__default.readFileSync(configPath, "utf8");
927
- return JSON.parse(raw);
928
- }
929
- hasAuthConfigFile() {
930
- const configPath = this.getAuthConfigPath();
931
- return fs__default.existsSync(configPath);
932
- }
933
- hasProjectConfig() {
934
- const configPath = this.getProjectConfigPath();
935
- return fs__default.existsSync(configPath);
936
- }
937
- // Tests the apple cookies
938
- async hasValidAppleAuthState() {
939
- try {
940
- await this.refreshAppleAuthState();
941
- return true;
942
- } catch {
943
- return false;
944
- }
945
- }
946
- async init() {
947
- process.on("SIGINT", () => process.exit(0));
948
- process.on("SIGTERM", () => process.exit(0));
949
- await super.init();
950
- const { args, flags } = await this.parse({
951
- args: this.ctor.args,
952
- baseFlags: super.ctor.baseFlags,
953
- enableJsonFlag: this.ctor.enableJsonFlag,
954
- flags: this.ctor.flags,
955
- strict: this.ctor.strict
956
- });
957
- this.flags = flags;
958
- this.args = args;
959
- await this.getAuthConfig();
960
- }
961
- async isAuthenticated() {
962
- const authConfig = await this.getAuthConfig();
963
- return Boolean(authConfig.shipThisUser?.jwt);
964
- }
965
- async refreshAppleAuthState() {
966
- const cookies = await this.getAppleCookies();
967
- const rerunMessage = `Please run ${chalk.bold("shipthis apple login")} to authenticate with Apple.`;
968
- if (!cookies) throw new Error(`No Apple cookies found. ${rerunMessage}`);
969
- const authState = await Auth.loginWithCookiesAsync(
970
- {
971
- cookies
972
- },
973
- {}
974
- );
975
- if (!authState) throw new Error(`Failed to refresh Apple auth state. ${rerunMessage}`);
976
- return authState;
977
- }
978
- // Pass undefined to logout
979
- async setAppleCookies(cookies) {
980
- const authConfig = await this.getAuthConfig();
981
- await this.setAuthConfig({ ...authConfig, appleCookies: cookies });
982
- }
983
- // This is called after login to persist the JWT and user details
984
- async setAuthConfig(config) {
985
- const configPath = this.getAuthConfigPath();
986
- await fs__default.promises.writeFile(configPath, JSON.stringify(config, null, 2));
987
- }
988
- async setProjectConfig(config) {
989
- const configPath = this.getProjectConfigPath();
990
- const clean = {
991
- ...config,
992
- project: config.project ? { id: config.project.id } : void 0
993
- };
994
- await fs__default.promises.writeFile(configPath, JSON.stringify(clean, null, 2));
995
- }
996
- async updateProjectConfig(update) {
997
- const config = await this.getProjectConfig();
998
- await this.setProjectConfig({ ...config, ...update });
999
- }
1000
- // Returns the values of the flags in DetailsFlags
1001
- getAuthConfigPath() {
1002
- return path.join(this.config.home, ".shipthis.auth.json");
1003
- }
1004
- getProjectConfigPath() {
1005
- return path.join(process.cwd(), "shipthis.json");
1006
- }
1007
- }
1008
-
1009
285
  function getDefaultExportFromCjs (x) {
1010
286
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1011
287
  }
@@ -1730,13 +1006,13 @@ const getRenderedMarkdown = ({ filename, templateVars, ...options }) => {
1730
1006
  })
1731
1007
  });
1732
1008
  const entrypointPath = fs__default.realpathSync(process.argv[1]);
1733
- const root = path.dirname(entrypointPath);
1734
- const mdPath = path.join(root, "..", "assets", "markdown", filename);
1009
+ const root = path__default.dirname(entrypointPath);
1010
+ const mdPath = path__default.join(root, "..", "assets", "markdown", filename);
1735
1011
  const mdTemplate = fs__default.readFileSync(mdPath, "utf8").trim();
1736
1012
  const markdown = ejs.render(mdTemplate, templateVars ?? {}, {
1737
1013
  filename: mdPath
1738
1014
  });
1739
- const rendered = parse$1(markdown).trim();
1015
+ const rendered = parse(markdown).trim();
1740
1016
  const cleaned = cleanHyperlinks(rendered);
1741
1017
  return cleaned;
1742
1018
  };
@@ -1896,17 +1172,4 @@ class BaseGameCommand extends BaseAuthenticatedCommand {
1896
1172
  }
1897
1173
  }
1898
1174
 
1899
- const DetailsFlags = {
1900
- androidPackageName: Flags.string({ char: "a", description: "Set the Android package name" }),
1901
- buildNumber: Flags.integer({ char: "b", description: "Set the build number" }),
1902
- gameEngine: Flags.string({ char: "e", description: "Set the game engine" }),
1903
- gameEngineVersion: Flags.string({ char: "v", description: "Set the game engine version" }),
1904
- gcpProjectId: Flags.string({ char: "g", description: "Set the GCP project ID" }),
1905
- gcpServiceAccountId: Flags.string({ char: "c", description: "Set the GCP service account ID" }),
1906
- iosBundleId: Flags.string({ char: "i", description: "Set the iOS bundle ID" }),
1907
- name: Flags.string({ char: "n", description: "The name of the game" }),
1908
- semanticVersion: Flags.string({ char: "s", description: "Set the semantic version" }),
1909
- useDemoCredentials: Flags.string({ char: "d", description: "Use demo credentials for this project" })
1910
- };
1911
-
1912
- export { getAuthToken as $, ApiKey as A, BaseAuthenticatedCommand as B, CredentialsType as C, DetailsFlags as D, DEFAULT_SHIPPED_FILES_GLOBS as E, DEFAULT_IGNORED_FILES_GLOBS as F, GODOT_CAPABILITIES as G, getGodotProjectName as H, getProjectJobs as I, getJobSummary as J, getJobStatusColor as K, getJob as L, JobStatus as M, getStageColor as N, makeHumanReadable as O, Platform as P, getProjectPlatformProgress as Q, GameContext as R, CommandContext as S, isValidSemVer as T, UserRole as U, castArrayObjectDates as V, WEB_URL as W, queryClient as X, CommandProvider as Y, GameProvider as Z, WS_URL as _, ApiKeyType as a, cacheKeys as a0, downloadBuildById as a1, getGoogleStatus as a2, getGodotAndroidPackageName as a3, enforcePolicy as a4, revokePolicy as a5, fetchKeyTestResult as a6, niceError as a7, KeyTestStatus as a8, KeyTestError as a9, getMessageColor as aA, getShortTime as aB, updateProject as aC, queryBuilds as aD, CreateGooglePlayGame as aE, inviteServiceAccount as aa, disconnectGoogle as ab, BaseCommand as ac, ejs as ad, getAPIKeys as ae, createAPIKey as af, revokeAPIKey as ag, getSingleUseUrl as ah, acceptTerms as ai, setAuthToken as aj, Auth as ak, getMaskedInput as al, getNewUploadTicket as am, getFileHash as an, startJobsFromUpload as ao, getPlatformName as ap, useBuilds as aq, getBuildSummary as ar, LogLevel as as, useSafeInput as at, Markdown as au, getShortAuthRequiredUrl as av, castObjectDates as aw, getGoogleAuthUrl as ax, useJob as ay, castJobDates as az, getRenderedMarkdown as b, getInput as c, Certificate as d, getProjects as e, getShortDate as f, getShortUUID as g, BaseGameCommand as h, generatePackageName as i, getGodotAppleBundleIdentifier as j, BundleId as k, App as l, CapabilityTypeOption as m, BetaGroup as n, isCWDGodotGame as o, getProject as p, CertificateType as q, Profile as r, ProfileType as s, API_URL as t, getAuthedHeaders as u, getGodotProjectCapabilities as v, CapabilityType as w, GameEngine as x, getGodotVersion as y, createProject as z };
1175
+ export { CreateGooglePlayGame as A, BaseAuthenticatedCommand as B, CommandContext as C, GameContext as G, KeyTestStatus as K, Markdown as M, getRenderedMarkdown as a, getInput as b, BaseGameCommand as c, generatePackageName as d, getJobSummary as e, getJobStatusColor as f, getShortUUID as g, getStageColor as h, CommandProvider as i, GameProvider as j, cacheKeys as k, isValidSemVer as l, makeHumanReadable as m, fetchKeyTestResult as n, niceError as o, KeyTestError as p, ejs as q, getMaskedInput as r, getFileHash as s, getPlatformName as t, useBuilds as u, getBuildSummary as v, useSafeInput as w, useJob as x, getMessageColor as y, queryBuilds as z };