shipthis 0.1.23 → 0.1.25

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 +25 -16
  2. package/docs/assets/ship-outputx0.8.gif +0 -0
  3. package/package.json +1 -1
  4. package/bin/readme.sh +0 -15
  5. package/dist/AppleBundleIdDetails-C9C5WSPR.js +0 -76
  6. package/dist/Command-BQCJ9Wf-.js +0 -28
  7. package/dist/CommandGame-CkGqTno0.js +0 -9
  8. package/dist/Create-t_E231OA.js +0 -59
  9. package/dist/Import-Ljz1gxXd.js +0 -110
  10. package/dist/JobProgress-D9tHgBvi.js +0 -121
  11. package/dist/JobStatusTable-DmI7qCHc.js +0 -203
  12. package/dist/NextSteps-CK9zHOCt.js +0 -18
  13. package/dist/ProgressSpinner-6pw1T8Iw.js +0 -16
  14. package/dist/ProjectCredentialsTable-CTkP1mvy.js +0 -37
  15. package/dist/RunWithSpinner-BVXNWGD3.js +0 -27
  16. package/dist/StatusTable-Dm5St4g-.js +0 -33
  17. package/dist/Table-CvM6pccN.js +0 -101
  18. package/dist/Title-BCQtayg6.js +0 -6
  19. package/dist/UserCredentialsTable-DhtM_iTG.js +0 -82
  20. package/dist/baseAppleCommand-IGl6KTvv.js +0 -10
  21. package/dist/baseGameAndroidCommand-DFn4zMvq.js +0 -43
  22. package/dist/commands/apple/apiKey/create.js +0 -103
  23. package/dist/commands/apple/apiKey/export.js +0 -81
  24. package/dist/commands/apple/apiKey/import.js +0 -85
  25. package/dist/commands/apple/apiKey/status.js +0 -122
  26. package/dist/commands/apple/certificate/create.js +0 -133
  27. package/dist/commands/apple/certificate/export.js +0 -81
  28. package/dist/commands/apple/certificate/import.js +0 -85
  29. package/dist/commands/apple/certificate/status.js +0 -130
  30. package/dist/commands/apple/login.js +0 -76
  31. package/dist/commands/apple/status.js +0 -79
  32. package/dist/commands/dashboard.js +0 -38
  33. package/dist/commands/game/android/apiKey/connect.js +0 -74
  34. package/dist/commands/game/android/apiKey/create.js +0 -74
  35. package/dist/commands/game/android/apiKey/export.js +0 -84
  36. package/dist/commands/game/android/apiKey/import.js +0 -93
  37. package/dist/commands/game/android/apiKey/invite.js +0 -81
  38. package/dist/commands/game/android/apiKey/status.js +0 -87
  39. package/dist/commands/game/android/keyStore/create.js +0 -69
  40. package/dist/commands/game/android/keyStore/export.js +0 -83
  41. package/dist/commands/game/android/keyStore/import.js +0 -112
  42. package/dist/commands/game/android/keyStore/status.js +0 -70
  43. package/dist/commands/game/android/status.js +0 -84
  44. package/dist/commands/game/build/download.js +0 -80
  45. package/dist/commands/game/build/list.js +0 -94
  46. package/dist/commands/game/create.js +0 -67
  47. package/dist/commands/game/details.js +0 -113
  48. package/dist/commands/game/export.js +0 -58
  49. package/dist/commands/game/ios/app/addTester.js +0 -124
  50. package/dist/commands/game/ios/app/create.js +0 -117
  51. package/dist/commands/game/ios/app/status.js +0 -66
  52. package/dist/commands/game/ios/app/sync.js +0 -95
  53. package/dist/commands/game/ios/profile/create.js +0 -129
  54. package/dist/commands/game/ios/profile/export.js +0 -83
  55. package/dist/commands/game/ios/profile/import.js +0 -92
  56. package/dist/commands/game/ios/profile/status.js +0 -139
  57. package/dist/commands/game/ios/status.js +0 -92
  58. package/dist/commands/game/ios/wizard.js +0 -153
  59. package/dist/commands/game/job/list.js +0 -91
  60. package/dist/commands/game/job/status.js +0 -91
  61. package/dist/commands/game/list.js +0 -83
  62. package/dist/commands/game/ship.js +0 -205
  63. package/dist/commands/game/status.js +0 -114
  64. package/dist/commands/game/wizard.js +0 -686
  65. package/dist/commands/internal/fastlane.js +0 -74
  66. package/dist/commands/internal/readme.js +0 -937
  67. package/dist/commands/login.js +0 -92
  68. package/dist/commands/status.js +0 -76
  69. package/dist/export-CVs_xoDN.js +0 -36
  70. package/dist/git-DREGq-jc.js +0 -32
  71. package/dist/import-Ch5O7xfN.js +0 -47
  72. package/dist/index-BB00V5oF.js +0 -136
  73. package/dist/index-CIa2EDQ6.js +0 -24
  74. package/dist/index-DkNQs11R.js +0 -711
  75. package/dist/index-DrcGhlrc.js +0 -138
  76. package/dist/index-DyOv-ge5.js +0 -125
  77. package/dist/index-vMXsdSCy.js +0 -208
  78. package/dist/index.d.ts +0 -1
  79. package/dist/index.js +0 -1
  80. package/dist/upload-CRE2nVdd.js +0 -60
  81. package/dist/useAndroidServiceAccountTestResult-DcYDam-p.js +0 -52
  82. package/dist/useAppleApp-B16WbUxJ.js +0 -32
  83. package/dist/useAppleBundleId-DobPATan.js +0 -64
  84. package/dist/useJobWatching-BZSUa8E-.js +0 -45
  85. package/dist/useProjectCredentials-Btnr7WK3.js +0 -54
  86. package/dist/useWebSocket-ByuNoqRw.js +0 -36
  87. package/dist/utils/help.js +0 -14
  88. package/npm-shrinkwrap.json +0 -14011
  89. package/oclif.manifest.json +0 -2275
