shipthis 0.1.47 → 0.1.48
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.
- package/dist/{AppleBundleIdDetails-DogjUozj.js → AppleBundleIdDetails-4WNaBSGY.js} +7 -7
- package/dist/{Command-CWKSGrtu.js → Command-BdiF-ris.js} +4 -4
- package/dist/{CommandGame-B7EQbgMq.js → CommandGame-BExi5Od4.js} +2 -2
- package/dist/{Create-DVnctE1E.js → Create-DUl1dfhZ.js} +5 -5
- package/dist/{GameStatus-DbwQmv4w.js → GameStatus-NSIKI7Zi.js} +5 -4
- package/dist/{Import-OqdHUTRB.js → Import-B_2jztJs.js} +6 -6
- package/dist/{JobLogTail-D-IhoJDu.js → JobLogTail-DrUqKwiv.js} +5 -5
- package/dist/JobProgress-CFwOCp-e.js +394 -0
- package/dist/{JobStatusTable-BrfiBJ2p.js → JobStatusTable-Csfw4ag1.js} +6 -4
- package/dist/{ProjectCredentialsTable-DyUiZFwz.js → ProjectCredentialsTable-BXWs0Ler.js} +5 -5
- package/dist/{UserCredentialsTable-DBasvwqB.js → UserCredentialsTable-Cr2NT9gg.js} +5 -5
- package/dist/{baseAppleCommand-Dfzhp492.js → baseAppleCommand-CMBV0P9z.js} +1 -1
- package/dist/{baseCommand-B7pUDBYl.js → baseCommand-C7OdounZ.js} +20 -6
- package/dist/{baseGameAndroidCommand-BhridFzb.js → baseGameAndroidCommand-BE6hsL-c.js} +2 -2
- package/dist/{baseGameCommand-BTC5XD8W.js → baseGameCommand-Bap2bDqP.js} +5 -5
- package/dist/commands/apiKey/create.js +5 -5
- package/dist/commands/apiKey/list.js +6 -6
- package/dist/commands/apiKey/revoke.js +6 -6
- package/dist/commands/apple/apiKey/create.js +9 -9
- package/dist/commands/apple/apiKey/delete.js +7 -7
- package/dist/commands/apple/apiKey/export.js +8 -8
- package/dist/commands/apple/apiKey/import.js +8 -8
- package/dist/commands/apple/apiKey/status.js +7 -7
- package/dist/commands/apple/certificate/create.js +9 -9
- package/dist/commands/apple/certificate/delete.js +7 -7
- package/dist/commands/apple/certificate/export.js +8 -8
- package/dist/commands/apple/certificate/import.js +8 -8
- package/dist/commands/apple/certificate/status.js +7 -7
- package/dist/commands/apple/login.js +5 -5
- package/dist/commands/apple/status.js +6 -6
- package/dist/commands/dashboard.js +5 -5
- package/dist/commands/game/android/apiKey/connect.js +11 -11
- package/dist/commands/game/android/apiKey/create.js +13 -13
- package/dist/commands/game/android/apiKey/delete.js +7 -7
- package/dist/commands/game/android/apiKey/export.js +9 -9
- package/dist/commands/game/android/apiKey/import.js +9 -9
- package/dist/commands/game/android/apiKey/invite.js +6 -6
- package/dist/commands/game/android/apiKey/policy.js +6 -6
- package/dist/commands/game/android/apiKey/status.js +9 -9
- package/dist/commands/game/android/keyStore/create.js +10 -10
- package/dist/commands/game/android/keyStore/delete.js +7 -7
- package/dist/commands/game/android/keyStore/export.js +8 -8
- package/dist/commands/game/android/keyStore/import.js +11 -11
- package/dist/commands/game/android/keyStore/status.js +8 -8
- package/dist/commands/game/android/status.js +5 -5
- package/dist/commands/game/build/download.js +6 -6
- package/dist/commands/game/build/list.js +7 -7
- package/dist/commands/game/create.js +7 -8
- package/dist/commands/game/details.js +6 -6
- package/dist/commands/game/export.js +29 -14
- package/dist/commands/game/ios/app/addTester.js +7 -7
- package/dist/commands/game/ios/app/create.js +6 -6
- package/dist/commands/game/ios/app/status.js +9 -9
- package/dist/commands/game/ios/app/sync.js +7 -7
- package/dist/commands/game/ios/profile/create.js +9 -9
- package/dist/commands/game/ios/profile/delete.js +7 -7
- package/dist/commands/game/ios/profile/export.js +8 -8
- package/dist/commands/game/ios/profile/import.js +8 -8
- package/dist/commands/game/ios/profile/status.js +9 -9
- package/dist/commands/game/ios/status.js +11 -11
- package/dist/commands/game/ios/wizard.js +6 -6
- package/dist/commands/game/job/list.js +6 -6
- package/dist/commands/game/job/status.js +9 -9
- package/dist/commands/game/list.js +6 -6
- package/dist/commands/game/ship.js +22 -15
- package/dist/commands/game/status.js +8 -8
- package/dist/commands/game/wizard.js +21 -20
- package/dist/commands/internal/fastlane.js +5 -5
- package/dist/commands/internal/readme.js +5 -5
- package/dist/commands/login.js +5 -5
- package/dist/commands/status.js +6 -6
- package/dist/commands/util/android-build-method.js +5 -5
- package/dist/commands/util/glass.js +4 -4
- package/dist/{export-7GgsEM8k.js → export-gdKqwR7u.js} +1 -1
- package/dist/{import-DKibfocC.js → import-CICoTBgo.js} +1 -1
- package/dist/{index-BeGDjWvi.js → index-B_z5RCr4.js} +7 -7
- package/dist/{index-3FFnBAwx.js → index-BaxMfQnE.js} +8 -8
- package/dist/{index-B_dXK-Zt.js → index-YX-OJ2AA.js} +1 -1
- package/dist/{upload-DGY-glMy.js → upload-Drre-qsL.js} +1 -1
- package/dist/{useAppleApp-DRJf8q6R.js → useAppleApp-ChI2baWJ.js} +1 -1
- package/dist/{useAppleBundleId-B-5a-soi.js → useAppleBundleId-CUTbojvt.js} +1 -1
- package/dist/{useAppleProfiles-BXXI2MAc.js → useAppleProfiles-omIx9KVc.js} +4 -4
- package/dist/{useGoogleStatus-CETX9Rbw.js → useGoogleStatus-v86ZyFiz.js} +2 -2
- package/dist/{useProjectCredentials-AV_OlZEu.js → useProjectCredentials-5Ycm5B4x.js} +3 -3
- package/dist/{useWebSocket-DgYLiSrd.js → useWebSocket-AjcqLcJX.js} +1 -1
- package/docs/game/export.md +13 -2
- package/docs/game/ship.md +1 -1
- package/npm-shrinkwrap.json +53 -53
- package/oclif.manifest.json +19 -4
- package/package.json +2 -3
- package/dist/JobProgress-C24YiJOA.js +0 -252
package/oclif.manifest.json
CHANGED
|
@@ -596,13 +596,14 @@
|
|
|
596
596
|
"game_id": {
|
|
597
597
|
"description": "The ID of the game to export (use \"list\" to get the ID)",
|
|
598
598
|
"name": "game_id",
|
|
599
|
-
"required":
|
|
599
|
+
"required": false
|
|
600
600
|
}
|
|
601
601
|
},
|
|
602
602
|
"description": "Downloads the shipthis.json file for a given game into the current directory.",
|
|
603
603
|
"examples": [
|
|
604
604
|
"<%= config.bin %> <%= command.id %> abcd1234",
|
|
605
|
-
"<%= config.bin %> <%= command.id %> abcd1234 --force"
|
|
605
|
+
"<%= config.bin %> <%= command.id %> abcd1234 --force",
|
|
606
|
+
"<%= config.bin %> <%= command.id %> --current --force"
|
|
606
607
|
],
|
|
607
608
|
"flags": {
|
|
608
609
|
"force": {
|
|
@@ -610,6 +611,12 @@
|
|
|
610
611
|
"name": "force",
|
|
611
612
|
"allowNo": false,
|
|
612
613
|
"type": "boolean"
|
|
614
|
+
},
|
|
615
|
+
"current": {
|
|
616
|
+
"description": "Use the project ID from the current shipthis.json config",
|
|
617
|
+
"name": "current",
|
|
618
|
+
"allowNo": false,
|
|
619
|
+
"type": "boolean"
|
|
613
620
|
}
|
|
614
621
|
},
|
|
615
622
|
"hasDynamicHelp": false,
|
|
@@ -710,7 +717,8 @@
|
|
|
710
717
|
"<%= config.bin %> <%= command.id %> --platform android --follow --downloadAPK game.apk",
|
|
711
718
|
"<%= config.bin %> <%= command.id %> --platform ios --follow --verbose",
|
|
712
719
|
"<%= config.bin %> <%= command.id %> --platform ios --useDemoCredentials --download game.ipa",
|
|
713
|
-
"<%= config.bin %> <%= command.id %> --platform android --gameEngineVersion 4.5.1 --skipPublish"
|
|
720
|
+
"<%= config.bin %> <%= command.id %> --platform android --gameEngineVersion 4.5.1 --skipPublish",
|
|
721
|
+
"<%= config.bin %> <%= command.id %> --platform android --dryRun"
|
|
714
722
|
],
|
|
715
723
|
"flags": {
|
|
716
724
|
"gameId": {
|
|
@@ -796,6 +804,13 @@
|
|
|
796
804
|
"hasDynamicHelp": false,
|
|
797
805
|
"multiple": false,
|
|
798
806
|
"type": "option"
|
|
807
|
+
},
|
|
808
|
+
"dryRun": {
|
|
809
|
+
"description": "Dry run - lists the files that would be shipped without executing the build or publish steps",
|
|
810
|
+
"name": "dryRun",
|
|
811
|
+
"required": false,
|
|
812
|
+
"allowNo": false,
|
|
813
|
+
"type": "boolean"
|
|
799
814
|
}
|
|
800
815
|
},
|
|
801
816
|
"hasDynamicHelp": false,
|
|
@@ -2962,5 +2977,5 @@
|
|
|
2962
2977
|
]
|
|
2963
2978
|
}
|
|
2964
2979
|
},
|
|
2965
|
-
"version": "0.1.
|
|
2980
|
+
"version": "0.1.48"
|
|
2966
2981
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shipthis",
|
|
3
3
|
"description": "Build and publish Godot games to the App Store and Google Play. Cloud builds for APK, AAB, and IPA - no Mac or Android Studio required.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.48",
|
|
5
5
|
"author": "Hello Invent Ltd",
|
|
6
6
|
"bin": {
|
|
7
7
|
"shipthis": "./bin/run.js"
|
|
@@ -257,8 +257,7 @@
|
|
|
257
257
|
},
|
|
258
258
|
"types": "dist/index.d.ts",
|
|
259
259
|
"overrides": {
|
|
260
|
-
"serialize-javascript": "^7.0.
|
|
261
|
-
"fast-xml-parser": "^5.3.8",
|
|
260
|
+
"serialize-javascript": "^7.0.5",
|
|
262
261
|
"cli-spinners": "2.9.2",
|
|
263
262
|
"@alcalzone/ansi-tokenize": "^0.2.2"
|
|
264
263
|
}
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import fs__default from 'node:fs';
|
|
2
|
-
import { useMutation } from '@tanstack/react-query';
|
|
3
|
-
import fg from 'fast-glob';
|
|
4
|
-
import { v4 } from 'uuid';
|
|
5
|
-
import { I as queryClient, l as getProject, x as DEFAULT_SHIPPED_FILES_GLOBS, y as DEFAULT_IGNORED_FILES_GLOBS, a4 as getNewUploadTicket, a5 as startJobsFromUpload, a2 as LogLevel } from './baseCommand-B7pUDBYl.js';
|
|
6
|
-
import { k as cacheKeys, v as getFileHash, w as getPlatformName, x as getMessageColor } from './baseGameCommand-BTC5XD8W.js';
|
|
7
|
-
import { ZipFile } from 'yazl';
|
|
8
|
-
import { g as getCWDGitInfo } from './git-BpsfNFZ_.js';
|
|
9
|
-
import { Readable, Transform } from 'stream';
|
|
10
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
11
|
-
import { Box, Text } from 'ink';
|
|
12
|
-
import { useState } from 'react';
|
|
13
|
-
import 'ink-spinner';
|
|
14
|
-
import 'axios';
|
|
15
|
-
import 'luxon';
|
|
16
|
-
import 'socket.io-client';
|
|
17
|
-
import { u as useJobWatching, a as JobLogLine } from './JobLogTail-D-IhoJDu.js';
|
|
18
|
-
import 'fullscreen-ink';
|
|
19
|
-
import 'open';
|
|
20
|
-
import '@inkjs/ui';
|
|
21
|
-
import 'node:path';
|
|
22
|
-
import 'marked';
|
|
23
|
-
import 'marked-terminal';
|
|
24
|
-
import { P as ProgressSpinner } from './ProgressSpinner-Um6ARKlk.js';
|
|
25
|
-
import 'qrcode';
|
|
26
|
-
import 'string-length';
|
|
27
|
-
import 'strip-ansi';
|
|
28
|
-
import 'godot-export-presets';
|
|
29
|
-
|
|
30
|
-
function formatProgressLog(label, data, bytesKey, totalKey, isEstimated = false) {
|
|
31
|
-
const elapsed = data.elapsedSeconds.toFixed(1);
|
|
32
|
-
const transferredMB = (data[bytesKey] / 1024 / 1024).toFixed(2);
|
|
33
|
-
const totalMB = (data[totalKey] / 1024 / 1024).toFixed(2);
|
|
34
|
-
const progressPercent = Math.round(data.progress * 100);
|
|
35
|
-
const speed = data.speedMBps.toFixed(2);
|
|
36
|
-
const totalPrefix = isEstimated ? "~" : "";
|
|
37
|
-
return `${label}: ${progressPercent}% (${transferredMB}MB / ${totalPrefix}${totalMB}MB) - ${elapsed}s - ${speed}MB/s`;
|
|
38
|
-
}
|
|
39
|
-
async function ship({ command, log = () => {
|
|
40
|
-
}, shipFlags }) {
|
|
41
|
-
const commandFlags = command.getFlags();
|
|
42
|
-
const finalFlags = shipFlags || commandFlags;
|
|
43
|
-
const { verbose, useDemoCredentials } = finalFlags;
|
|
44
|
-
verbose && log("Fetching game config...");
|
|
45
|
-
const projectConfig = await command.getProjectConfig();
|
|
46
|
-
if (!projectConfig.project) throw new Error("No project found in project config");
|
|
47
|
-
const project = await getProject(projectConfig.project.id);
|
|
48
|
-
const projectUsesDemoCredentials = Boolean(project.details?.useDemoCredentials);
|
|
49
|
-
const isUsingDemoCredentials = useDemoCredentials ?? projectUsesDemoCredentials ?? false;
|
|
50
|
-
const hasConfiguredIos = Boolean(project.details?.iosBundleId);
|
|
51
|
-
const hasConfiguredAndroid = Boolean(project.details?.androidPackageName);
|
|
52
|
-
if (!isUsingDemoCredentials && !hasConfiguredAndroid && !hasConfiguredIos) {
|
|
53
|
-
throw new Error(
|
|
54
|
-
"No Android or iOS configuration found. Please run `shipthis game wizard android` or `shipthis game wizard ios` to configure your game."
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
verbose && log("Retrieving file globs...");
|
|
58
|
-
const shippedFilesGlobs = projectConfig.shippedFilesGlobs || DEFAULT_SHIPPED_FILES_GLOBS;
|
|
59
|
-
const ignoredFilesGlobs = projectConfig.ignoredFilesGlobs || DEFAULT_IGNORED_FILES_GLOBS;
|
|
60
|
-
verbose && log("Finding files to include in zip...");
|
|
61
|
-
const files = await fg(shippedFilesGlobs, { dot: true, ignore: ignoredFilesGlobs });
|
|
62
|
-
verbose && log(`Found ${files.length} files, adding to zip...`);
|
|
63
|
-
const tmpZipFileName = `shipthis-${v4()}.zip`;
|
|
64
|
-
const tmpZipFile = `${process.cwd()}/${tmpZipFileName}`;
|
|
65
|
-
log(`Creating zip file: ${tmpZipFileName}`);
|
|
66
|
-
await createZip({
|
|
67
|
-
files,
|
|
68
|
-
outputPath: tmpZipFile,
|
|
69
|
-
onProgress: (data) => {
|
|
70
|
-
log(formatProgressLog("Zipping", data, "writtenBytes", "estimatedTotalBytes", true));
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
const { size } = fs__default.statSync(tmpZipFile);
|
|
74
|
-
verbose && log("Requesting upload ticket...");
|
|
75
|
-
const uploadTicket = await getNewUploadTicket(projectConfig.project.id);
|
|
76
|
-
log("Uploading zip file...");
|
|
77
|
-
const zipStream = fs__default.createReadStream(tmpZipFile);
|
|
78
|
-
const response = await uploadZip({
|
|
79
|
-
url: uploadTicket.url,
|
|
80
|
-
zipStream,
|
|
81
|
-
zipSize: size,
|
|
82
|
-
onProgress: (data) => {
|
|
83
|
-
log(formatProgressLog("Uploading", data, "loadedBytes", "totalBytes", false));
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
verbose && log("Computing zip file hash...");
|
|
87
|
-
const zipFileMd5 = await getFileHash(tmpZipFile);
|
|
88
|
-
verbose && log("Cleaning up temporary zip file...");
|
|
89
|
-
fs__default.unlinkSync(tmpZipFile);
|
|
90
|
-
if (!response.ok) {
|
|
91
|
-
throw new Error(`Upload failed: ${response.status} ${response.statusText}`);
|
|
92
|
-
}
|
|
93
|
-
log(`Upload complete`);
|
|
94
|
-
verbose && log("Fetching Git info...");
|
|
95
|
-
const gitInfo = await getCWDGitInfo();
|
|
96
|
-
const uploadDetails = {
|
|
97
|
-
...gitInfo,
|
|
98
|
-
zipFileMd5
|
|
99
|
-
};
|
|
100
|
-
verbose && log("Starting jobs from upload...");
|
|
101
|
-
const startJobsOptions = {
|
|
102
|
-
...uploadDetails,
|
|
103
|
-
platform: finalFlags.platform?.toUpperCase(),
|
|
104
|
-
skipPublish: finalFlags.skipPublish,
|
|
105
|
-
verbose: finalFlags.verbose,
|
|
106
|
-
useDemoCredentials: isUsingDemoCredentials,
|
|
107
|
-
gameEngineVersion: finalFlags.gameEngineVersion
|
|
108
|
-
};
|
|
109
|
-
const jobs = await startJobsFromUpload(uploadTicket.id, startJobsOptions);
|
|
110
|
-
verbose && log("Job submission complete.");
|
|
111
|
-
if (jobs.length === 0) {
|
|
112
|
-
throw new Error("No jobs were created. Please check your game configuration and try again.");
|
|
113
|
-
}
|
|
114
|
-
if (finalFlags?.follow) {
|
|
115
|
-
log("Waiting for job to start...");
|
|
116
|
-
}
|
|
117
|
-
return jobs;
|
|
118
|
-
}
|
|
119
|
-
const useShip = () => useMutation({
|
|
120
|
-
mutationFn: ship,
|
|
121
|
-
async onSuccess(data) {
|
|
122
|
-
queryClient.invalidateQueries({
|
|
123
|
-
queryKey: cacheKeys.jobs({ pageNumber: 0, projectId: data[0].project.id })
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
const ON_PROGRESS_THROTTLE_MS = 2e3;
|
|
129
|
-
function createProgressStream(totalSize, onProgress, throttleMs) {
|
|
130
|
-
let sent = 0;
|
|
131
|
-
let lastCallTime = 0;
|
|
132
|
-
return new Transform({
|
|
133
|
-
transform(chunk, encoding, callback) {
|
|
134
|
-
sent += chunk.length;
|
|
135
|
-
const now = Date.now();
|
|
136
|
-
if (now - lastCallTime >= throttleMs) {
|
|
137
|
-
onProgress(sent, totalSize);
|
|
138
|
-
lastCallTime = now;
|
|
139
|
-
}
|
|
140
|
-
callback(null, chunk);
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
function uploadZip({ url, zipStream, zipSize, onProgress }) {
|
|
145
|
-
const startTime = Date.now();
|
|
146
|
-
const progressStream = createProgressStream(zipSize, (sent, total) => {
|
|
147
|
-
const elapsedSeconds = (Date.now() - startTime) / 1e3;
|
|
148
|
-
const speedMBps = elapsedSeconds < 1e-3 ? 0 : sent / elapsedSeconds / 1024 / 1024;
|
|
149
|
-
onProgress({
|
|
150
|
-
progress: total ? sent / total : 0,
|
|
151
|
-
loadedBytes: sent,
|
|
152
|
-
totalBytes: total,
|
|
153
|
-
speedMBps,
|
|
154
|
-
elapsedSeconds
|
|
155
|
-
});
|
|
156
|
-
}, ON_PROGRESS_THROTTLE_MS);
|
|
157
|
-
const streamWithProgress = zipStream.pipe(progressStream);
|
|
158
|
-
const webStream = Readable.toWeb(streamWithProgress);
|
|
159
|
-
const response = fetch(url, {
|
|
160
|
-
method: "PUT",
|
|
161
|
-
headers: {
|
|
162
|
-
"Content-Type": "application/zip",
|
|
163
|
-
"Content-Length": zipSize.toString()
|
|
164
|
-
},
|
|
165
|
-
body: webStream,
|
|
166
|
-
duplex: "half"
|
|
167
|
-
});
|
|
168
|
-
return response;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const COMPRESSION_RATIO = 0.65;
|
|
172
|
-
async function createZip({ files, outputPath, onProgress }) {
|
|
173
|
-
const startTime = Date.now();
|
|
174
|
-
const statPromises = files.map(async (file) => {
|
|
175
|
-
try {
|
|
176
|
-
return await fs__default.promises.stat(file);
|
|
177
|
-
} catch {
|
|
178
|
-
return null;
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
const statsResults = await Promise.all(statPromises);
|
|
182
|
-
let totalSourceSize = 0;
|
|
183
|
-
for (const stats of statsResults) {
|
|
184
|
-
if (stats) {
|
|
185
|
-
totalSourceSize += stats.size;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
const estimatedZipSize = Math.max(Math.round(totalSourceSize * COMPRESSION_RATIO), 1);
|
|
189
|
-
const zipFile = new ZipFile();
|
|
190
|
-
for (const file of files) {
|
|
191
|
-
zipFile.addFile(file, file);
|
|
192
|
-
}
|
|
193
|
-
return new Promise((resolve, reject) => {
|
|
194
|
-
let settled = false;
|
|
195
|
-
const handleError = (error) => {
|
|
196
|
-
if (settled) return;
|
|
197
|
-
settled = true;
|
|
198
|
-
zipFile.outputStream.destroy();
|
|
199
|
-
progressStream.destroy();
|
|
200
|
-
outputStream.destroy();
|
|
201
|
-
reject(error);
|
|
202
|
-
};
|
|
203
|
-
const handleSuccess = () => {
|
|
204
|
-
if (settled) return;
|
|
205
|
-
settled = true;
|
|
206
|
-
resolve();
|
|
207
|
-
};
|
|
208
|
-
const outputStream = fs__default.createWriteStream(outputPath);
|
|
209
|
-
const progressStream = createProgressStream(estimatedZipSize, (written, total) => {
|
|
210
|
-
const elapsedSeconds = (Date.now() - startTime) / 1e3;
|
|
211
|
-
const speedMBps = elapsedSeconds < 1e-3 ? 0 : written / elapsedSeconds / 1024 / 1024;
|
|
212
|
-
onProgress({
|
|
213
|
-
progress: total ? Math.min(1, written / total) : 0,
|
|
214
|
-
writtenBytes: written,
|
|
215
|
-
estimatedTotalBytes: total,
|
|
216
|
-
sourceTotalBytes: totalSourceSize,
|
|
217
|
-
elapsedSeconds,
|
|
218
|
-
speedMBps
|
|
219
|
-
});
|
|
220
|
-
}, ON_PROGRESS_THROTTLE_MS);
|
|
221
|
-
zipFile.outputStream.on("error", handleError);
|
|
222
|
-
progressStream.on("error", handleError);
|
|
223
|
-
outputStream.on("error", handleError);
|
|
224
|
-
outputStream.on("close", handleSuccess);
|
|
225
|
-
zipFile.outputStream.pipe(progressStream).pipe(outputStream);
|
|
226
|
-
zipFile.end();
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
const JobProgress = (props) => {
|
|
231
|
-
const [lastWarningLog, setLastWarningLog] = useState(null);
|
|
232
|
-
const { progress } = useJobWatching({
|
|
233
|
-
isWatching: true,
|
|
234
|
-
jobId: props.job.id,
|
|
235
|
-
onComplete: props.onComplete,
|
|
236
|
-
onFailure: props.onFailure,
|
|
237
|
-
projectId: props.job.project.id,
|
|
238
|
-
onNewLogEntry: (logEntry) => {
|
|
239
|
-
if (logEntry.level == LogLevel.WARN) setLastWarningLog(logEntry);
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
const label = `${getPlatformName(props.job.type)} build progress...`;
|
|
243
|
-
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: 0, children: [
|
|
244
|
-
/* @__PURE__ */ jsx(ProgressSpinner, { label, progress, spinnerType: "dots" }),
|
|
245
|
-
lastWarningLog && /* @__PURE__ */ jsxs(Box, { flexDirection: "row", gap: 1, marginLeft: 2, children: [
|
|
246
|
-
/* @__PURE__ */ jsx(Text, { color: getMessageColor(lastWarningLog.level), children: "WARNING" }),
|
|
247
|
-
/* @__PURE__ */ jsx(JobLogLine, { log: lastWarningLog, showTimestamp: false, showStage: false })
|
|
248
|
-
] })
|
|
249
|
-
] });
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
export { JobProgress as J, useShip as u };
|