shipthis 0.1.31 → 0.1.33

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