package/README.md CHANGED
@@ -23,11 +23,35 @@
23
23
  </picture>
24
24
  </p>
25
25
 
26
- ---
27
26
 
28
27
  > [!IMPORTANT]
29
28
  > ShipThis is in open beta. While in beta, it is completely free to use.
30
29
 
30
+ ---
31
+
32
+
33
+ <details>
34
+ <summary><strong>Watch: Set up ShipThis for iOS</strong></summary>
35
+
36
+ <p align="center">
37
+ <a href="https://www.youtube.com/watch?v=ijTUFVk1duw" target="_blank">
38
+ <img src="https://img.youtube.com/vi/ijTUFVk1duw/0.jpg" alt="Watch the iOS setup video" width="640" height="480">
39
+ </a>
40
+ </p>
41
+
42
+ </details>
43
+ <details>
44
+ <summary><strong>Watch: Set up ShipThis for Android</strong></summary>
45
+
46
+ <p align="center">
47
+ <picture>
48
+ <img height="431" width="672" alt="ShipThis Command - Android Wizard - published game" src="docs/assets/wizard-android-existingx0.5.gif">
49
+ </picture>
50
+ </p>
51
+
52
+ </details>
53
+
54
+
31
55
  ## ❓ Why use ShipThis?
32
56
 
33
57
  - **✅ Always a free tier** – Enough usage for most solo devs.
