shipthis 0.1.35 → 0.1.37
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/README.md +231 -80
- package/assets/markdown/agreement-update.md.ejs +12 -0
- package/assets/markdown/confirm-delete-android-keystore.md.ejs +22 -0
- package/assets/markdown/confirm-delete-android-serviceaccountkey.md.ejs +24 -0
- package/assets/markdown/confirm-delete-apple-credential.md.ejs +29 -0
- package/dist/{AppleBundleIdDetails-N_j1wv6f.js → AppleBundleIdDetails-KMzyex1H.js} +3 -5
- package/dist/{Command-DN1j3tjt.js → Command-CHh8RDXK.js} +1 -2
- package/dist/{CommandGame-D2NqytWc.js → CommandGame-Rvmsa7b0.js} +2 -2
- package/dist/{Create-BRdv5jXQ.js → Create-DInZ_pw-.js} +1 -4
- package/dist/{GameStatus-joyHPy0f.js → GameStatus-D7ID10tS.js} +1 -4
- package/dist/{Import-BNMHsJoM.js → Import-BmO8EYKj.js} +2 -5
- package/dist/{JobLogTail-D35FO5v-.js → JobLogTail-CYdceTKL.js} +2 -5
- package/dist/{JobProgress-D-9KESaA.js → JobProgress-DBCYbWrO.js} +16 -18
- package/dist/{JobStatusTable-DIJ_h-gi.js → JobStatusTable-DhnhY1_i.js} +2 -4
- package/dist/{ProjectCredentialsTable-BMKgv99h.js → ProjectCredentialsTable-BDYVYqAq.js} +5 -3
- package/dist/{UserCredentialsTable-CUrTDzTK.js → UserCredentialsTable-cDPvjF-F.js} +4 -4
- package/dist/{baseAppleCommand-Cs9a52e5.js → baseAppleCommand-CQ5dOna7.js} +1 -1
- package/dist/{baseGameAndroidCommand-BCB1SMCf.js → baseGameAndroidCommand-D4ryZS6A.js} +1 -2
- package/dist/commands/apiKey/create.js +3 -6
- package/dist/commands/apiKey/list.js +3 -6
- package/dist/commands/apiKey/revoke.js +3 -6
- package/dist/commands/apple/apiKey/create.js +7 -10
- package/dist/commands/apple/apiKey/delete.js +118 -0
- package/dist/commands/apple/apiKey/export.js +6 -9
- package/dist/commands/apple/apiKey/import.js +6 -9
- package/dist/commands/apple/apiKey/status.js +4 -7
- package/dist/commands/apple/certificate/create.js +7 -10
- package/dist/commands/apple/certificate/delete.js +127 -0
- package/dist/commands/apple/certificate/export.js +6 -9
- package/dist/commands/apple/certificate/import.js +6 -9
- package/dist/commands/apple/certificate/status.js +4 -7
- package/dist/commands/apple/login.js +23 -4
- package/dist/commands/apple/status.js +4 -7
- package/dist/commands/dashboard.js +12 -1
- package/dist/commands/game/android/apiKey/connect.js +8 -11
- package/dist/commands/game/android/apiKey/create.js +10 -13
- package/dist/commands/game/android/apiKey/delete.js +100 -0
- package/dist/commands/game/android/apiKey/export.js +6 -9
- package/dist/commands/game/android/apiKey/import.js +6 -9
- package/dist/commands/game/android/apiKey/invite.js +14 -4
- package/dist/commands/game/android/apiKey/policy.js +3 -6
- package/dist/commands/game/android/apiKey/status.js +6 -9
- package/dist/commands/game/android/keyStore/create.js +7 -10
- package/dist/commands/game/android/keyStore/delete.js +100 -0
- package/dist/commands/game/android/keyStore/export.js +5 -8
- package/dist/commands/game/android/keyStore/import.js +8 -11
- package/dist/commands/game/android/keyStore/status.js +7 -10
- package/dist/commands/game/android/status.js +13 -1
- package/dist/commands/game/build/download.js +3 -6
- package/dist/commands/game/build/list.js +4 -7
- package/dist/commands/game/create.js +13 -2
- package/dist/commands/game/details.js +4 -7
- package/dist/commands/game/export.js +13 -1
- package/dist/commands/game/ios/app/addTester.js +4 -7
- package/dist/commands/game/ios/app/create.js +3 -6
- package/dist/commands/game/ios/app/status.js +6 -9
- package/dist/commands/game/ios/app/sync.js +4 -7
- package/dist/commands/game/ios/profile/create.js +6 -9
- package/dist/commands/game/ios/profile/delete.js +123 -0
- package/dist/commands/game/ios/profile/export.js +5 -8
- package/dist/commands/game/ios/profile/import.js +5 -8
- package/dist/commands/game/ios/profile/status.js +8 -51
- package/dist/commands/game/ios/status.js +10 -13
- package/dist/commands/game/ios/wizard.js +2 -6
- package/dist/commands/game/job/list.js +3 -6
- package/dist/commands/game/job/status.js +8 -11
- package/dist/commands/game/list.js +3 -6
- package/dist/commands/game/ship.js +17 -14
- package/dist/commands/game/status.js +7 -10
- package/dist/commands/game/wizard.js +14 -17
- package/dist/commands/internal/fastlane.js +13 -1
- package/dist/commands/internal/readme.js +13 -4
- package/dist/commands/login.js +27 -4
- package/dist/commands/status.js +6 -8
- package/dist/{export-DFCZKNQk.js → export-DujIwhJw.js} +1 -1
- package/dist/{import-BpGyif-m.js → import-DGCqCAcC.js} +1 -1
- package/dist/{index-DlE_SPt3.js → index-9LxGafAo.js} +3 -5
- package/dist/{index-BTXEUd8W.js → index-BPh_qt7t.js} +4 -6
- package/dist/index-CNsmEDXi.js +48 -0
- package/dist/index-CmuXyPed.js +1905 -0
- package/dist/{upload-D19OQsbn.js → upload-D4x4yCia.js} +1 -1
- package/dist/{useAppleApp-BZc_cNa-.js → useAppleApp-taaewPSf.js} +1 -1
- package/dist/{useAppleBundleId-DvMXAvWD.js → useAppleBundleId-BeGViMe7.js} +1 -1
- package/dist/useAppleProfiles-1TtO0aO6.js +63 -0
- package/dist/{useGoogleStatus-Cx_QIsXa.js → useGoogleStatus-CSsxEvX7.js} +1 -2
- package/dist/{useProjectCredentials-DxdwJCfU.js → useProjectCredentials-Cm50WMZU.js} +1 -3
- package/dist/{useWebSocket-cM5yOcDv.js → useWebSocket-BVfn36be.js} +1 -1
- package/docs/apple/apiKey/delete.md +25 -0
- package/docs/apple/apiKey.md +26 -0
- package/docs/apple/certificate/delete.md +25 -0
- package/docs/apple/certificate.md +26 -0
- package/docs/assets/st.png +0 -0
- package/docs/game/android/apiKey/delete.md +25 -0
- package/docs/game/android/apiKey.md +26 -0
- package/docs/game/android/keyStore/delete.md +25 -0
- package/docs/game/android/keyStore.md +26 -0
- package/docs/game/ios/profile/delete.md +26 -0
- package/docs/game/ios/profile.md +27 -0
- package/docs/game/ship.md +4 -4
- package/docs/login.md +6 -2
- package/docs/status.md +1 -1
- package/package.json +13 -2
- package/dist/ejs-DirFZbza.js +0 -716
- package/dist/index-BwnzoldS.js +0 -784
- package/dist/index-CJWMt1s-.js +0 -153
- package/dist/index-hoHfGrjg.js +0 -221
- package/dist/index-izrACZbC.js +0 -24
- package/dist/useAndroidServiceAccountTestResult-CwKeW0ED.js +0 -50
package/dist/index-CJWMt1s-.js
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import crypto from 'node:crypto';
|
|
2
|
-
import fs__default from 'node:fs';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { promises } from 'node:readline';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
import readlineSync from 'readline-sync';
|
|
7
|
-
import { L as JobStage, P as Platform, M as LogLevel, J as JobStatus } from './index-BwnzoldS.js';
|
|
8
|
-
import 'luxon';
|
|
9
|
-
import 'axios';
|
|
10
|
-
import 'isomorphic-git';
|
|
11
|
-
import '@oclif/core';
|
|
12
|
-
import '@tanstack/react-query';
|
|
13
|
-
import 'react';
|
|
14
|
-
import 'crypto-js';
|
|
15
|
-
import 'uuid';
|
|
16
|
-
import 'fast-glob';
|
|
17
|
-
import 'yazl';
|
|
18
|
-
import 'socket.io-client';
|
|
19
|
-
import 'fullscreen-ink';
|
|
20
|
-
import 'ink';
|
|
21
|
-
|
|
22
|
-
function getShortUUID(originalUuid) {
|
|
23
|
-
return originalUuid.slice(0, 8);
|
|
24
|
-
}
|
|
25
|
-
function getStageColor(stage) {
|
|
26
|
-
switch (stage) {
|
|
27
|
-
case JobStage.SETUP: {
|
|
28
|
-
return "#FFB3B3";
|
|
29
|
-
}
|
|
30
|
-
// pastel red
|
|
31
|
-
case JobStage.CONFIGURE: {
|
|
32
|
-
return "#FFD9B3";
|
|
33
|
-
}
|
|
34
|
-
// pastel orange
|
|
35
|
-
case JobStage.EXPORT: {
|
|
36
|
-
return "#FFFACD";
|
|
37
|
-
}
|
|
38
|
-
// pastel yellow
|
|
39
|
-
case JobStage.BUILD: {
|
|
40
|
-
return "#B3FFB3";
|
|
41
|
-
}
|
|
42
|
-
// pastel green
|
|
43
|
-
case JobStage.PUBLISH: {
|
|
44
|
-
return "#B3D9FF";
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function getMessageColor(level) {
|
|
49
|
-
switch (level) {
|
|
50
|
-
case LogLevel.INFO: {
|
|
51
|
-
return "white";
|
|
52
|
-
}
|
|
53
|
-
case LogLevel.WARN: {
|
|
54
|
-
return "yellow";
|
|
55
|
-
}
|
|
56
|
-
case LogLevel.ERROR: {
|
|
57
|
-
return "red";
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function getJobStatusColor(status) {
|
|
62
|
-
switch (status) {
|
|
63
|
-
case JobStatus.PENDING: {
|
|
64
|
-
return "yellow";
|
|
65
|
-
}
|
|
66
|
-
case JobStatus.PROCESSING: {
|
|
67
|
-
return "blue";
|
|
68
|
-
}
|
|
69
|
-
case JobStatus.COMPLETED: {
|
|
70
|
-
return "green";
|
|
71
|
-
}
|
|
72
|
-
case JobStatus.FAILED: {
|
|
73
|
-
return "red";
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
async function getFileHash(filename) {
|
|
78
|
-
return new Promise((resolve, reject) => {
|
|
79
|
-
const hash = crypto.createHash("sha256");
|
|
80
|
-
const rs = fs__default.createReadStream(filename);
|
|
81
|
-
rs.on("error", reject);
|
|
82
|
-
rs.on("data", (chunk) => hash.update(chunk));
|
|
83
|
-
rs.on("end", () => resolve(hash.digest("hex")));
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
function isValidSemVer(versionString) {
|
|
87
|
-
const [semVer, major, minor, patch, prerelease, buildmetadata] = versionString.match(
|
|
88
|
-
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/
|
|
89
|
-
) ?? [];
|
|
90
|
-
return Boolean(semVer);
|
|
91
|
-
}
|
|
92
|
-
function makeHumanReadable(rawObject) {
|
|
93
|
-
const getLabel = (key) => {
|
|
94
|
-
const words = key.split(/(?=[A-Z])/);
|
|
95
|
-
return words.map((word) => word[0].toUpperCase() + word.slice(1)).join(" ").replaceAll(" ", " ");
|
|
96
|
-
};
|
|
97
|
-
const withLabels = Object.entries(rawObject).reduce((acc, [key, value]) => {
|
|
98
|
-
acc[getLabel(key)] = value;
|
|
99
|
-
return acc;
|
|
100
|
-
}, {});
|
|
101
|
-
return withLabels;
|
|
102
|
-
}
|
|
103
|
-
function getPlatformName(platform) {
|
|
104
|
-
switch (platform) {
|
|
105
|
-
case Platform.IOS: {
|
|
106
|
-
return "iOS";
|
|
107
|
-
}
|
|
108
|
-
case Platform.ANDROID: {
|
|
109
|
-
return "Android";
|
|
110
|
-
}
|
|
111
|
-
default: {
|
|
112
|
-
throw new Error(`Unknown platform: ${platform}`);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
async function getMaskedInput(message) {
|
|
117
|
-
const password = readlineSync.question(message, {
|
|
118
|
-
hideEchoBack: true
|
|
119
|
-
// This will hide the input as the user types
|
|
120
|
-
});
|
|
121
|
-
return password;
|
|
122
|
-
}
|
|
123
|
-
async function getInput(message) {
|
|
124
|
-
const rl = promises.createInterface({
|
|
125
|
-
input: process.stdin,
|
|
126
|
-
output: process.stdout
|
|
127
|
-
});
|
|
128
|
-
const answer = await rl.question(message);
|
|
129
|
-
rl.close();
|
|
130
|
-
return answer;
|
|
131
|
-
}
|
|
132
|
-
function generatePackageName(gameName) {
|
|
133
|
-
let normalizedGameName = gameName.trim().toLowerCase();
|
|
134
|
-
normalizedGameName = normalizedGameName.replaceAll(/[\s_\-]+/g, ".");
|
|
135
|
-
normalizedGameName = normalizedGameName.replaceAll(/[^\d.a-z]/g, "");
|
|
136
|
-
normalizedGameName = normalizedGameName.replaceAll(/\.+/g, ".");
|
|
137
|
-
normalizedGameName = normalizedGameName.replace(/^\./, "").replace(/\.$/, "");
|
|
138
|
-
if (/^\d/.test(normalizedGameName)) {
|
|
139
|
-
normalizedGameName = "app." + normalizedGameName;
|
|
140
|
-
}
|
|
141
|
-
const prefix = "com.";
|
|
142
|
-
if (normalizedGameName === "") {
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
return prefix + normalizedGameName;
|
|
146
|
-
}
|
|
147
|
-
function scriptDir(importMeta) {
|
|
148
|
-
const filename = fileURLToPath(importMeta.url);
|
|
149
|
-
const dirname = path.dirname(filename);
|
|
150
|
-
return dirname;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export { getInput as a, generatePackageName as b, getJobStatusColor as c, getStageColor as d, getMaskedInput as e, getFileHash as f, getShortUUID as g, getPlatformName as h, isValidSemVer as i, getMessageColor as j, makeHumanReadable as m, scriptDir as s };
|
package/dist/index-hoHfGrjg.js
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { useStdin, useInput, Text, Box } from 'ink';
|
|
3
|
-
import Spinner from 'ink-spinner';
|
|
4
|
-
import open from 'open';
|
|
5
|
-
import React, { useState, useEffect, useContext, useRef } from 'react';
|
|
6
|
-
import { P as Platform, ab as getShortDateTime, p as getAuthedHeaders, o as API_URL, I as castArrayObjectDates, J as JobStatus, ac as getShortTimeDelta, z as getJob, E as getProject, a6 as getShortAuthRequiredUrl, K as queryClient, ad as BuildType, W as WEB_URL } from './index-BwnzoldS.js';
|
|
7
|
-
import { g as getShortUUID, h as getPlatformName, s as scriptDir } from './index-CJWMt1s-.js';
|
|
8
|
-
import { useQuery } from '@tanstack/react-query';
|
|
9
|
-
import axios from 'axios';
|
|
10
|
-
import { c as cacheKeys, u as useAndroidServiceAccountTestResult, K as KeyTestStatus, a as KeyTestError } from './useAndroidServiceAccountTestResult-CwKeW0ED.js';
|
|
11
|
-
import 'luxon';
|
|
12
|
-
import fs__default from 'node:fs';
|
|
13
|
-
import 'fast-glob';
|
|
14
|
-
import 'uuid';
|
|
15
|
-
import 'yazl';
|
|
16
|
-
import 'socket.io-client';
|
|
17
|
-
import 'fullscreen-ink';
|
|
18
|
-
import 'string-length';
|
|
19
|
-
import 'strip-ansi';
|
|
20
|
-
import '@inkjs/ui';
|
|
21
|
-
import path from 'node:path';
|
|
22
|
-
import { e as ejs } from './ejs-DirFZbza.js';
|
|
23
|
-
import { setOptions, parse } from 'marked';
|
|
24
|
-
import TerminalRenderer from 'marked-terminal';
|
|
25
|
-
import 'qrcode';
|
|
26
|
-
|
|
27
|
-
async function queryBuilds({ projectId, ...pageAndSortParams }) {
|
|
28
|
-
try {
|
|
29
|
-
const headers = getAuthedHeaders();
|
|
30
|
-
const url = `${API_URL}/projects/${projectId}/builds`;
|
|
31
|
-
const response = await axios.get(url, { headers, params: pageAndSortParams });
|
|
32
|
-
return {
|
|
33
|
-
...response.data,
|
|
34
|
-
data: castArrayObjectDates(response.data.data)
|
|
35
|
-
};
|
|
36
|
-
} catch (error) {
|
|
37
|
-
console.warn("queryBuilds Error", error);
|
|
38
|
-
throw error;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function getBuildSummary(build) {
|
|
42
|
-
const ext = build.buildType || (build.platform === Platform.IOS ? "IPA" : "AAB");
|
|
43
|
-
const filename = `game.${ext.toLowerCase()}`;
|
|
44
|
-
const details = getJobDetailsSummary(build.jobDetails);
|
|
45
|
-
const summary = {};
|
|
46
|
-
summary.id = getShortUUID(build.id);
|
|
47
|
-
summary.version = details.version;
|
|
48
|
-
summary.gitInfo = details.gitInfo;
|
|
49
|
-
summary.platform = getPlatformName(build.platform);
|
|
50
|
-
summary.jobId = getShortUUID(build.jobId);
|
|
51
|
-
summary.createdAt = getShortDateTime(build.createdAt);
|
|
52
|
-
summary.cmd = `shipthis game build download ${getShortUUID(build.id)} ${filename}`;
|
|
53
|
-
return summary;
|
|
54
|
-
}
|
|
55
|
-
const useBuilds = (props) => {
|
|
56
|
-
const queryResult = useQuery({
|
|
57
|
-
queryFn: async () => queryBuilds(props),
|
|
58
|
-
queryKey: cacheKeys.builds(props)
|
|
59
|
-
});
|
|
60
|
-
return queryResult;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
function getJobDetailsSummary(jobDetails) {
|
|
64
|
-
const semanticVersion = jobDetails?.semanticVersion || "N/A";
|
|
65
|
-
const buildNumber = jobDetails?.buildNumber || "N/A";
|
|
66
|
-
const gitCommit = jobDetails?.gitCommitHash ? getShortUUID(jobDetails.gitCommitHash) : "";
|
|
67
|
-
const gitBranch = jobDetails?.gitBranch || "";
|
|
68
|
-
const details = {};
|
|
69
|
-
details.version = `${semanticVersion} (${buildNumber})`;
|
|
70
|
-
details.gitInfo = gitCommit ? `${gitCommit} (${gitBranch})` : "";
|
|
71
|
-
return details;
|
|
72
|
-
}
|
|
73
|
-
function getJobSummary(job, timeNow) {
|
|
74
|
-
const inProgress = ![JobStatus.COMPLETED, JobStatus.FAILED].includes(job.status);
|
|
75
|
-
const details = getJobDetailsSummary(job.details);
|
|
76
|
-
const summary = {};
|
|
77
|
-
summary.id = getShortUUID(job.id);
|
|
78
|
-
summary.version = details.version;
|
|
79
|
-
summary.gitInfo = details.gitInfo;
|
|
80
|
-
summary.platform = getPlatformName(job.type);
|
|
81
|
-
summary.status = job.status;
|
|
82
|
-
summary.createdAt = getShortDateTime(job.createdAt);
|
|
83
|
-
summary.runtime = getShortTimeDelta(job.createdAt, inProgress ? timeNow : job.updatedAt);
|
|
84
|
-
return summary;
|
|
85
|
-
}
|
|
86
|
-
const useJob = (props) => useQuery({
|
|
87
|
-
queryFn: () => getJob(props.jobId, props.projectId),
|
|
88
|
-
queryKey: cacheKeys.job(props)
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
const useSafeInput = (handler, options = { isActive: true }) => {
|
|
92
|
-
const { isRawModeSupported } = useStdin();
|
|
93
|
-
const isActive = isRawModeSupported === true && options.isActive !== false;
|
|
94
|
-
useInput(
|
|
95
|
-
(input, key) => {
|
|
96
|
-
const lowerInput = input.toLowerCase();
|
|
97
|
-
return handler(lowerInput, key);
|
|
98
|
-
},
|
|
99
|
-
{ isActive }
|
|
100
|
-
);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const cleanHyperlinks = (input) => (
|
|
104
|
-
// When we run in a <ScrollArea> the links break
|
|
105
|
-
// Remove OSC 8 hyperlink wrappers but preserve the styled content inside
|
|
106
|
-
input.replaceAll(/\u001B]8;;[^\u0007]*\u0007/g, "").replaceAll("\x1B]8;;\x07", "")
|
|
107
|
-
);
|
|
108
|
-
const getRenderedMarkdown = ({ filename, templateVars, ...options }) => {
|
|
109
|
-
setOptions({
|
|
110
|
-
renderer: new TerminalRenderer({
|
|
111
|
-
...options
|
|
112
|
-
})
|
|
113
|
-
});
|
|
114
|
-
const entrypointPath = fs__default.realpathSync(process.argv[1]);
|
|
115
|
-
const root = path.dirname(entrypointPath);
|
|
116
|
-
const mdPath = path.join(root, "..", "assets", "markdown", filename);
|
|
117
|
-
const mdTemplate = fs__default.readFileSync(mdPath, "utf8").trim();
|
|
118
|
-
const markdown = ejs.render(mdTemplate, templateVars ?? {}, {
|
|
119
|
-
filename: mdPath
|
|
120
|
-
});
|
|
121
|
-
const rendered = parse(markdown).trim();
|
|
122
|
-
const cleaned = cleanHyperlinks(rendered);
|
|
123
|
-
return cleaned;
|
|
124
|
-
};
|
|
125
|
-
const Markdown = ({ filename, templateVars, ...options }) => {
|
|
126
|
-
const [text, setText] = useState("");
|
|
127
|
-
useEffect(() => {
|
|
128
|
-
const cleaned = getRenderedMarkdown({ filename, templateVars, ...options });
|
|
129
|
-
setText(cleaned);
|
|
130
|
-
}, [filename, templateVars, options]);
|
|
131
|
-
return /* @__PURE__ */ jsx(Text, { children: text });
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const CommandContext = React.createContext({
|
|
135
|
-
command: null,
|
|
136
|
-
setCommand(command) {
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
const CommandProvider = (props) => {
|
|
140
|
-
const [command, setCommand] = useState(props.command || null);
|
|
141
|
-
return /* @__PURE__ */ jsx(CommandContext.Provider, { value: { command, setCommand }, children: props.children });
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const GameContext = React.createContext({
|
|
145
|
-
game: null,
|
|
146
|
-
gameId: null,
|
|
147
|
-
setGameId(gameId) {
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
const GameProvider = ({ children }) => {
|
|
151
|
-
const { command } = React.useContext(CommandContext);
|
|
152
|
-
const [gameId, setGameId] = useState(command?.getGameId() || null);
|
|
153
|
-
const [game, setGame] = useState(null);
|
|
154
|
-
const handleGameIdChange = async () => {
|
|
155
|
-
if (!gameId) {
|
|
156
|
-
setGame(null);
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
const game2 = await getProject(gameId);
|
|
160
|
-
setGame(game2);
|
|
161
|
-
};
|
|
162
|
-
useEffect(() => {
|
|
163
|
-
handleGameIdChange();
|
|
164
|
-
}, [gameId]);
|
|
165
|
-
return /* @__PURE__ */ jsx(GameContext.Provider, { value: { game, gameId, setGameId }, children });
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
scriptDir(import.meta);
|
|
169
|
-
const getIsAppFound = (result) => {
|
|
170
|
-
const isFound = result?.status === KeyTestStatus.SUCCESS || result?.status === KeyTestStatus.ERROR && result?.error === KeyTestError.NOT_INVITED;
|
|
171
|
-
return isFound;
|
|
172
|
-
};
|
|
173
|
-
const CreateGooglePlayGame = (props) => {
|
|
174
|
-
const { gameId } = useContext(GameContext);
|
|
175
|
-
return /* @__PURE__ */ jsx(Fragment, { children: gameId && /* @__PURE__ */ jsx(Create, { gameId, ...props }) });
|
|
176
|
-
};
|
|
177
|
-
const Create = ({ gameId, onComplete, onError, ...boxProps }) => {
|
|
178
|
-
const { data: result, isFetching } = useAndroidServiceAccountTestResult({ projectId: gameId });
|
|
179
|
-
const { data: builds } = useBuilds({ pageNumber: 0, projectId: gameId });
|
|
180
|
-
const previousIsFound = useRef(false);
|
|
181
|
-
useEffect(() => {
|
|
182
|
-
const isFound = getIsAppFound(result);
|
|
183
|
-
if (previousIsFound.current === false && isFound) {
|
|
184
|
-
onComplete();
|
|
185
|
-
}
|
|
186
|
-
previousIsFound.current = isFound;
|
|
187
|
-
}, [result]);
|
|
188
|
-
useSafeInput(async (input) => {
|
|
189
|
-
if (!gameId) return;
|
|
190
|
-
switch (input) {
|
|
191
|
-
case "r": {
|
|
192
|
-
queryClient.invalidateQueries({
|
|
193
|
-
queryKey: cacheKeys.androidKeyTestResult({ projectId: gameId })
|
|
194
|
-
});
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
case "d": {
|
|
198
|
-
const dashUrl = await getShortAuthRequiredUrl(`/games/${getShortUUID(gameId)}/builds`);
|
|
199
|
-
await open(dashUrl);
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
const initialBuild = builds?.data.find(
|
|
205
|
-
(build) => build.platform === Platform.ANDROID && build.buildType === BuildType.AAB
|
|
206
|
-
);
|
|
207
|
-
const downloadCmd = initialBuild ? `${getBuildSummary(initialBuild).cmd}` : "Initial AAB build not found!";
|
|
208
|
-
const templateVars = {
|
|
209
|
-
dashboardURL: new URL(`/games/${getShortUUID(gameId)}/builds`, WEB_URL).toString(),
|
|
210
|
-
downloadCmd
|
|
211
|
-
};
|
|
212
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: 1, ...boxProps, children: [
|
|
213
|
-
/* @__PURE__ */ jsxs(Box, { flexDirection: "row", gap: 1, children: [
|
|
214
|
-
/* @__PURE__ */ jsx(Text, { bold: true, children: isFetching ? "Checking..." : "ShipThis has not detected your game in Google Play. Press R to test again." }),
|
|
215
|
-
isFetching && /* @__PURE__ */ jsx(Spinner, { type: "dots" })
|
|
216
|
-
] }),
|
|
217
|
-
/* @__PURE__ */ jsx(Markdown, { filename: "create-google-play-game.md.ejs", templateVars })
|
|
218
|
-
] }) });
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
export { CommandContext as C, GameContext as G, Markdown as M, getJobSummary as a, CommandProvider as b, GameProvider as c, getBuildSummary as d, useSafeInput as e, useJob as f, getRenderedMarkdown as g, CreateGooglePlayGame as h, queryBuilds as q, useBuilds as u };
|
package/dist/index-izrACZbC.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { o as API_URL, p as getAuthedHeaders, I as castArrayObjectDates } from './index-BwnzoldS.js';
|
|
3
|
-
import 'node:fs';
|
|
4
|
-
|
|
5
|
-
async function getUserCredentials(pageSize = 100) {
|
|
6
|
-
const headers = getAuthedHeaders();
|
|
7
|
-
const { data } = await axios({
|
|
8
|
-
headers,
|
|
9
|
-
method: "get",
|
|
10
|
-
url: `${API_URL}/credentials?pageSize=${pageSize}`
|
|
11
|
-
});
|
|
12
|
-
return castArrayObjectDates(data.data);
|
|
13
|
-
}
|
|
14
|
-
async function getProjectCredentials(projectId, pageSize = 100) {
|
|
15
|
-
const headers = getAuthedHeaders();
|
|
16
|
-
const { data } = await axios({
|
|
17
|
-
headers,
|
|
18
|
-
method: "get",
|
|
19
|
-
url: `${API_URL}/projects/${projectId}/credentials?pageSize=${pageSize}`
|
|
20
|
-
});
|
|
21
|
-
return castArrayObjectDates(data.data);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { getProjectCredentials as a, getUserCredentials as g };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { useQuery } from '@tanstack/react-query';
|
|
2
|
-
import axios from 'axios';
|
|
3
|
-
import { o as API_URL, p as getAuthedHeaders } from './index-BwnzoldS.js';
|
|
4
|
-
|
|
5
|
-
const cacheKeys = {
|
|
6
|
-
androidKeyTestResult: (props) => ["androidKeyTestResult", ...Object.values(props)],
|
|
7
|
-
androidSetupStatus: (props) => ["androidSetupStatus", ...Object.values(props)],
|
|
8
|
-
builds: (props) => ["builds", ...Object.values(props)],
|
|
9
|
-
googleStatus: () => ["googleStatus"],
|
|
10
|
-
job: (props) => ["job", ...Object.values(props)],
|
|
11
|
-
jobLogs: (props) => ["jobLogs", ...Object.values(props)],
|
|
12
|
-
jobs: (props) => ["jobs", ...Object.values(props)],
|
|
13
|
-
projectCredentials: (props) => ["projectCredentials", ...Object.values(props)],
|
|
14
|
-
userCredentials: (props) => ["userCredentials", ...Object.values(props)]
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
var KeyTestStatus = /* @__PURE__ */ ((KeyTestStatus2) => {
|
|
18
|
-
KeyTestStatus2["ERROR"] = "error";
|
|
19
|
-
KeyTestStatus2["SUCCESS"] = "success";
|
|
20
|
-
return KeyTestStatus2;
|
|
21
|
-
})(KeyTestStatus || {});
|
|
22
|
-
var KeyTestError = /* @__PURE__ */ ((KeyTestError2) => {
|
|
23
|
-
KeyTestError2["APP_NOT_FOUND"] = "app_not_found";
|
|
24
|
-
KeyTestError2["NO_PACKAGE_NAME"] = "no_package_name";
|
|
25
|
-
KeyTestError2["NO_SERVICE_ACCOUNT_KEY"] = "no_service_account_key";
|
|
26
|
-
KeyTestError2["NOT_INVITED"] = "not_invited";
|
|
27
|
-
return KeyTestError2;
|
|
28
|
-
})(KeyTestError || {});
|
|
29
|
-
const KeyTestErrorMessage = {
|
|
30
|
-
["app_not_found" /* APP_NOT_FOUND */]: "Application not found in Google Play Console",
|
|
31
|
-
["no_package_name" /* NO_PACKAGE_NAME */]: "Android Package Name has not been set",
|
|
32
|
-
["no_service_account_key" /* NO_SERVICE_ACCOUNT_KEY */]: "Service Account API Key not found in your account",
|
|
33
|
-
["not_invited" /* NOT_INVITED */]: "Service Account has not been invited to Google Play"
|
|
34
|
-
};
|
|
35
|
-
function niceError(keyError) {
|
|
36
|
-
return keyError ? KeyTestErrorMessage[keyError] : void 0;
|
|
37
|
-
}
|
|
38
|
-
const fetchKeyTestResult = async ({ projectId }, config) => {
|
|
39
|
-
if (!projectId) throw new Error("projectId is required");
|
|
40
|
-
const url = `${API_URL}/projects/${projectId}/credentials/android/key/test`;
|
|
41
|
-
const headers = getAuthedHeaders();
|
|
42
|
-
const { data } = await axios.post(url, {}, { headers, ...config });
|
|
43
|
-
return data;
|
|
44
|
-
};
|
|
45
|
-
const useAndroidServiceAccountTestResult = (props) => useQuery({
|
|
46
|
-
queryFn: () => fetchKeyTestResult(props),
|
|
47
|
-
queryKey: cacheKeys.androidKeyTestResult(props)
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
export { KeyTestStatus as K, KeyTestError as a, cacheKeys as c, fetchKeyTestResult as f, niceError as n, useAndroidServiceAccountTestResult as u };
|