shipthis 0.1.31 → 0.1.32

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 (84) hide show
  1. package/dist/{AppleBundleIdDetails-eoK5F8Qn.js → AppleBundleIdDetails-6H3cNWxw.js} +17 -19
  2. package/dist/Command-WPpmLPkL.js +29 -0
  3. package/dist/CommandGame-cxzWG4nT.js +7 -0
  4. package/dist/{Create-ISdroJ3G.js → Create-3Ob8sjik.js} +20 -20
  5. package/dist/GameStatus-BQEtVKvv.js +137 -0
  6. package/dist/{Import-CfThJF6k.js → Import-CFuPDI0K.js} +33 -35
  7. package/dist/{JobLogTail-BWzbQBZz.js → JobLogTail-0CBLoG8N.js} +53 -52
  8. package/dist/{JobProgress-DjIkuk5U.js → JobProgress-lKqVT88m.js} +35 -36
  9. package/dist/{JobStatusTable-CEqWU73q.js → JobStatusTable-C_ZsZJCm.js} +14 -13
  10. package/dist/{NextSteps-CK9zHOCt.js → NextSteps-DbJHmscQ.js} +1 -3
  11. package/dist/{ProgressSpinner-6pw1T8Iw.js → ProgressSpinner-DGcakQSK.js} +1 -1
  12. package/dist/{ProjectCredentialsTable-u9ruZ9mN.js → ProjectCredentialsTable-B5pHOnGu.js} +11 -10
  13. package/dist/{StatusTable-Dm5St4g-.js → StatusTable-DzRWcMr4.js} +7 -9
  14. package/dist/{Table-CvM6pccN.js → Table-FaNgpyeq.js} +15 -15
  15. package/dist/{UserCredentialsTable-Q7u9M-ap.js → UserCredentialsTable-3W3qesh7.js} +18 -19
  16. package/dist/{baseAppleCommand-zhkGlKq0.js → baseAppleCommand-BGV088--.js} +1 -1
  17. package/dist/{baseGameAndroidCommand-DJ-cMLa_.js → baseGameAndroidCommand-CsemgVjp.js} +23 -23
  18. package/dist/commands/apple/apiKey/create.js +35 -35
  19. package/dist/commands/apple/apiKey/export.js +26 -26
  20. package/dist/commands/apple/apiKey/import.js +27 -27
  21. package/dist/commands/apple/apiKey/status.js +31 -31
  22. package/dist/commands/apple/certificate/create.js +39 -39
  23. package/dist/commands/apple/certificate/export.js +26 -26
  24. package/dist/commands/apple/certificate/import.js +27 -27
  25. package/dist/commands/apple/certificate/status.js +31 -31
  26. package/dist/commands/apple/login.js +15 -16
  27. package/dist/commands/apple/status.js +27 -27
  28. package/dist/commands/dashboard.js +10 -11
  29. package/dist/commands/game/android/apiKey/connect.js +28 -28
  30. package/dist/commands/game/android/apiKey/create.js +28 -28
  31. package/dist/commands/game/android/apiKey/export.js +29 -29
  32. package/dist/commands/game/android/apiKey/import.js +31 -31
  33. package/dist/commands/game/android/apiKey/invite.js +14 -15
  34. package/dist/commands/game/android/apiKey/status.js +29 -29
  35. package/dist/commands/game/android/keyStore/create.js +24 -24
  36. package/dist/commands/game/android/keyStore/export.js +28 -28
  37. package/dist/commands/game/android/keyStore/import.js +35 -35
  38. package/dist/commands/game/android/keyStore/status.js +26 -26
  39. package/dist/commands/game/android/status.js +14 -58
  40. package/dist/commands/game/build/download.js +24 -24
  41. package/dist/commands/game/build/list.js +37 -37
  42. package/dist/commands/game/create.js +15 -16
  43. package/dist/commands/game/details.js +35 -36
  44. package/dist/commands/game/export.js +12 -13
  45. package/dist/commands/game/ios/app/addTester.js +24 -24
  46. package/dist/commands/game/ios/app/create.js +24 -24
  47. package/dist/commands/game/ios/app/status.js +29 -29
  48. package/dist/commands/game/ios/app/sync.js +31 -31
  49. package/dist/commands/game/ios/profile/create.js +30 -30
  50. package/dist/commands/game/ios/profile/export.js +28 -28
  51. package/dist/commands/game/ios/profile/import.js +32 -32
  52. package/dist/commands/game/ios/profile/status.js +36 -36
  53. package/dist/commands/game/ios/status.js +46 -58
  54. package/dist/commands/game/ios/wizard.js +31 -31
  55. package/dist/commands/game/job/list.js +34 -34
  56. package/dist/commands/game/job/status.js +31 -31
  57. package/dist/commands/game/list.js +37 -39
  58. package/dist/commands/game/ship.js +73 -71
  59. package/dist/commands/game/status.js +38 -85
  60. package/dist/commands/game/wizard.js +250 -239
  61. package/dist/commands/internal/fastlane.js +15 -18
  62. package/dist/commands/internal/readme.js +38 -37
  63. package/dist/commands/login.js +14 -15
  64. package/dist/commands/status.js +32 -30
  65. package/dist/{export-DZxo2_e_.js → export-CXsVPXA1.js} +5 -5
  66. package/dist/{git-DREGq-jc.js → git-BpsfNFZ_.js} +8 -8
  67. package/dist/{import-8pL1AF47.js → import-DGvG5REx.js} +14 -14
  68. package/dist/{index-w3lHxk5O.js → index-BhhiXbey.js} +240 -224
  69. package/dist/{index-BHh0BZvD.js → index-C03TV1_J.js} +37 -55
  70. package/dist/{index-CyvGh-kt.js → index-C66Dd8Xc.js} +77 -87
  71. package/dist/{index-DJ078v-U.js → index-CGBdOm1q.js} +43 -28
  72. package/dist/{index-DKQjnJrC.js → index-CS9Gwcb0.js} +41 -43
  73. package/dist/{index-C6aAyrXW.js → index-CtTI85m-.js} +6 -6
  74. package/dist/{upload-BTpxj3QP.js → upload-8y5MQEm9.js} +22 -22
  75. package/dist/{useAndroidServiceAccountTestResult-Dy3Ag7_r.js → useAndroidServiceAccountTestResult-DZk5SMxI.js} +11 -13
  76. package/dist/{useAppleApp-h1Ogi_qc.js → useAppleApp-DWYGURwU.js} +4 -4
  77. package/dist/{useAppleBundleId-B3TTNap0.js → useAppleBundleId-PsTJ2g1B.js} +6 -6
  78. package/dist/{useProjectCredentials-DpeXZcHP.js → useProjectCredentials-BEphqa18.js} +10 -12
  79. package/dist/{useWebSocket-gyuCsore.js → useWebSocket-5PYa2QER.js} +1 -1
  80. package/dist/utils/help.js +4 -4
  81. package/package.json +4 -3
  82. package/dist/Command-DFdHXDiU.js +0 -44
  83. package/dist/CommandGame-Dif-oSky.js +0 -9
  84. package/dist/{RunWithSpinner-BVXNWGD3.js → RunWithSpinner-gMVA07bZ.js} +2 -2
