shipthis 0.1.24 → 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-mPUG2R4N.js +0 -76
  6. package/dist/Command-B3AmRt2w.js +0 -28
  7. package/dist/CommandGame-BCMzP9pc.js +0 -9
  8. package/dist/Create-CsJxpzUs.js +0 -59
  9. package/dist/Import-v0M_ygyF.js +0 -110
  10. package/dist/JobProgress-9uvq8IBn.js +0 -121
  11. package/dist/JobStatusTable-Bf7J9WXe.js +0 -191
  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 -216
  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-BD1WLuFJ.js +0 -125
  74. package/dist/index-CIa2EDQ6.js +0 -24
  75. package/dist/index-CboPN9aq.js +0 -138
  76. package/dist/index-DkNQs11R.js +0 -711
  77. package/dist/index-nnzhQ3nY.js +0 -209
  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--BvVn7xS.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 -2286
@@ -1,103 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { Flags } from '@oclif/core';
3
- import { render } from 'ink';
4
- import { P as Platform, C as CredentialsType, A as ApiKey, a as ApiKeyType, U as UserRole } from '../../../index-DkNQs11R.js';
5
- import { g as getUserCredentials } from '../../../index-CIa2EDQ6.js';
6
- import 'react';
7
- import '../../../index-nnzhQ3nY.js';
8
- import 'ink-spinner';
9
- import 'axios';
10
- import 'crypto-js';
11
- import 'uuid';
12
- import 'fs';
13
- import 'luxon';
14
- import '@inkjs/ui';
15
- import '@tanstack/react-query';
16
- import 'yazl';
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 'fast-glob';
24
- import 'socket.io-client';
25
- import 'open';
26
- import 'marked';
27
- import 'marked-terminal';
28
- import 'path';
29
- import 'qrcode';
30
- import { R as RunWithSpinner } from '../../../RunWithSpinner-BVXNWGD3.js';
31
- import 'string-length';
32
- import 'strip-ansi';
33
- import { C as Command } from '../../../Command-B3AmRt2w.js';
34
- import { B as BaseAppleCommand } from '../../../baseAppleCommand-IGl6KTvv.js';
35
- import { u as uploadUserCredentials } from '../../../upload-CRE2nVdd.js';
36
- import '@expo/apple-utils/build/index.js';
37
- import 'ini';
38
- import 'deepmerge';
39
- import '../../../index-BB00V5oF.js';
40
- import '../../../useAndroidServiceAccountTestResult-DcYDam-p.js';
41
-
42
- class AppleApiKeyCreate extends BaseAppleCommand {
43
- static args = {};
44
- static description = "Creates an App Store Connect API Key in your Apple Developer account.\nSaves the private key in your ShipThis account.";
45
- static examples = ["<%= config.bin %> <%= command.id %>", "<%= config.bin %> <%= command.id %> --force"];
46
- static flags = {
47
- force: Flags.boolean({ char: "f" }),
48
- quiet: Flags.boolean({ char: "q", description: "Avoid output except for interactions and errors" })
49
- };
50
- async run() {
51
- const { flags } = this;
52
- const { force } = flags;
53
- const userCredentials = await getUserCredentials();
54
- const userAppleApiKeyCredentials = userCredentials.filter(
55
- (cred) => cred.platform == Platform.IOS && cred.type == CredentialsType.KEY
56
- );
57
- if (userAppleApiKeyCredentials.length !== 0 && !force) {
58
- this.error("An App Store Connect API already exists. Use --force to overwrite it.");
59
- }
60
- const authState = await this.refreshAppleAuthState();
61
- const ctx = authState.context;
62
- const createApiKey = async () => {
63
- const userKey = await ApiKey.createAsync(ctx, {
64
- nickname: `ShipThis ${Math.floor((/* @__PURE__ */ new Date()).valueOf() / 1e3)}`,
65
- allAppsVisible: true,
66
- roles: [UserRole.ADMIN],
67
- keyType: ApiKeyType.PUBLIC_API
68
- });
69
- const keyContent = await userKey.downloadAsync();
70
- if (!keyContent) throw new Error("Failed to download key content");
71
- const reloadedKey = await ApiKey.infoAsync(ctx, { id: userKey.id });
72
- const key = {
73
- keyId: userKey.id,
74
- issuer: `${reloadedKey.attributes.provider?.id}`,
75
- p8Content: keyContent,
76
- serialNumber: userKey.id
77
- };
78
- await uploadUserCredentials({
79
- platform: Platform.IOS,
80
- type: CredentialsType.KEY,
81
- contents: key,
82
- serialNumber: key.serialNumber
83
- });
84
- };
85
- const handleComplete = async () => {
86
- await this.config.runCommand(`apple:apiKey:status`);
87
- };
88
- if (this.flags.quiet) return await createApiKey();
89
- render(
90
- /* @__PURE__ */ jsx(Command, { command: this, children: /* @__PURE__ */ jsx(
91
- RunWithSpinner,
92
- {
93
- msgInProgress: `Creating App Store Connect API in the Apple Developer Portal...`,
94
- msgComplete: `App Store Connect API created and saved to ShipThis`,
95
- executeMethod: createApiKey,
96
- onComplete: handleComplete
97
- }
98
- ) })
99
- );
100
- }
101
- }
102
-
103
- export { AppleApiKeyCreate as default };
@@ -1,81 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { Args, Flags } from '@oclif/core';
3
- import { render } from 'ink';
4
- import * as fs from 'fs';
5
- import { B as BaseAuthenticatedCommand, P as Platform, C as CredentialsType } from '../../../index-DkNQs11R.js';
6
- import { g as getUserCredentials } from '../../../index-CIa2EDQ6.js';
7
- import 'react';
8
- import '../../../index-nnzhQ3nY.js';
9
- import 'ink-spinner';
10
- import 'axios';
11
- import 'crypto-js';
12
- import 'uuid';
13
- import 'luxon';
14
- import '@inkjs/ui';
15
- import '@tanstack/react-query';
16
- import 'yazl';
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 'fast-glob';
24
- import 'socket.io-client';
25
- import 'open';
26
- import 'marked';
27
- import 'marked-terminal';
28
- import 'path';
29
- import 'qrcode';
30
- import { R as RunWithSpinner } from '../../../RunWithSpinner-BVXNWGD3.js';
31
- import 'string-length';
32
- import 'strip-ansi';
33
- import { C as Command } from '../../../Command-B3AmRt2w.js';
34
- import { e as exportCredential } from '../../../export-CVs_xoDN.js';
35
- import '@expo/apple-utils/build/index.js';
36
- import 'ini';
37
- import 'deepmerge';
38
- import '../../../index-BB00V5oF.js';
39
- import '../../../useAndroidServiceAccountTestResult-DcYDam-p.js';
40
-
41
- class AppleApiKeyExport extends BaseAuthenticatedCommand {
42
- static args = {
43
- file: Args.string({ description: "Name of the ZIP file to create", required: true })
44
- };
45
- static description = "Saves the current App Store Connect API Key to a ZIP file";
46
- static examples = ["<%= config.bin %> <%= command.id %> userApiKey.zip"];
47
- static flags = {
48
- force: Flags.boolean({ char: "f", description: "Overwrite the file if it already exists" })
49
- };
50
- async run() {
51
- const { args, flags } = this;
52
- const { file } = args;
53
- const { force } = flags;
54
- const zipAlreadyExists = fs.existsSync(file);
55
- if (zipAlreadyExists && !force) {
56
- this.error(`The file ${file} already exists. Use --force to overwrite it.`);
57
- }
58
- const userCredentials = await getUserCredentials();
59
- const userAppleApiKeyCredentials = userCredentials.filter(
60
- (cred) => cred.platform == Platform.IOS && cred.type == CredentialsType.KEY
61
- );
62
- if (userAppleApiKeyCredentials.length === 0) {
63
- this.error("No App Store Connect API Key found which can be exported.");
64
- }
65
- const [key] = userAppleApiKeyCredentials;
66
- const handleComplete = async () => process.exit(0);
67
- render(
68
- /* @__PURE__ */ jsx(Command, { command: this, children: /* @__PURE__ */ jsx(
69
- RunWithSpinner,
70
- {
71
- msgInProgress: `Exporting App Store Connect API Key to ${file}...`,
72
- msgComplete: `App Store Connect API Key exported to ${file}`,
73
- executeMethod: () => exportCredential({ zipPath: file, credentialId: key.id }),
74
- onComplete: handleComplete
75
- }
76
- ) })
77
- );
78
- }
79
- }
80
-
81
- export { AppleApiKeyExport as default };
@@ -1,85 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { Args, Flags } from '@oclif/core';
3
- import { render } from 'ink';
4
- import * as fs from 'fs';
5
- import { B as BaseAuthenticatedCommand, P as Platform, C as CredentialsType } from '../../../index-DkNQs11R.js';
6
- import { g as getUserCredentials } from '../../../index-CIa2EDQ6.js';
7
- import 'react';
8
- import '../../../index-nnzhQ3nY.js';
9
- import 'ink-spinner';
10
- import 'axios';
11
- import 'crypto-js';
12
- import 'uuid';
13
- import 'luxon';
14
- import '@inkjs/ui';
15
- import '@tanstack/react-query';
16
- import 'yazl';
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 'fast-glob';
24
- import 'socket.io-client';
25
- import 'open';
26
- import 'marked';
27
- import 'marked-terminal';
28
- import 'path';
29
- import 'qrcode';
30
- import { R as RunWithSpinner } from '../../../RunWithSpinner-BVXNWGD3.js';
31
- import 'string-length';
32
- import 'strip-ansi';
33
- import { C as Command } from '../../../Command-B3AmRt2w.js';
34
- import { i as importCredential } from '../../../import-Ch5O7xfN.js';
35
- import '@expo/apple-utils/build/index.js';
36
- import 'ini';
37
- import 'deepmerge';
38
- import '../../../index-BB00V5oF.js';
39
- import '../../../useAndroidServiceAccountTestResult-DcYDam-p.js';
40
-
41
- class AppleApiKeyImport extends BaseAuthenticatedCommand {
42
- static args = {
43
- file: Args.string({
44
- description: "Name of the ZIP file to import (must be in the same format as the export)",
45
- required: true
46
- })
47
- };
48
- static description = "Imports an App Store Connect API Key ZIP file into your ShipThis account";
49
- static examples = ["<%= config.bin %> <%= command.id %> userApiKey.zip"];
50
- static flags = {
51
- force: Flags.boolean({ char: "f" })
52
- };
53
- async run() {
54
- const { args, flags } = this;
55
- const { file } = args;
56
- const { force } = flags;
57
- const zipFound = fs.existsSync(file);
58
- if (!zipFound) {
59
- this.error(`The file ${file} does not exist.`);
60
- }
61
- const userCredentials = await getUserCredentials();
62
- const userAppleApiKeyCredentials = userCredentials.filter(
63
- (cred) => cred.platform == Platform.IOS && cred.type == CredentialsType.KEY
64
- );
65
- if (userAppleApiKeyCredentials.length !== 0 && !force) {
66
- this.error("An App Store Connect API Key already exists. Use --force to overwrite it.");
67
- }
68
- const handleComplete = async () => {
69
- await this.config.runCommand(`apple:apiKey:status`, ["--noAppleAuth"]);
70
- };
71
- render(
72
- /* @__PURE__ */ jsx(Command, { command: this, children: /* @__PURE__ */ jsx(
73
- RunWithSpinner,
74
- {
75
- msgInProgress: `Importing App Store Connect API from ${file}...`,
76
- msgComplete: `App Store Connect API imported from ${file}`,
77
- executeMethod: () => importCredential({ zipPath: file, type: CredentialsType.KEY, platform: Platform.IOS }),
78
- onComplete: handleComplete
79
- }
80
- ) })
81
- );
82
- }
83
- }
84
-
85
- export { AppleApiKeyImport as default };
@@ -1,122 +0,0 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { Flags } from '@oclif/core';
3
- import { Box, Text, render } from 'ink';
4
- import { b as getShortDate, A as ApiKey, C as CredentialsType, P as Platform, B as BaseAuthenticatedCommand } from '../../../index-DkNQs11R.js';
5
- import 'react';
6
- import '../../../index-nnzhQ3nY.js';
7
- import Spinner from 'ink-spinner';
8
- import 'axios';
9
- import 'crypto-js';
10
- import 'uuid';
11
- import 'fs';
12
- import { DateTime } from 'luxon';
13
- import '@inkjs/ui';
14
- import { useQuery } from '@tanstack/react-query';
15
- import 'yazl';
16
- import 'crypto';
17
- import 'readline-sync';
18
- import 'node:readline';
19
- import 'node:path';
20
- import 'node:url';
21
- import 'isomorphic-git';
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 'string-length';
30
- import 'strip-ansi';
31
- import { u as useUserCredentials, U as UserCredentialsTable } from '../../../UserCredentialsTable-DhtM_iTG.js';
32
- import { T as Table } from '../../../Table-CvM6pccN.js';
33
- import { T as Title } from '../../../Title-BCQtayg6.js';
34
- import { N as NextSteps } from '../../../NextSteps-CK9zHOCt.js';
35
- import { C as Command } from '../../../Command-B3AmRt2w.js';
36
- import '@expo/apple-utils/build/index.js';
37
- import 'ini';
38
- import 'deepmerge';
39
- import '../../../index-BB00V5oF.js';
40
- import '../../../useAndroidServiceAccountTestResult-DcYDam-p.js';
41
-
42
- async function queryAppleApiKeys({ ctx }) {
43
- const keys = await ApiKey.getAsync(ctx);
44
- const activeKeys = keys.filter((key) => key.attributes.isActive);
45
- return activeKeys;
46
- }
47
- const canAppleApiKeyBeUsed = (key, userCredentials) => {
48
- if (!key.attributes.isActive) return false;
49
- return userCredentials.some((cred) => cred.isActive && cred.serialNumber == key.id);
50
- };
51
- function getAppleApiKeySummary(key, userCredentials) {
52
- return {
53
- keyID: key.id,
54
- name: key.attributes.nickname,
55
- roles: key.attributes.roles?.join(", "),
56
- lastUsed: getShortDate(DateTime.fromISO(key.attributes.lastUsed)),
57
- canBeUsed: canAppleApiKeyBeUsed(key, userCredentials)
58
- };
59
- }
60
- const useAppleApiKeys = (props) => {
61
- const queryResult = useQuery({
62
- queryKey: ["appleApiKeys"],
63
- queryFn: () => queryAppleApiKeys(props)
64
- });
65
- return queryResult;
66
- };
67
-
68
- const AppleApiKeysTable = ({ ctx, ...boxProps }) => {
69
- const { data: userCredentialsResponse } = useUserCredentials({ platform: Platform.IOS, type: CredentialsType.KEY });
70
- const { data: keys, isLoading } = useAppleApiKeys({ ctx });
71
- const hasUsable = keys && userCredentialsResponse && keys.some((key) => canAppleApiKeyBeUsed(key, userCredentialsResponse.data));
72
- return /* @__PURE__ */ jsxs(Fragment, { children: [
73
- /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, ...boxProps, children: [
74
- /* @__PURE__ */ jsx(Title, { children: "App Store Connect API Keys in your Apple account" }),
75
- isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }),
76
- keys && userCredentialsResponse && /* @__PURE__ */ jsxs(Fragment, { children: [
77
- /* @__PURE__ */ jsxs(Box, { marginLeft: 2, marginBottom: 1, flexDirection: "column", children: [
78
- /* @__PURE__ */ jsx(Text, { children: `You have ${keys.length} App Store Connect API Keys in your Apple account` }),
79
- /* @__PURE__ */ jsx(Text, { children: `${hasUsable ? "One" : "None"} of these can be used by ShipThis` })
80
- ] }),
81
- keys.length > 0 && /* @__PURE__ */ jsx(Table, { data: keys.map((key) => getAppleApiKeySummary(key, userCredentialsResponse.data)) }),
82
- !hasUsable && /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { bold: true, children: "You do not have a usable App Store Connect API Key. To ship an iOS game, you will need a usable App Store Connect API Key." }) })
83
- ] })
84
- ] }),
85
- keys && !hasUsable && /* @__PURE__ */ jsx(NextSteps, { steps: ["shipthis apple apiKey create"] })
86
- ] });
87
- };
88
-
89
- class AppleApiKeyStatus extends BaseAuthenticatedCommand {
90
- static args = {};
91
- static description = "Displays the status of App Store Connect API Keys in your Apple and ShipThis accounts.\nThis API key is used to automatically publish your games to the App Store.";
92
- static examples = [
93
- "<%= config.bin %> <%= command.id %>",
94
- "<%= config.bin %> <%= command.id %> --noAppleAuth"
95
- ];
96
- static flags = {
97
- noAppleAuth: Flags.boolean({ char: "f" })
98
- };
99
- async run() {
100
- const { flags } = this;
101
- const showApple = !flags.noAppleAuth;
102
- let ctx = null;
103
- if (showApple) {
104
- const authState = await this.refreshAppleAuthState();
105
- ctx = authState.context;
106
- }
107
- render(
108
- /* @__PURE__ */ jsxs(Command, { command: this, children: [
109
- /* @__PURE__ */ jsx(
110
- UserCredentialsTable,
111
- {
112
- credentialTypeName: "App Store Connect API Key",
113
- queryProps: { type: CredentialsType.KEY, platform: Platform.IOS }
114
- }
115
- ),
116
- showApple && /* @__PURE__ */ jsx(AppleApiKeysTable, { ctx })
117
- ] })
118
- );
119
- }
120
- }
121
-
122
- export { AppleApiKeyStatus as default };
@@ -1,133 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { Flags } from '@oclif/core';
3
- import { render } from 'ink';
4
- import { m as CertificateType, l as Certificate, P as Platform, C as CredentialsType } from '../../../index-DkNQs11R.js';
5
- import { g as getUserCredentials } from '../../../index-CIa2EDQ6.js';
6
- import 'react';
7
- import '../../../index-nnzhQ3nY.js';
8
- import 'ink-spinner';
9
- import 'axios';
10
- import 'crypto-js';
11
- import 'uuid';
12
- import 'fs';
13
- import 'luxon';
14
- import '@inkjs/ui';
15
- import '@tanstack/react-query';
16
- import 'yazl';
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 'fast-glob';
24
- import 'socket.io-client';
25
- import 'open';
26
- import 'marked';
27
- import 'marked-terminal';
28
- import 'path';
29
- import 'qrcode';
30
- import { R as RunWithSpinner } from '../../../RunWithSpinner-BVXNWGD3.js';
31
- import 'string-length';
32
- import 'strip-ansi';
33
- import { C as Command } from '../../../Command-B3AmRt2w.js';
34
- import forge from 'node-forge';
35
- import { B as BaseAppleCommand } from '../../../baseAppleCommand-IGl6KTvv.js';
36
- import { u as uploadUserCredentials } from '../../../upload-CRE2nVdd.js';
37
- import '@expo/apple-utils/build/index.js';
38
- import 'ini';
39
- import 'deepmerge';
40
- import '../../../index-BB00V5oF.js';
41
- import '../../../useAndroidServiceAccountTestResult-DcYDam-p.js';
42
-
43
- function decodeCertificate(certificateContent) {
44
- const decodedContent = forge.util.decode64(certificateContent);
45
- const asn1 = forge.asn1.fromDer(decodedContent);
46
- return forge.pki.certificateFromAsn1(asn1);
47
- }
48
- function encodePkcs12(pkcs12Asn1) {
49
- const derBytes = forge.asn1.toDer(pkcs12Asn1).getBytes();
50
- return forge.util.encode64(derBytes);
51
- }
52
- async function createCertificate(ctx, certificateType = CertificateType.IOS_DISTRIBUTION) {
53
- const {
54
- pem: csrPem,
55
- keyPair: { privateKey }
56
- } = await Certificate.createCertificateSigningRequestAsync();
57
- const certificate = await Certificate.createAsync(ctx, {
58
- csrContent: csrPem,
59
- certificateType
60
- });
61
- return {
62
- certificate,
63
- privateKey,
64
- privateKeyPem: forge.pki.privateKeyToPem(privateKey)
65
- };
66
- }
67
- function exportCertificate(certificate, privateKey) {
68
- const decodedCertificate = decodeCertificate(certificate.attributes.certificateContent);
69
- const password = forge.util.encode64(forge.random.getBytesSync(16));
70
- const pkcs12Asn1 = forge.pkcs12.toPkcs12Asn1(privateKey, [decodedCertificate], password, {
71
- friendlyName: "key",
72
- algorithm: "3des"
73
- });
74
- const encodedPkcs12 = encodePkcs12(pkcs12Asn1);
75
- return {
76
- certificateBase64: encodedPkcs12,
77
- certificatePassword: password
78
- };
79
- }
80
-
81
- class AppleCertificateCreate extends BaseAppleCommand {
82
- static args = {};
83
- static description = "Creates an iOS Distribution Certificate in your Apple Developer account.\nSaves the certificate with the private key to your ShipThis account";
84
- static examples = ["<%= config.bin %> <%= command.id %>", "<%= config.bin %> <%= command.id %> --force"];
85
- static flags = {
86
- force: Flags.boolean({ char: "f" }),
87
- quiet: Flags.boolean({ char: "q", description: "Avoid output except for interactions and errors" })
88
- };
89
- async run() {
90
- const { flags } = this;
91
- const { force } = flags;
92
- const userCredentials = await getUserCredentials();
93
- const userAppleDistCredentials = userCredentials.filter(
94
- (cred) => cred.platform == Platform.IOS && cred.type == CredentialsType.CERTIFICATE
95
- );
96
- if (userAppleDistCredentials.length !== 0 && !force) {
97
- this.error("An Apple Distribution Certificate already exists. Use --force to overwrite it.");
98
- }
99
- const authState = await this.refreshAppleAuthState();
100
- const ctx = authState.context;
101
- const createCert = async () => {
102
- const { certificate, privateKey } = await createCertificate(ctx);
103
- const exported = exportCertificate(certificate, privateKey);
104
- const serialNumber = certificate.attributes.serialNumber;
105
- await uploadUserCredentials({
106
- platform: Platform.IOS,
107
- type: CredentialsType.CERTIFICATE,
108
- contents: {
109
- serialNumber,
110
- ...exported
111
- },
112
- serialNumber
113
- });
114
- };
115
- const handleComplete = async () => {
116
- await this.config.runCommand(`apple:certificate:status`);
117
- };
118
- if (this.flags.quiet) return await createCert();
119
- render(
120
- /* @__PURE__ */ jsx(Command, { command: this, children: /* @__PURE__ */ jsx(
121
- RunWithSpinner,
122
- {
123
- msgInProgress: `Creating certificate in the Apple Developer Portal...`,
124
- msgComplete: `Certificate created and saved to ShipThis`,
125
- executeMethod: createCert,
126
- onComplete: handleComplete
127
- }
128
- ) })
129
- );
130
- }
131
- }
132
-
133
- export { AppleCertificateCreate as default };
@@ -1,81 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { Args, Flags } from '@oclif/core';
3
- import { render } from 'ink';
4
- import * as fs from 'fs';
5
- import { B as BaseAuthenticatedCommand, P as Platform, C as CredentialsType } from '../../../index-DkNQs11R.js';
6
- import { g as getUserCredentials } from '../../../index-CIa2EDQ6.js';
7
- import 'react';
8
- import '../../../index-nnzhQ3nY.js';
9
- import 'ink-spinner';
10
- import 'axios';
11
- import 'crypto-js';
12
- import 'uuid';
13
- import 'luxon';
14
- import '@inkjs/ui';
15
- import '@tanstack/react-query';
16
- import 'yazl';
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 'fast-glob';
24
- import 'socket.io-client';
25
- import 'open';
26
- import 'marked';
27
- import 'marked-terminal';
28
- import 'path';
29
- import 'qrcode';
30
- import { R as RunWithSpinner } from '../../../RunWithSpinner-BVXNWGD3.js';
31
- import 'string-length';
32
- import 'strip-ansi';
33
- import { C as Command } from '../../../Command-B3AmRt2w.js';
34
- import { e as exportCredential } from '../../../export-CVs_xoDN.js';
35
- import '@expo/apple-utils/build/index.js';
36
- import 'ini';
37
- import 'deepmerge';
38
- import '../../../index-BB00V5oF.js';
39
- import '../../../useAndroidServiceAccountTestResult-DcYDam-p.js';
40
-
41
- class AppleCertificateExport extends BaseAuthenticatedCommand {
42
- static args = {
43
- file: Args.string({ description: "Name of the ZIP file to create", required: true })
44
- };
45
- static description = "Saves the current Apple Distribution Certificate to a ZIP file.";
46
- static examples = ["<%= config.bin %> <%= command.id %> userCert.zip"];
47
- static flags = {
48
- force: Flags.boolean({ char: "f", description: "Overwrite the file if it already exists" })
49
- };
50
- async run() {
51
- const { args, flags } = this;
52
- const { file } = args;
53
- const { force } = flags;
54
- const zipAlreadyExists = fs.existsSync(file);
55
- if (zipAlreadyExists && !force) {
56
- this.error(`The file ${file} already exists. Use --force to overwrite it.`);
57
- }
58
- const userCredentials = await getUserCredentials();
59
- const userAppleDistCredentials = userCredentials.filter(
60
- (cred) => cred.platform == Platform.IOS && cred.type == CredentialsType.CERTIFICATE
61
- );
62
- if (userAppleDistCredentials.length === 0) {
63
- this.error("No Apple Distribution Certificate found which can be exported.");
64
- }
65
- const [cert] = userAppleDistCredentials;
66
- const handleComplete = async () => process.exit(0);
67
- render(
68
- /* @__PURE__ */ jsx(Command, { command: this, children: /* @__PURE__ */ jsx(
69
- RunWithSpinner,
70
- {
71
- msgInProgress: `Exporting certificate to ${file}...`,
72
- msgComplete: `Certificate exported to ${file}`,
73
- executeMethod: () => exportCredential({ zipPath: file, credentialId: cert.id }),
74
- onComplete: handleComplete
75
- }
76
- ) })
77
- );
78
- }
79
- }
80
-
81
- export { AppleCertificateExport as default };