@@ -73,21 +97,6 @@ Next, run the [wizard command](https://shipth.is/docs/reference/game/wizard) to
73
97
  shipthis game wizard android
74
98
  ```
75
99
 
76
- <details>
77
- <summary>Watch: Android wizard run for a published Google Play game</summary>
78
-
79
- <p align="center">
80
- <picture>
81
- <img height="431" width="672" alt="ShipThis Command - Android Wizard - published game" src="docs/assets/wizard-android-existingx0.5.gif">
82
- </picture>
83
- </p>
84
-
85
- The wizard will ask if you would like to import an existing Keystore. You will need the password and path to the JKS file.
86
-
87
- If your game is already published on Google Play, the wizard will skip the initial build upload step. Once you have connected ShipThis with Google, the wizard will be able to determine if the game exists in Google Play.
88
-
89
- </details>
90
-
91
100
  ### Set up an iOS game
92
101
 
93
102
  ```bash
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shipthis",
3
3
  "description": "ShipThis manages building and uploading your Godot games to the App Store and Google Play.",
4
- "version": "0.1.23",
4
+ "version": "0.1.25",
5
5
  "author": "Hello Invent Ltd",
6
6
  "bin": {
7
7
  "shipthis": "./bin/run.js"
package/bin/readme.sh DELETED
@@ -1,15 +0,0 @@
1
- #!/bin/bash
2
-
3
- scriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4
-
5
- cd $scriptDir/..
6
-
7
- # We want to avoid overwriting the docs we have manually written
8
-
9
- bin/dev.js internal readme docs/ -d 2 --only docs/game --notDryRun --overWrite
10
- bin/dev.js internal readme docs/ -d 2 --only docs/apple/apiKey --notDryRun --overWrite
11
- bin/dev.js internal readme docs/ -d 2 --only docs/apple/certificate --notDryRun --overWrite
12
- bin/dev.js internal readme docs/ -d 2 --only docs/login.md --notDryRun --overWrite
13
- bin/dev.js internal readme docs/ -d 2 --only docs/status.md --notDryRun --overWrite
14
- bin/dev.js internal readme docs/ -d 2 --only docs/dashboard.md --notDryRun --overWrite
15
- bin/dev.js internal readme docs/ -d 2 --only docs/help.md --notDryRun --overWrite
@@ -1,76 +0,0 @@
1
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import { Box, Text } from 'ink';
3
- import Spinner from 'ink-spinner';
4
- import './index-DkNQs11R.js';
5
- import 'axios';
6
- import '@tanstack/react-query';
7
- import 'crypto';
8
- import 'fs';
9
- import 'readline-sync';
10
- import 'node:readline';
11
- import 'node:path';
12
- import 'node:url';
13
- import 'luxon';
14
- import 'isomorphic-git';
15
- import '@oclif/core';
16
- import 'react';
17
- import 'crypto-js';
18
- import 'uuid';
19
- import 'socket.io-client';
20
- import { u as useAppleApp } from './useAppleApp-B16WbUxJ.js';
21
- import 'fast-glob';
22
- import 'yazl';
23
- import '@inkjs/ui';
24
- import './index-vMXsdSCy.js';
25
- import 'open';
26
- import { T as Table } from './Table-CvM6pccN.js';
27
- import { T as Title } from './Title-BCQtayg6.js';
28
- import 'string-length';
29
- import 'strip-ansi';
30
- import 'marked';
31
- import 'marked-terminal';
32
- import 'path';
33
- import 'qrcode';
34
- import { u as useAppleBundleId } from './useAppleBundleId-DobPATan.js';
35
-
36
- const AppleAppDetails = (props) => {
37
- const { data, isLoading } = useAppleApp(props);
38
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
39
- /* @__PURE__ */ jsx(Title, { children: "App Details (in the Apple Developer Portal)" }),
40
- isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }),
41
- data && data.summary && /* @__PURE__ */ jsx(Table, { data: [data.summary] })
42
- ] });
43
- };
44
-
45
- const AppleBundleIdDetails = (props) => {
46
- const { data, isLoading } = useAppleBundleId(props);
47
- const { bundleIdSummary, capabilitiesTable, shouldSyncCapabilities, capabilities } = data || {};
48
- return /* @__PURE__ */ jsxs(Fragment, { children: [
49
- /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
50
- /* @__PURE__ */ jsx(Title, { children: "BundleId Details (in the Apple Developer Portal)" }),
51
- isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }),
52
- bundleIdSummary && /* @__PURE__ */ jsx(Table, { data: [bundleIdSummary] })
53
- ] }),
54
- capabilities && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
55
- /* @__PURE__ */ jsx(Title, { children: "Capabilities enabled in the BundleId" }),
56
- /* @__PURE__ */ jsx(
57
- Table,
58
- {
59
- data: capabilities.map((c) => {
60
- return { capability: `${c}` };
61
- })
62
- }
63
- )
64
- ] }),
65
- capabilitiesTable && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
66
- /* @__PURE__ */ jsx(Title, { children: "BundleId Capability Check" }),
67
- /* @__PURE__ */ jsx(Table, { data: capabilitiesTable })
68
- ] }),
69
- shouldSyncCapabilities && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
70
- /* @__PURE__ */ jsx(Text, { bold: true, children: "The capabilities are out of sync with the Apple Developer Portal." }),
71
- /* @__PURE__ */ jsx(Text, { bold: true, children: "Run shipthis game ios app sync" })
72
- ] })
73
- ] });
74
- };
75
-
76
- export { AppleAppDetails as A, AppleBundleIdDetails as a };
@@ -1,28 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { Box } from 'ink';
3
- import { QueryClientProvider } from '@tanstack/react-query';
4
- import { M as queryClient } from './index-DkNQs11R.js';
5
- import 'axios';
6
- import 'crypto';
7
- import 'fs';
8
- import 'readline-sync';
9
- import 'node:readline';
10
- import 'node:path';
11
- import 'node:url';
12
- import 'luxon';
13
- import 'isomorphic-git';
14
- import '@oclif/core';
15
- import 'react';
16
- import 'crypto-js';
17
- import 'uuid';
18
- import 'socket.io-client';
19
- import 'fast-glob';
20
- import 'yazl';
21
- import { C as CommandProvider } from './index-vMXsdSCy.js';
22
-
23
- const Command = ({ children, command }) => {
24
- const width = process.stdout.columns || 80;
25
- return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(CommandProvider, { command, children: /* @__PURE__ */ jsx(Box, { width, flexDirection: "column", children }) }) });
26
- };
27
-
28
- export { Command as C };
@@ -1,9 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { G as GameProvider } from './index-vMXsdSCy.js';
3
- import { C as Command } from './Command-BQCJ9Wf-.js';
4
-
5
- const CommandGame = ({ children, command }) => {
6
- return /* @__PURE__ */ jsx(Command, { command, children: /* @__PURE__ */ jsx(GameProvider, { children }) });
7
- };
8
-
9
- export { CommandGame as C };
@@ -1,59 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { Box } from 'ink';
3
- import axios from 'axios';
4
- import { useContext } from 'react';
5
- import { useQueryClient } from '@tanstack/react-query';
6
- import { p as getAuthedHeaders, q as API_URL } from './index-DkNQs11R.js';
7
- import { c as cacheKeys } from './useAndroidServiceAccountTestResult-DcYDam-p.js';
8
- import { b as GameContext } from './index-vMXsdSCy.js';
9
- import 'ink-spinner';
10
- import '@inkjs/ui';
11
- import 'fs';
12
- import 'uuid';
13
- import 'yazl';
14
- import 'crypto';
15
- import 'readline-sync';
16
- import 'node:readline';
17
- import 'node:path';
18
- import 'node:url';
19
- import 'luxon';
20
- import 'isomorphic-git';
21
- import '@oclif/core';
22
- import 'fast-glob';
23
- import 'socket.io-client';
24
- import 'open';
25
- import 'marked';
26
- import 'marked-terminal';
27
- import 'path';
28
- import 'qrcode';
29
- import { R as RunWithSpinner } from './RunWithSpinner-BVXNWGD3.js';
30
- import 'string-length';
31
- import 'strip-ansi';
32
-
33
- const CreateKeystore = ({ onComplete, onError, ...boxProps }) => {
34
- const { gameId } = useContext(GameContext);
35
- const queryClient = useQueryClient();
36
- const handleCreate = async () => {
37
- try {
38
- if (!gameId) throw new Error("No game");
39
- const headers = await getAuthedHeaders();
40
- await axios.post(`${API_URL}/projects/${gameId}/credentials/android/certificate`, null, {
41
- headers
42
- });
43
- queryClient.invalidateQueries({ queryKey: cacheKeys.projectCredentials({ projectId: gameId, pageNumber: 0 }) });
44
- } catch (err) {
45
- onError(err);
46
- }
47
- };
48
- return /* @__PURE__ */ jsx(Box, { flexDirection: "column", gap: 1, ...boxProps, children: gameId && /* @__PURE__ */ jsx(
49
- RunWithSpinner,
50
- {
51
- executeMethod: handleCreate,
52
- msgInProgress: "Creating Keystore...",
53
- msgComplete: "Keystore created",
54
- onComplete
55
- }
56
- ) });
57
- };
58
-
59
- export { CreateKeystore as C };
@@ -1,110 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useContext, useState, useEffect } from 'react';
3
- import { Box, Text } from 'ink';
4
- import Spinner from 'ink-spinner';
5
- import { b as GameContext } from './index-vMXsdSCy.js';
6
- import { M as queryClient, P as Platform, C as CredentialsType } from './index-DkNQs11R.js';
7
- import 'axios';
8
- import 'crypto-js';
9
- import { v4 } from 'uuid';
10
- import fs__default from 'fs';
11
- import 'luxon';
12
- import '@inkjs/ui';
13
- import { useMutation } from '@tanstack/react-query';
14
- import yazl from 'yazl';
15
- import { c as cacheKeys } from './useAndroidServiceAccountTestResult-DcYDam-p.js';
16
- import { i as importCredential } from './import-Ch5O7xfN.js';
17
- import 'crypto';
18
- import 'readline-sync';
19
- import 'node:readline';
20
- import 'node:path';
21
- import 'node:url';
22
- import 'isomorphic-git';
23
- import '@oclif/core';
24
- import 'fast-glob';
25
- import 'socket.io-client';
26
- import 'open';
27
- import 'marked';
28
- import 'marked-terminal';
29
- import 'path';
30
- import 'qrcode';
31
- import 'string-length';
32
- import 'strip-ansi';
33
-
34
- async function importKeystore({ log = () => {
35
- }, ...opt }) {
36
- if (!opt.zipFilePath && !opt.jksFilePath) {
37
- throw new Error("You must provide either a zipFilePath or a jksFilePath");
38
- }
39
- if (opt.zipFilePath && opt.jksFilePath) {
40
- throw new Error("You cannot provide both a zipFilePath and a jksFilePath");
41
- }
42
- if (opt.jksFilePath && (!opt.keystorePassword || !opt.keyPassword)) {
43
- throw new Error("You must provide both keystorePassword and keyPassword when importing a jks file");
44
- }
45
- const toDelete = [];
46
- if (opt.jksFilePath) {
47
- log("Creating zip file from jks file...");
48
- const outputZipToFile = (zip, fileName) => new Promise((resolve) => {
49
- const outputStream = fs__default.createWriteStream(fileName);
50
- zip.outputStream.pipe(outputStream).on("close", () => resolve());
51
- zip.end();
52
- });
53
- const zipFile = new yazl.ZipFile();
54
- log("Adding keyStore.jks to zip file...");
55
- zipFile.addFile(opt.jksFilePath, "keyStore.jks");
56
- log("Adding password.txt and keyPassword.txt to zip file...");
57
- zipFile.addBuffer(Buffer.from(`${opt.keystorePassword}`), "password.txt");
58
- zipFile.addBuffer(Buffer.from(`${opt.keyPassword}`), "keyPassword.txt");
59
- const tmpZipFile = `${process.cwd()}/shipthis-keyStore-${v4()}.zip`;
60
- log(`Writing zip file: ${tmpZipFile}`);
61
- await outputZipToFile(zipFile, tmpZipFile);
62
- toDelete.push(tmpZipFile);
63
- opt.zipFilePath = tmpZipFile;
64
- }
65
- log("Uploading and importing zip file...");
66
- const keyStore = await importCredential({
67
- projectId: opt.gameId,
68
- zipPath: `${opt.zipFilePath}`,
69
- type: CredentialsType.CERTIFICATE,
70
- platform: Platform.ANDROID
71
- });
72
- log("Imported successfully");
73
- toDelete.forEach((file) => {
74
- log(`Deleting temporary file: ${file}`);
75
- fs__default.unlinkSync(file);
76
- });
77
- return keyStore;
78
- }
79
- const useImportKeystore = () => {
80
- return useMutation({
81
- mutationFn: importKeystore,
82
- onSuccess: async (data) => {
83
- const projectId = data.projectId;
84
- queryClient.invalidateQueries({
85
- queryKey: cacheKeys.projectCredentials({ projectId, pageNumber: 0 })
86
- });
87
- }
88
- });
89
- };
90
-
91
- const ImportKeystore = ({ onComplete, onError, importKeystoreProps }) => {
92
- const { gameId } = useContext(GameContext);
93
- const importMutation = useImportKeystore();
94
- const [log, setLog] = useState(null);
95
- useEffect(() => {
96
- if (!gameId) return;
97
- const importOpts = {
98
- ...importKeystoreProps,
99
- gameId,
100
- log: setLog
101
- };
102
- importMutation.mutateAsync(importOpts).catch(onError).then(onComplete);
103
- }, [gameId]);
104
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", gap: 1, children: [
105
- /* @__PURE__ */ jsx(Spinner, { type: "dots" }),
106
- log && /* @__PURE__ */ jsx(Text, { children: log })
107
- ] });
108
- };
109
-
110
- export { ImportKeystore as I };
@@ -1,121 +0,0 @@
1
- import { v4 } from 'uuid';
2
- import axios from 'axios';
3
- import fg from 'fast-glob';
4
- import fs__default from 'fs';
5
- import yazl from 'yazl';
6
- import { useMutation } from '@tanstack/react-query';
7
- import { c as cacheKeys } from './useAndroidServiceAccountTestResult-DcYDam-p.js';
8
- import { M as queryClient, x as DEFAULT_SHIPPED_FILES_GLOBS, w as DEFAULT_IGNORED_FILES_GLOBS, a1 as getNewUploadTicket, a2 as startJobsFromUpload, J as JobStatus } from './index-DkNQs11R.js';
9
- import { e as getFileHash, f as getPlatformName } from './index-BB00V5oF.js';
10
- import { g as getCWDGitInfo } from './git-DREGq-jc.js';
11
- import { jsx, Fragment } from 'react/jsx-runtime';
12
- import { useRef } from 'react';
13
- import 'ink';
14
- import './index-vMXsdSCy.js';
15
- import 'ink-spinner';
16
- import 'crypto-js';
17
- import 'luxon';
18
- import '@inkjs/ui';
19
- import 'open';
20
- import 'marked';
21
- import 'marked-terminal';
22
- import 'path';
23
- import { P as ProgressSpinner } from './ProgressSpinner-6pw1T8Iw.js';
24
- import 'qrcode';
25
- import 'string-length';
26
- import 'strip-ansi';
27
- import 'socket.io-client';
28
- import { u as useJobWatching } from './useJobWatching-BZSUa8E-.js';
29
-
30
- async function ship({ command, log = () => {
31
- } }) {
32
- log("Fetching project config...");
33
- const projectConfig = await command.getProjectConfig();
34
- if (!projectConfig.project) throw new Error("No project found in project config");
35
- log("Retrieving file globs...");
36
- const shippedFilesGlobs = projectConfig.shippedFilesGlobs || DEFAULT_SHIPPED_FILES_GLOBS;
37
- const ignoredFilesGlobs = projectConfig.ignoredFilesGlobs || DEFAULT_IGNORED_FILES_GLOBS;
38
- log("Finding files to include in zip...");
39
- const files = await fg(shippedFilesGlobs, { dot: true, ignore: ignoredFilesGlobs });
40
- log(`Found ${files.length} files, adding to zip...`);
41
- const zipFile = new yazl.ZipFile();
42
- for (const file of files) {
43
- zipFile.addFile(file, file);
44
- }
45
- const outputZipToFile = (zip, fileName) => new Promise((resolve) => {
46
- const outputStream = fs__default.createWriteStream(fileName);
47
- zip.outputStream.pipe(outputStream).on("close", () => resolve());
48
- zip.end();
49
- });
50
- const tmpZipFile = `${process.cwd()}/shipthis-${v4()}.zip`;
51
- log(`Creating zip file: ${tmpZipFile}`);
52
- await outputZipToFile(zipFile, tmpZipFile);
53
- log("Reading zip file buffer...");
54
- const zipBuffer = fs__default.readFileSync(tmpZipFile);
55
- const { size } = fs__default.statSync(tmpZipFile);
56
- log("Requesting upload ticket...");
57
- const uploadTicket = await getNewUploadTicket(projectConfig.project.id);
58
- log("Uploading zip file...");
59
- await axios.put(uploadTicket.url, zipBuffer, {
60
- headers: {
61
- "Content-length": size,
62
- "Content-Type": "application/zip"
63
- }
64
- });
65
- log("Fetching Git info...");
66
- const gitInfo = await getCWDGitInfo();
67
- log("Computing file hash...");
68
- const zipFileMd5 = await getFileHash(tmpZipFile);
69
- const uploadDetails = {
70
- ...gitInfo,
71
- zipFileMd5
72
- };
73
- log("Starting jobs from upload...");
74
- const commandFlags = command.getFlags();
75
- const startJobsOptions = {
76
- ...uploadDetails,
77
- skipPublish: commandFlags.skipPublish,
78
- platform: commandFlags.platform?.toUpperCase()
79
- };
80
- const jobs = await startJobsFromUpload(uploadTicket.id, startJobsOptions);
81
- log("Cleaning up temporary zip file...");
82
- fs__default.unlinkSync(tmpZipFile);
83
- log("Job submission complete.");
84
- return jobs;
85
- }
86
- const useShip = () => {
87
- return useMutation({
88
- mutationFn: ship,
89
- onSuccess: async (data) => {
90
- queryClient.invalidateQueries({
91
- queryKey: cacheKeys.jobs({ projectId: data[0].project.id, pageNumber: 0 })
92
- });
93
- }
94
- });
95
- };
96
-
97
- const JobProgress = (props) => {
98
- const prevJobStatus = useRef(props.job.status);
99
- const handleJobUpdate = (job) => {
100
- const completed = [JobStatus.COMPLETED, JobStatus.FAILED];
101
- const wasRunning = !completed.includes(prevJobStatus.current);
102
- if (completed.includes(job.status) && wasRunning) {
103
- if (job.status === JobStatus.FAILED) {
104
- props.onFailure(job);
105
- } else {
106
- props.onComplete(job);
107
- }
108
- }
109
- prevJobStatus.current = job.status;
110
- };
111
- const { progress } = useJobWatching({
112
- projectId: props.job.project.id,
113
- jobId: props.job.id,
114
- isWatching: true,
115
- onJobUpdate: handleJobUpdate
116
- });
117
- const label = `${getPlatformName(props.job.type)} build progress...`;
118
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ProgressSpinner, { progress, label, spinnerType: "dots" }) });
119
- };
120
-
121
- export { JobProgress as J, useShip as u };