@@ -1,45 +1,28 @@
1
- import path from 'path';
2
- import * as fs from 'fs';
3
- import fs__default from 'fs';
4
- import { Command, Flags } from '@oclif/core';
5
- import * as expo from '@expo/apple-utils/build/index.js';
1
+ import * as fs from 'node:fs';
2
+ import fs__default from 'node:fs';
6
3
  import axios from 'axios';
7
4
  import CryptoJS from 'crypto-js';
8
5
  import { v4 } from 'uuid';
9
6
  import { DateTime } from 'luxon';
10
- import 'crypto';
11
- import 'readline-sync';
7
+ import path from 'node:path';
8
+ import { Command, Flags } from '@oclif/core';
9
+ import * as expo from '@expo/apple-utils/build/index.js';
10
+ import 'node:crypto';
12
11
  import 'node:readline';
13
- import 'node:path';
14
12
  import 'node:url';
13
+ import 'readline-sync';
15
14
  import 'isomorphic-git';
16
- import { parse } from 'ini';
17
15
  import merge from 'deepmerge';
18
- import 'react';
16
+ import { parse } from 'ini';
19
17
  import { QueryClient } from '@tanstack/react-query';
18
+ import 'react';
20
19
  import 'fast-glob';
21
20
  import 'yazl';
22
21
  import 'socket.io-client';
23
- import 'ink';
24
-
25
- const defaultExport = expo.default;
26
- const {
27
- ApiKey,
28
- ApiKeyType,
29
- App,
30
- Auth,
31
- BundleId,
32
- CapabilityType,
33
- CapabilityTypeOption,
34
- Certificate,
35
- CertificateType,
36
- Profile,
37
- ProfileType,
38
- Session,
39
- UserRole,
40
- BetaGroup
41
- } = defaultExport;
22
+ import 'fullscreen-ink';
42
23
 
24
+ const AUTH_ENV_VAR_NAME = "SHIPTHIS_TOKEN";
25
+ const DOMAIN_ENV_VAR_NAME = "SHIPTHIS_DOMAIN";
43
26
  const DEFAULT_SHIPPED_FILES_GLOBS = ["**/*"];
44
27
  const DEFAULT_IGNORED_FILES_GLOBS = [
45
28
  ".git",
@@ -63,11 +46,10 @@ function getUrlsForDomain(domain) {
63
46
  const wsDomain = (isPublic ? `ws.` : "") + domain;
64
47
  return {
65
48
  api: `https://${apiDomain}/api/1.0.0`,
66
- ws: `wss://${wsDomain}`,
67
- web: `https://${domain}/`
49
+ web: `https://${domain}/`,
50
+ ws: `wss://${wsDomain}`
68
51
  };
69
52
  }
70
- const DOMAIN_ENV_VAR_NAME = "SHIPTHIS_DOMAIN";
71
53
  const DOMAIN = process.env[DOMAIN_ENV_VAR_NAME] || PRIMARY_DOMAIN;
72
54
  const BACKEND_URLS = getUrlsForDomain(DOMAIN);
73
55
  const API_URL = BACKEND_URLS.api;
@@ -94,15 +76,15 @@ function castJobDates(jobObject) {
94
76
  return castObjectDates(jobObject);
95
77
  }
96
78
  function getDateLocale() {
97
- const fallback = Intl.DateTimeFormat().resolvedOptions().locale.replace(/_/g, "-") || DEFAULT_LOCALE;
79
+ const fallback = Intl.DateTimeFormat().resolvedOptions().locale.replaceAll("_", "-") || DEFAULT_LOCALE;
98
80
  try {
99
- const env = process.env;
81
+ const { env } = process;
100
82
  const fullLocale = env.LC_TIME || env.LANG || env.LANGUAGE || env.LC_ALL || env.LC_MESSAGES;
101
- const shortLocale = fullLocale?.split(".")[0].replace(/_/g, "-");
83
+ const shortLocale = fullLocale?.split(".")[0].replaceAll("_", "-");
102
84
  const finalLocal = shortLocale || fallback;
103
85
  const _ = DateTime.now().toLocaleString(DateTime.DATE_SHORT, { locale: finalLocal });
104
86
  return finalLocal;
105
- } catch (e) {
87
+ } catch {
106
88
  return fallback;
107
89
  }
108
90
  }
@@ -127,16 +109,16 @@ function getShortTimeDelta(start, end) {
127
109
  });
128
110
  }
129
111
 
130
- const AUTH_ENV_VAR_NAME = "SHIPTHIS_TOKEN";
112
+ var currentAuthToken;
131
113
  function setAuthToken(token) {
132
- process.env[AUTH_ENV_VAR_NAME] = token;
114
+ currentAuthToken = token;
133
115
  }
134
116
  function getAuthToken() {
135
- return process.env[AUTH_ENV_VAR_NAME];
117
+ return currentAuthToken;
136
118
  }
137
119
  function getAuthedHeaders() {
138
120
  return {
139
- Authorization: `Bearer ${process.env[AUTH_ENV_VAR_NAME]}`
121
+ Authorization: `Bearer ${currentAuthToken}`
140
122
  };
141
123
  }
142
124
  async function createProject(props) {
@@ -215,9 +197,9 @@ async function getShortAuthRequiredUrl(destination) {
215
197
  const fullKey = `${key}${salt}`;
216
198
  const token = CryptoJS.AES.encrypt(email, fullKey).toString();
217
199
  const params = {
200
+ destination,
218
201
  key,
219
- token,
220
- destination
202
+ token
221
203
  };
222
204
  const queryString = Object.entries(params).map(([key2, value]) => `${key2}=${encodeURIComponent(`${value}`)}`).join("&");
223
205
  const url = `${WEB_URL}login/?${queryString}`;
@@ -287,12 +269,12 @@ async function inviteServiceAccount(projectId, developerId) {
287
269
  }
288
270
  async function downloadBuildById(projectId, buildId, fileName) {
289
271
  const build = await getBuild(projectId, buildId);
290
- const url = build.url;
272
+ const { url } = build;
291
273
  const writer = fs.createWriteStream(fileName);
292
274
  const response = await axios({
293
- url,
294
275
  method: "GET",
295
- responseType: "stream"
276
+ responseType: "stream",
277
+ url
296
278
  });
297
279
  response.data.pipe(writer);
298
280
  return new Promise((resolve, reject) => {
@@ -301,9 +283,27 @@ async function downloadBuildById(projectId, buildId, fileName) {
301
283
  });
302
284
  }
303
285
 
286
+ const defaultExport = expo.default;
287
+ const {
288
+ ApiKey,
289
+ ApiKeyType,
290
+ App,
291
+ Auth,
292
+ BetaGroup,
293
+ BundleId,
294
+ CapabilityType,
295
+ CapabilityTypeOption,
296
+ Certificate,
297
+ CertificateType,
298
+ Profile,
299
+ ProfileType,
300
+ Session,
301
+ UserRole
302
+ } = defaultExport;
303
+
304
304
  var Platform = /* @__PURE__ */ ((Platform2) => {
305
- Platform2["IOS"] = "IOS";
306
305
  Platform2["ANDROID"] = "ANDROID";
306
+ Platform2["IOS"] = "IOS";
307
307
  return Platform2;
308
308
  })(Platform || {});
309
309
  var GameEngine = /* @__PURE__ */ ((GameEngine2) => {
@@ -311,24 +311,24 @@ var GameEngine = /* @__PURE__ */ ((GameEngine2) => {
311
311
  return GameEngine2;
312
312
  })(GameEngine || {});
313
313
  var JobStatus = /* @__PURE__ */ ((JobStatus2) => {
314
- JobStatus2["PENDING"] = "PENDING";
315
- JobStatus2["PROCESSING"] = "PROCESSING";
316
314
  JobStatus2["COMPLETED"] = "COMPLETED";
317
315
  JobStatus2["FAILED"] = "FAILED";
316
+ JobStatus2["PENDING"] = "PENDING";
317
+ JobStatus2["PROCESSING"] = "PROCESSING";
318
318
  return JobStatus2;
319
319
  })(JobStatus || {});
320
320
  var JobStage = /* @__PURE__ */ ((JobStage2) => {
321
- JobStage2["SETUP"] = "SETUP";
322
- JobStage2["EXPORT"] = "EXPORT";
323
- JobStage2["CONFIGURE"] = "CONFIGURE";
324
321
  JobStage2["BUILD"] = "BUILD";
322
+ JobStage2["CONFIGURE"] = "CONFIGURE";
323
+ JobStage2["EXPORT"] = "EXPORT";
325
324
  JobStage2["PUBLISH"] = "PUBLISH";
325
+ JobStage2["SETUP"] = "SETUP";
326
326
  return JobStage2;
327
327
  })(JobStage || {});
328
328
  var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
329
+ LogLevel2["ERROR"] = "ERROR";
329
330
  LogLevel2["INFO"] = "INFO";
330
331
  LogLevel2["WARN"] = "WARN";
331
- LogLevel2["ERROR"] = "ERROR";
332
332
  return LogLevel2;
333
333
  })(LogLevel || {});
334
334
  var CredentialsType = /* @__PURE__ */ ((CredentialsType2) => {
@@ -337,9 +337,9 @@ var CredentialsType = /* @__PURE__ */ ((CredentialsType2) => {
337
337
  return CredentialsType2;
338
338
  })(CredentialsType || {});
339
339
  var BuildType = /* @__PURE__ */ ((BuildType2) => {
340
- BuildType2["IPA"] = "IPA";
341
- BuildType2["APK"] = "APK";
342
340
  BuildType2["AAB"] = "AAB";
341
+ BuildType2["APK"] = "APK";
342
+ BuildType2["IPA"] = "IPA";
343
343
  return BuildType2;
344
344
  })(BuildType || {});
345
345
 
@@ -350,12 +350,12 @@ function isCWDGodotGame() {
350
350
  }
351
351
  const GODOT_CAPABILITIES = [
352
352
  // TODO: how about capabilities from godot extensions
353
- { name: "Access WiFi", key: "capabilities/access_wifi", type: CapabilityType.ACCESS_WIFI },
354
- { name: "Push Notifications", key: "capabilities/push_notifications", type: CapabilityType.PUSH_NOTIFICATIONS }
353
+ { key: "capabilities/access_wifi", name: "Access WiFi", type: CapabilityType.ACCESS_WIFI },
354
+ { key: "capabilities/push_notifications", name: "Push Notifications", type: CapabilityType.PUSH_NOTIFICATIONS }
355
355
  ];
356
356
  function getGodotProjectCapabilities(platform) {
357
357
  const exportPresets = getGodotExportPresets(platform);
358
- const options = exportPresets.options;
358
+ const { options } = exportPresets;
359
359
  const capabilities = [];
360
360
  for (const capability of GODOT_CAPABILITIES) {
361
361
  if (!(capability.key in options)) continue;
@@ -372,8 +372,8 @@ function getGodotProjectConfig() {
372
372
  function getGodotProjectName() {
373
373
  try {
374
374
  const projectGodotConfig = getGodotProjectConfig();
375
- return projectGodotConfig["application"]["config/name"];
376
- } catch (e) {
375
+ return projectGodotConfig.application["config/name"];
376
+ } catch {
377
377
  return null;
378
378
  }
379
379
  }
@@ -381,8 +381,8 @@ function getGodotAppleBundleIdentifier() {
381
381
  try {
382
382
  const preset = getGodotExportPresets(Platform.IOS);
383
383
  return preset.options["application/bundle_identifier"];
384
- } catch (e) {
385
- console.log(e);
384
+ } catch (error) {
385
+ console.log(error);
386
386
  return null;
387
387
  }
388
388
  }
@@ -390,15 +390,15 @@ function getGodotAndroidPackageName() {
390
390
  try {
391
391
  const preset = getGodotExportPresets(Platform.ANDROID);
392
392
  return preset.options["package/unique_name"];
393
- } catch (e) {
394
- console.log(e);
393
+ } catch (error) {
394
+ console.log(error);
395
395
  return null;
396
396
  }
397
397
  }
398
398
  function getGodotVersion() {
399
399
  const projectGodotConfig = getGodotProjectConfig();
400
- if ("config/features" in projectGodotConfig["application"]) {
401
- const features = projectGodotConfig["application"]["config/features"];
400
+ if ("config/features" in projectGodotConfig.application) {
401
+ const features = projectGodotConfig.application["config/features"];
402
402
  const match = features.match(/"(\d+\.\d+)"/);
403
403
  if (!match) throw new Error("Couldn't find Godot version in project.godot");
404
404
  return match[1];
@@ -412,9 +412,7 @@ function getGodotExportPresets(platform) {
412
412
  const filename = "export_presets.cfg";
413
413
  const exportPresetsPath = path.join(cwd, filename);
414
414
  const isFound = fs__default.existsSync(exportPresetsPath);
415
- if (!isFound) {
416
- warn(`${filename} not found at ${exportPresetsPath}`);
417
- } else {
415
+ if (isFound) {
418
416
  const exportPresetsContent = fs__default.readFileSync(exportPresetsPath, "utf8");
419
417
  const exportPresetsIni = parse(exportPresetsContent);
420
418
  const presetIndexes = Object.keys(exportPresetsIni.preset);
@@ -422,89 +420,91 @@ function getGodotExportPresets(platform) {
422
420
  const current = exportPresetsIni.preset[index];
423
421
  return `${current.name}`.toUpperCase() === platform;
424
422
  });
425
- if (!presetIndex) {
426
- warn(`Preset ${platform} not found in ${filename} - will use defaults`);
427
- } else {
423
+ if (presetIndex) {
428
424
  presetConfig = merge(presetConfig, exportPresetsIni.preset[presetIndex]);
425
+ } else {
426
+ warn(`Preset ${platform} not found in ${filename} - will use defaults`);
429
427
  }
428
+ } else {
429
+ warn(`${filename} not found at ${exportPresetsPath}`);
430
430
  }
431
431
  return presetConfig;
432
432
  }
433
433
  function getBaseExportPresets_iOS() {
434
434
  return {
435
- name: "iOS",
436
- platform: "iOS",
437
- runnable: true,
438
- dedicated_server: false,
439
435
  custom_features: "",
440
- export_filter: "all_resources",
441
- include_filter: "",
436
+ dedicated_server: false,
437
+ encrypt_directory: false,
438
+ encrypt_pck: false,
439
+ encryption_exclude_filters: "",
440
+ encryption_include_filters: "",
442
441
  exclude_filter: "",
442
+ export_filter: "all_resources",
443
443
  export_path: "output",
444
- encryption_include_filters: "",
445
- encryption_exclude_filters: "",
446
- encrypt_pck: false,
447
- encrypt_directory: false,
444
+ include_filter: "",
445
+ name: "iOS",
448
446
  options: {
449
- "custom_template/debug": "",
450
- "custom_template/release": "",
451
- "architectures/arm64": true,
452
- "application/signature": "",
447
+ "application/export_project_only": true,
453
448
  "application/icon_interpolation": "4",
454
449
  "application/launch_screens_interpolation": "4",
455
- "application/export_project_only": true,
450
+ "application/short_version": "1.0.0",
451
+ // default version number
452
+ "application/signature": "",
453
+ "architectures/arm64": true,
456
454
  "capabilities/access_wifi": false,
457
455
  "capabilities/push_notifications": false,
458
- "user_data/accessible_from_files_app": false,
459
- "user_data/accessible_from_itunes_sharing": false,
460
- "privacy/camera_usage_description": "",
461
- "privacy/camera_usage_description_localized": "{}",
462
- "privacy/microphone_usage_description": "",
463
- "privacy/microphone_usage_description_localized": "{}",
464
- "privacy/photolibrary_usage_description": "",
465
- "privacy/photolibrary_usage_description_localized": "{}",
466
- "icons/iphone_120x120": "",
467
- "icons/iphone_180x180": "",
456
+ "custom_template/debug": "",
457
+ "custom_template/release": "",
458
+ "icons/app_store_1024x1024": "",
468
459
  "icons/ipad_76x76": "",
469
460
  "icons/ipad_152x152": "",
470
461
  "icons/ipad_167x167": "",
471
- "icons/app_store_1024x1024": "",
472
- "icons/spotlight_40x40": "",
473
- "icons/spotlight_80x80": "",
474
- "icons/settings_58x58": "",
475
- "icons/settings_87x87": "",
462
+ "icons/iphone_120x120": "",
463
+ "icons/iphone_180x180": "",
476
464
  "icons/notification_40x40": "",
477
465
  "icons/notification_60x60": "",
478
- "storyboard/use_launch_screen_storyboard": true,
479
- "storyboard/image_scale_mode": "0",
480
- "storyboard/custom_image@2x": "",
481
- "storyboard/custom_image@3x": "",
482
- "storyboard/use_custom_bg_color": false,
483
- "storyboard/custom_bg_color": "Color(0, 0, 0, 1)",
484
- "landscape_launch_screens/iphone_2436x1125": "",
485
- "landscape_launch_screens/iphone_2208x1242": "",
466
+ "icons/settings_58x58": "",
467
+ "icons/settings_87x87": "",
468
+ "icons/spotlight_40x40": "",
469
+ "icons/spotlight_80x80": "",
486
470
  "landscape_launch_screens/ipad_1024x768": "",
487
471
  "landscape_launch_screens/ipad_2048x1536": "",
472
+ "landscape_launch_screens/iphone_2208x1242": "",
473
+ "landscape_launch_screens/iphone_2436x1125": "",
474
+ "portrait_launch_screens/ipad_768x1024": "",
475
+ "portrait_launch_screens/ipad_1536x2048": "",
488
476
  "portrait_launch_screens/iphone_640x960": "",
489
477
  "portrait_launch_screens/iphone_640x1136": "",
490
478
  "portrait_launch_screens/iphone_750x1334": "",
491
479
  "portrait_launch_screens/iphone_1125x2436": "",
492
- "portrait_launch_screens/ipad_768x1024": "",
493
- "portrait_launch_screens/ipad_1536x2048": "",
494
480
  "portrait_launch_screens/iphone_1242x2208": "",
495
- "application/short_version": "1.0.0"
496
- // default version number
497
- }
481
+ "privacy/camera_usage_description": "",
482
+ "privacy/camera_usage_description_localized": "{}",
483
+ "privacy/microphone_usage_description": "",
484
+ "privacy/microphone_usage_description_localized": "{}",
485
+ "privacy/photolibrary_usage_description": "",
486
+ "privacy/photolibrary_usage_description_localized": "{}",
487
+ "storyboard/custom_bg_color": "Color(0, 0, 0, 1)",
488
+ "storyboard/custom_image@2x": "",
489
+ "storyboard/custom_image@3x": "",
490
+ "storyboard/image_scale_mode": "0",
491
+ "storyboard/use_custom_bg_color": false,
492
+ "storyboard/use_launch_screen_storyboard": true,
493
+ "user_data/accessible_from_files_app": false,
494
+ "user_data/accessible_from_itunes_sharing": false
495
+ },
496
+ platform: "iOS",
497
+ runnable: true
498
498
  };
499
499
  }
500
500
  function getBaseExportPresets_Android() {
501
501
  return {
502
502
  name: "Android",
503
- platform: "Android",
504
503
  // TODO
505
504
  options: {
506
505
  // TODO
507
- }
506
+ },
507
+ platform: "Android"
508
508
  };
509
509
  }
510
510
 
@@ -517,103 +517,138 @@ const queryClient = new QueryClient({
517
517
  });
518
518
 
519
519
  class BaseCommand extends Command {
520
- // add the --json flag
521
- static enableJsonFlag = false;
522
520
  // define flags that can be inherited by any command that extends BaseCommand
523
521
  static baseFlags = {};
524
- flags;
522
+ // add the --json flag
523
+ static enableJsonFlag = false;
525
524
  args;
526
- async init() {
527
- process.on("SIGINT", () => process.exit(0));
528
- process.on("SIGTERM", () => process.exit(0));
529
- await super.init();
530
- const { args, flags } = await this.parse({
531
- flags: this.ctor.flags,
532
- baseFlags: super.ctor.baseFlags,
533
- enableJsonFlag: this.ctor.enableJsonFlag,
534
- args: this.ctor.args,
535
- strict: this.ctor.strict
536
- });
537
- this.flags = flags;
538
- this.args = args;
539
- if (this.hasAuthConfig()) await this.loadAuthConfig();
540
- }
525
+ flags;
541
526
  async catch(err) {
542
527
  return super.catch(err);
543
528
  }
544
- async finally(_) {
545
- return super.finally(_);
529
+ // Used in baseGameCommand and the other commands that need to ensure that the CWD is a Godot project
530
+ ensureWeAreInAProjectDir() {
531
+ if (!isCWDGodotGame()) {
532
+ this.error("No Godot project detected. Please run this from a godot project directory.", { exit: 1 });
533
+ }
534
+ if (!this.hasProjectConfig()) {
535
+ this.error(
536
+ 'No ShipThis config found. Please run `shipthis game create --name "Space Invaders"` to create a game.',
537
+ { exit: 1 }
538
+ );
539
+ }
546
540
  }
547
- // Exposing it to the react components using the CommandContext
548
- getFlags() {
549
- return this.flags;
541
+ ensureWeHaveAppleCookies() {
542
+ if (!this.hasAuthConfigFile()) {
543
+ this.error("You must be authenticated with Apple in to use this command. Please run shipthis apple login", {
544
+ exit: 1
545
+ });
546
+ }
550
547
  }
551
- getAuthConfigPath() {
552
- return path.join(this.config.home, ".shipthis.auth.json");
548
+ async finally(_) {
549
+ return super.finally(_);
553
550
  }
554
- hasAuthConfig() {
555
- const configPath = this.getAuthConfigPath();
556
- return fs__default.existsSync(configPath);
551
+ // Used in the apple commands to get the cookies from the auth file
552
+ async getAppleCookies() {
553
+ const authConfig = await this.getAuthConfig();
554
+ if (!authConfig.appleCookies) return null;
555
+ return authConfig.appleCookies;
557
556
  }
557
+ // Returns the current auth config - prefers to use the env var
558
558
  async getAuthConfig() {
559
+ const envVarValue = process.env[AUTH_ENV_VAR_NAME];
560
+ if (!envVarValue) return await this.getAuthConfigFromFile();
561
+ setAuthToken(envVarValue);
562
+ const self = await getSelf();
563
+ const selfWithJwt = {
564
+ ...self,
565
+ jwt: envVarValue
566
+ };
567
+ return {
568
+ shipThisUser: selfWithJwt
569
+ };
570
+ }
571
+ // Loads the auth config from the file system
572
+ async getAuthConfigFromFile() {
559
573
  const baseConfig = {};
560
574
  const configPath = this.getAuthConfigPath();
561
575
  if (!fs__default.existsSync(configPath)) return baseConfig;
562
576
  const raw = await fs__default.promises.readFile(configPath, "utf8");
563
- const typesConfig = JSON.parse(raw);
577
+ const parsed = JSON.parse(raw);
578
+ if (parsed.shipThisUser) {
579
+ setAuthToken(parsed.shipThisUser.jwt);
580
+ }
564
581
  return {
565
582
  ...baseConfig,
566
- ...typesConfig
583
+ ...parsed
567
584
  };
568
585
  }
569
- async setAuthConfig(config) {
570
- const configPath = this.getAuthConfigPath();
571
- await fs__default.promises.writeFile(configPath, JSON.stringify(config, null, 2));
572
- }
573
- async loadAuthConfig() {
574
- const authConfig = await this.getAuthConfig();
575
- if (!authConfig.shipThisUser) {
576
- throw new Error("You must be logged in to use this command");
586
+ // This is used to expose the flags to the Android Wizard
587
+ getDetailsFlagsValues() {
588
+ const keys = Object.keys(DetailsFlags);
589
+ const values = {};
590
+ for (const key of keys) {
591
+ if (this.flags[key]) values[key] = this.flags[key];
577
592
  }
578
- setAuthToken(authConfig.shipThisUser.jwt);
593
+ return values;
579
594
  }
580
- getProjectConfigPath() {
581
- return path.join(process.cwd(), "shipthis.json");
595
+ // Exposing it to the react components using the CommandContext
596
+ getFlags() {
597
+ return this.flags;
582
598
  }
583
- hasProjectConfig() {
584
- const configPath = this.getProjectConfigPath();
585
- return fs__default.existsSync(configPath);
599
+ getGameId() {
600
+ const { flags } = this;
601
+ if (flags.gameId) return flags.gameId;
602
+ const { project } = this.getProjectConfigSafe();
603
+ if (!project) return null;
604
+ return project.id;
586
605
  }
587
606
  async getProjectConfig() {
588
607
  if (!this.hasProjectConfig()) throw new Error("No project config found");
589
608
  return this.getProjectConfigSafe();
590
609
  }
591
- async getProjectConfigSafe() {
610
+ getProjectConfigSafe() {
592
611
  if (!this.hasProjectConfig()) return {};
593
612
  const configPath = this.getProjectConfigPath();
594
- const raw = await fs__default.promises.readFile(configPath, "utf8");
613
+ const raw = fs__default.readFileSync(configPath, "utf8");
595
614
  return JSON.parse(raw);
596
615
  }
597
- async setProjectConfig(config) {
598
- const configPath = this.getProjectConfigPath();
599
- await fs__default.promises.writeFile(configPath, JSON.stringify(config, null, 2));
616
+ hasAuthConfigFile() {
617
+ const configPath = this.getAuthConfigPath();
618
+ return fs__default.existsSync(configPath);
600
619
  }
601
- async updateProjectConfig(update) {
602
- const config = await this.getProjectConfig();
603
- await this.setProjectConfig({ ...config, ...update });
620
+ hasProjectConfig() {
621
+ const configPath = this.getProjectConfigPath();
622
+ return fs__default.existsSync(configPath);
604
623
  }
605
- // Used in baseGameCommand and the other commands that need to ensure that the CWD is a Godot project
606
- ensureWeAreInAProjectDir() {
607
- if (!isCWDGodotGame()) {
608
- this.error("No Godot project detected. Please run this from a godot project directory.", { exit: 1 });
609
- }
610
- if (!this.hasProjectConfig()) {
611
- this.error(
612
- 'No ShipThis config found. Please run `shipthis game create --name "Space Invaders"` to create a game.',
613
- { exit: 1 }
614
- );
624
+ // Tests the apple cookies
625
+ async hasValidAppleAuthState() {
626
+ try {
627
+ await this.refreshAppleAuthState();
628
+ return true;
629
+ } catch {
630
+ return false;
615
631
  }
616
632
  }
633
+ async init() {
634
+ process.on("SIGINT", () => process.exit(0));
635
+ process.on("SIGTERM", () => process.exit(0));
636
+ await super.init();
637
+ const { args, flags } = await this.parse({
638
+ args: this.ctor.args,
639
+ baseFlags: super.ctor.baseFlags,
640
+ enableJsonFlag: this.ctor.enableJsonFlag,
641
+ flags: this.ctor.flags,
642
+ strict: this.ctor.strict
643
+ });
644
+ this.flags = flags;
645
+ this.args = args;
646
+ await this.getAuthConfig();
647
+ }
648
+ async isAuthenticated() {
649
+ const authConfig = await this.getAuthConfig();
650
+ return Boolean(authConfig.shipThisUser?.jwt);
651
+ }
617
652
  async refreshAppleAuthState() {
618
653
  const cookies = await this.getAppleCookies();
619
654
  const rerunMessage = "Please run shipthis apple login to authenticate with Apple.";
@@ -627,48 +662,29 @@ class BaseCommand extends Command {
627
662
  if (!authState) throw new Error(`Failed to refresh Apple auth state. ${rerunMessage}`);
628
663
  return authState;
629
664
  }
630
- // Tests the apple cookies
631
- async hasValidAppleAuthState() {
632
- try {
633
- await this.refreshAppleAuthState();
634
- return true;
635
- } catch (e) {
636
- return false;
637
- }
638
- }
639
- // Used in the apple commands to get the cookies from the auth file
640
- async getAppleCookies() {
641
- const authConfig = await this.getAuthConfig();
642
- if (!authConfig.appleCookies) return null;
643
- return authConfig.appleCookies;
644
- }
645
665
  async setAppleCookies(cookies) {
646
666
  const authConfig = await this.getAuthConfig();
647
667
  await this.setAuthConfig({ ...authConfig, appleCookies: cookies });
648
668
  }
649
- ensureWeHaveAppleCookies() {
650
- if (!this.hasAuthConfig()) {
651
- this.error("You must be authenticated with Apple in to use this command. Please run shipthis apple login", {
652
- exit: 1
653
- });
654
- }
669
+ // This is called after login to persist the JWT and user details
670
+ async setAuthConfig(config) {
671
+ const configPath = this.getAuthConfigPath();
672
+ await fs__default.promises.writeFile(configPath, JSON.stringify(config, null, 2));
673
+ }
674
+ async setProjectConfig(config) {
675
+ const configPath = this.getProjectConfigPath();
676
+ await fs__default.promises.writeFile(configPath, JSON.stringify(config, null, 2));
677
+ }
678
+ async updateProjectConfig(update) {
679
+ const config = await this.getProjectConfig();
680
+ await this.setProjectConfig({ ...config, ...update });
655
681
  }
656
682
  // Returns the values of the flags in DetailsFlags
657
- // This is used to expose the flags to the Android Wizard
658
- getDetailsFlagsValues() {
659
- const keys = Object.keys(DetailsFlags);
660
- const values = {};
661
- for (const key of keys) {
662
- if (this.flags[key]) values[key] = this.flags[key];
663
- }
664
- return values;
683
+ getAuthConfigPath() {
684
+ return path.join(this.config.home, ".shipthis.auth.json");
665
685
  }
666
- async getGameId() {
667
- const { flags } = this;
668
- if (flags.gameId) return flags.gameId;
669
- const { project } = await this.getProjectConfigSafe();
670
- if (!project) return null;
671
- return project.id;
686
+ getProjectConfigPath() {
687
+ return path.join(process.cwd(), "shipthis.json");
672
688
  }
673
689
  }
674
690
 
@@ -676,11 +692,11 @@ class BaseAuthenticatedCommand extends BaseCommand {
676
692
  static flags = {};
677
693
  async init() {
678
694
  await super.init();
679
- if (!this.hasAuthConfig()) {
695
+ if (!this.isAuthenticated()) {
680
696
  this.error("No auth config found. Please run `shipthis login` to authenticate.", { exit: 1 });
681
697
  }
682
698
  const self = await getSelf();
683
- const accepted = !!self.details?.hasAcceptedTerms;
699
+ const accepted = Boolean(self.details?.hasAcceptedTerms);
684
700
  if (!accepted) {
685
701
  this.error("You must accept the terms and conditions. Please run `shipthis login --force` to re-authenticate", {
686
702
  exit: 1
@@ -699,10 +715,10 @@ class BaseGameCommand extends BaseAuthenticatedCommand {
699
715
  const gameId = await this.getGameId();
700
716
  if (!gameId) this.error("No game ID found.");
701
717
  return await getProject(gameId);
702
- } catch (e) {
703
- if (e?.response?.status === 404) {
718
+ } catch (error) {
719
+ if (error?.response?.status === 404) {
704
720
  this.error("Game not found - please check you have access");
705
- } else throw e;
721
+ } else throw error;
706
722
  }
707
723
  }
708
724
  async updateGame(update) {
@@ -718,15 +734,15 @@ class BaseGameCommand extends BaseAuthenticatedCommand {
718
734
  }
719
735
 
720
736
  const DetailsFlags = {
721
- name: Flags.string({ char: "n", description: "The name of the game" }),
737
+ androidPackageName: Flags.string({ char: "a", description: "Set the Android package name" }),
722
738
  buildNumber: Flags.integer({ char: "b", description: "Set the build number" }),
723
- semanticVersion: Flags.string({ char: "s", description: "Set the semantic version" }),
724
739
  gameEngine: Flags.string({ char: "e", description: "Set the game engine" }),
725
740
  gameEngineVersion: Flags.string({ char: "v", description: "Set the game engine version" }),
726
- iosBundleId: Flags.string({ char: "i", description: "Set the iOS bundle ID" }),
727
- androidPackageName: Flags.string({ char: "a", description: "Set the Android package name" }),
728
741
  gcpProjectId: Flags.string({ char: "g", description: "Set the GCP project ID" }),
729
- gcpServiceAccountId: Flags.string({ char: "c", description: "Set the GCP service account ID" })
742
+ gcpServiceAccountId: Flags.string({ char: "c", description: "Set the GCP service account ID" }),
743
+ iosBundleId: Flags.string({ char: "i", description: "Set the iOS bundle ID" }),
744
+ name: Flags.string({ char: "n", description: "The name of the game" }),
745
+ semanticVersion: Flags.string({ char: "s", description: "Set the semantic version" })
730
746
  };
731
747
 
732
- export { getNewUploadTicket as $, ApiKey as A, BaseAuthenticatedCommand as B, CredentialsType as C, DetailsFlags as D, getJob as E, getProject as F, GODOT_CAPABILITIES as G, downloadBuildById as H, castArrayObjectDates as I, JobStatus as J, JobStage as K, LogLevel as L, getAuthToken as M, WS_URL as N, getGodotAndroidPackageName as O, Platform as P, getGoogleStatus as Q, inviteServiceAccount as R, disconnectGoogle as S, BaseCommand as T, UserRole as U, getSingleUseUrl as V, WEB_URL as W, setAuthToken as X, acceptTerms as Y, Auth as Z, queryClient as _, ApiKeyType as a, startJobsFromUpload as a0, castObjectDates as a1, getShortAuthRequiredUrl as a2, castJobDates as a3, getShortTime as a4, getShortDateTime as a5, getShortTimeDelta as a6, BuildType as a7, getGoogleAuthUrl as a8, updateProject as a9, 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, getProjectJobs as z };
748
+ export { getNewUploadTicket as $, ApiKey as A, BaseAuthenticatedCommand as B, CredentialsType as C, DetailsFlags as D, getProject as E, getProjectPlatformProgress as F, GODOT_CAPABILITIES as G, downloadBuildById as H, castArrayObjectDates as I, JobStatus as J, queryClient as K, JobStage as L, LogLevel as M, WS_URL as N, getAuthToken as O, Platform as P, getGoogleStatus as Q, getGodotAndroidPackageName as R, inviteServiceAccount as S, disconnectGoogle as T, UserRole as U, BaseCommand as V, WEB_URL as W, getSingleUseUrl as X, setAuthToken as Y, acceptTerms as Z, Auth as _, ApiKeyType as a, startJobsFromUpload as a0, castObjectDates as a1, getShortAuthRequiredUrl as a2, getGoogleAuthUrl as a3, castJobDates as a4, getShortTime as a5, getShortDateTime as a6, getShortTimeDelta as a7, BuildType as a8, updateProject as a9, 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, Certificate as k, CertificateType as l, Profile as m, ProfileType as n, API_URL as o, getAuthedHeaders as p, getGodotProjectCapabilities as q, CapabilityType as r, GameEngine as s, getGodotVersion as t, createProject as u, DEFAULT_SHIPPED_FILES_GLOBS as v, DEFAULT_IGNORED_FILES_GLOBS as w, getGodotProjectName as x, getProjectJobs as y, getJob as z };