expo-release-it 0.6.0 → 0.6.2

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 (141) hide show
  1. package/build/EnvUtil-DWWwkHaf.js +8 -0
  2. package/build/EnvUtil-DWWwkHaf.js.map +1 -0
  3. package/build/FastlaneOption-B9A0ECDL.js +35 -0
  4. package/build/FastlaneOption-B9A0ECDL.js.map +1 -0
  5. package/build/FileUtil-B9JnWobK.js +57 -0
  6. package/build/FileUtil-B9JnWobK.js.map +1 -0
  7. package/build/InqueryInputs-BGj-DlRa.js +112 -0
  8. package/build/InqueryInputs-BGj-DlRa.js.map +1 -0
  9. package/build/MetadataSyncUtil-j79hX3QT.js +42 -0
  10. package/build/MetadataSyncUtil-j79hX3QT.js.map +1 -0
  11. package/build/OptionHolder-H3HG0A95.js +99 -0
  12. package/build/OptionHolder-H3HG0A95.js.map +1 -0
  13. package/build/VersionUtil-BDB10Hpb.js +101 -0
  14. package/build/VersionUtil-BDB10Hpb.js.map +1 -0
  15. package/build/build-DLOdnj2j.js +88 -0
  16. package/build/build-DLOdnj2j.js.map +1 -0
  17. package/build/bump-0hlTovjE.js +122 -0
  18. package/build/bump-0hlTovjE.js.map +1 -0
  19. package/build/calculateElapsed-CynU9UU_.js +13 -0
  20. package/build/calculateElapsed-CynU9UU_.js.map +1 -0
  21. package/build/command/build.d.ts +7 -3
  22. package/build/command/build.js +23 -711
  23. package/build/command/bump.d.ts +7 -3
  24. package/build/command/bump.js +14 -486
  25. package/build/command/init.d.ts +7 -3
  26. package/build/command/init.js +13 -462
  27. package/build/command/pull.d.ts +7 -3
  28. package/build/command/pull.js +22 -696
  29. package/build/command/submit.d.ts +7 -3
  30. package/build/command/submit.js +23 -700
  31. package/build/command/upload.d.ts +7 -3
  32. package/build/command/upload.js +23 -705
  33. package/build/execShellScript-Bd5xbFX5.js +22 -0
  34. package/build/execShellScript-Bd5xbFX5.js.map +1 -0
  35. package/build/generateAppStoreConnectApiKeyFile-DjxlrcZn.js +18 -0
  36. package/build/generateAppStoreConnectApiKeyFile-DjxlrcZn.js.map +1 -0
  37. package/build/hydrateKeyholderFileValues-BoaRs3SC.js +11 -0
  38. package/build/hydrateKeyholderFileValues-BoaRs3SC.js.map +1 -0
  39. package/build/index.d.ts +3 -1
  40. package/build/index.js +62 -1247
  41. package/build/index.js.map +1 -1
  42. package/build/init-cjD4jZiy.js +148 -0
  43. package/build/init-cjD4jZiy.js.map +1 -0
  44. package/build/injectTemplatePlaceHolders-CpIvd0dG.js +16 -0
  45. package/build/injectTemplatePlaceHolders-CpIvd0dG.js.map +1 -0
  46. package/build/iterateAllFiles-CbEPek2B.js +15 -0
  47. package/build/iterateAllFiles-CbEPek2B.js.map +1 -0
  48. package/build/logger-DvQ7ScMQ.js +16 -0
  49. package/build/logger-DvQ7ScMQ.js.map +1 -0
  50. package/build/parseConfigFile-hMLUnLZR.js +29 -0
  51. package/build/parseConfigFile-hMLUnLZR.js.map +1 -0
  52. package/build/prepareAndroid-Cjz6r6o0.js +53 -0
  53. package/build/prepareAndroid-Cjz6r6o0.js.map +1 -0
  54. package/build/prepareIos-ByPLFHC8.js +33 -0
  55. package/build/prepareIos-ByPLFHC8.js.map +1 -0
  56. package/build/pull-BHSlClDy.js +70 -0
  57. package/build/pull-BHSlClDy.js.map +1 -0
  58. package/build/replaceStringIfNotContain-CgZ460_D.js +9 -0
  59. package/build/replaceStringIfNotContain-CgZ460_D.js.map +1 -0
  60. package/build/setup-CRNjdK5q.js +25 -0
  61. package/build/setup-CRNjdK5q.js.map +1 -0
  62. package/build/spinner-BVmbE9I_.js +15 -0
  63. package/build/spinner-BVmbE9I_.js.map +1 -0
  64. package/build/submit-5gTyWBU2.js +65 -0
  65. package/build/submit-5gTyWBU2.js.map +1 -0
  66. package/build/throwError-DMF6E5pu.js +14 -0
  67. package/build/throwError-DMF6E5pu.js.map +1 -0
  68. package/build/type/{ExpoReleaseItConfiguration.d.d.ts → ExpoReleaseItConfiguration.d.ts} +7 -5
  69. package/build/upload-S09j3abh.js +68 -0
  70. package/build/upload-S09j3abh.js.map +1 -0
  71. package/build/util/EnvUtil.d.ts +3 -1
  72. package/build/util/EnvUtil.js +3 -10
  73. package/build/util/FastlaneOption.d.ts +3 -1
  74. package/build/util/FastlaneOption.js +4 -118
  75. package/build/util/FileUtil.d.ts +4 -2
  76. package/build/util/FileUtil.js +3 -78
  77. package/build/util/MetadataSyncUtil.d.ts +3 -1
  78. package/build/util/MetadataSyncUtil.js +5 -177
  79. package/build/util/OptionHolder.d.ts +45 -43
  80. package/build/util/OptionHolder.js +3 -88
  81. package/build/util/calculateElapsed.d.ts +3 -1
  82. package/build/util/calculateElapsed.js +3 -12
  83. package/build/util/generateAppStoreConnectApiKeyFile.d.ts +3 -1
  84. package/build/util/generateAppStoreConnectApiKeyFile.js +4 -117
  85. package/build/util/injectTemplatePlaceHolders.d.ts +3 -1
  86. package/build/util/injectTemplatePlaceHolders.js +5 -137
  87. package/build/util/input/InqueryInputs.d.ts +19 -12
  88. package/build/util/input/InqueryInputs.js +4 -205
  89. package/build/util/iterateAllFiles.d.ts +3 -1
  90. package/build/util/iterateAllFiles.js +3 -34
  91. package/build/util/logger.d.ts +10 -8
  92. package/build/util/logger.js +3 -16
  93. package/build/util/parseConfigFile.d.ts +3 -1
  94. package/build/util/parseConfigFile.js +4 -151
  95. package/build/util/replaceStringIfNotContain.d.ts +5 -0
  96. package/build/util/replaceStringIfNotContain.js +3 -0
  97. package/build/util/setup/VersionUtil.d.ts +9 -4
  98. package/build/util/setup/VersionUtil.js +8 -253
  99. package/build/util/setup/execShellScript.d.ts +16 -14
  100. package/build/util/setup/execShellScript.js +3 -19
  101. package/build/util/setup/hydrateKeyholderFileValues.d.ts +3 -1
  102. package/build/util/setup/hydrateKeyholderFileValues.js +4 -101
  103. package/build/util/setup/prepareAndroid.d.ts +3 -1
  104. package/build/util/setup/prepareAndroid.js +12 -281
  105. package/build/util/setup/prepareIos.d.ts +3 -1
  106. package/build/util/setup/prepareIos.js +11 -263
  107. package/build/util/setup/setup.d.ts +3 -1
  108. package/build/util/setup/setup.js +11 -272
  109. package/build/util/spinner.d.ts +3 -1
  110. package/build/util/spinner.js +3 -14
  111. package/build/util/throwError.d.ts +3 -1
  112. package/build/util/throwError.js +4 -33
  113. package/package.json +5 -5
  114. package/build/command/build.js.map +0 -1
  115. package/build/command/bump.js.map +0 -1
  116. package/build/command/init.js.map +0 -1
  117. package/build/command/pull.js.map +0 -1
  118. package/build/command/submit.js.map +0 -1
  119. package/build/command/upload.js.map +0 -1
  120. package/build/type/ExpoReleaseItConfiguration.d.js +0 -1
  121. package/build/type/ExpoReleaseItConfiguration.d.js.map +0 -1
  122. package/build/util/EnvUtil.js.map +0 -1
  123. package/build/util/FastlaneOption.js.map +0 -1
  124. package/build/util/FileUtil.js.map +0 -1
  125. package/build/util/MetadataSyncUtil.js.map +0 -1
  126. package/build/util/OptionHolder.js.map +0 -1
  127. package/build/util/calculateElapsed.js.map +0 -1
  128. package/build/util/generateAppStoreConnectApiKeyFile.js.map +0 -1
  129. package/build/util/injectTemplatePlaceHolders.js.map +0 -1
  130. package/build/util/input/InqueryInputs.js.map +0 -1
  131. package/build/util/iterateAllFiles.js.map +0 -1
  132. package/build/util/logger.js.map +0 -1
  133. package/build/util/parseConfigFile.js.map +0 -1
  134. package/build/util/setup/VersionUtil.js.map +0 -1
  135. package/build/util/setup/execShellScript.js.map +0 -1
  136. package/build/util/setup/hydrateKeyholderFileValues.js.map +0 -1
  137. package/build/util/setup/prepareAndroid.js.map +0 -1
  138. package/build/util/setup/prepareIos.js.map +0 -1
  139. package/build/util/setup/setup.js.map +0 -1
  140. package/build/util/spinner.js.map +0 -1
  141. package/build/util/throwError.js.map +0 -1
@@ -1,700 +1,23 @@
1
- // package.json
2
- var package_default = {
3
- name: "expo-release-it",
4
- module: "src/index.ts",
5
- type: "module",
6
- version: "0.5.3",
7
- license: "MIT",
8
- homepage: "https://expo-release-it.mjstudio.net/",
9
- repository: "https://github.com/mym0404/expo-release-it",
10
- scripts: {
11
- build: "pnpm build:json-schema-type && tsup",
12
- "build:json-schema-type": "json2ts --input expo-release-it.schema.json --output src/type/ExpoReleaseItConfiguration.d.ts",
13
- dev: "pnpm build && NODE_ENV=development node bin/expo-release-it.mjs",
14
- release: "pnpm build && pnpm run t && release-it && pnpm publish",
15
- t: "lefthook run check"
16
- },
17
- dependencies: {
18
- "@inquirer/prompts": "^7.4.1",
19
- "@mj-studio/js-util": "^1.1.20",
20
- chalk: "^5.4.1",
21
- commander: "^13.1.0",
22
- execa: "^9.5.2",
23
- "fs-extra": "^11.3.0",
24
- ora: "^8.2.0",
25
- react: "catalog:native",
26
- "react-native": "catalog:native",
27
- semver: "^7.7.1",
28
- url: "^0.11.4"
29
- },
30
- devDependencies: {
31
- "@commitlint/config-conventional": "^19.8.0",
32
- "@release-it/conventional-changelog": "^10.0.1",
33
- "@types/fs-extra": "^11.0.4",
34
- "@types/semver": "^7.7.0",
35
- "json-schema-to-typescript": "^15.0.4",
36
- lefthook: "^1.11.11",
37
- prettier: "catalog:",
38
- "release-it": "^19.0.1",
39
- "tiny-glob": "^0.2.9",
40
- tsup: "^8.4.0",
41
- typescript: "catalog:",
42
- vitest: "^3.1.2"
43
- },
44
- bin: "./bin/expo-release-it.mjs",
45
- files: [
46
- "build",
47
- "package.json",
48
- "bin",
49
- "template",
50
- "expo-release-it.schema.json"
51
- ],
52
- commitlint: {
53
- extends: [
54
- "@commitlint/config-conventional"
55
- ]
56
- },
57
- packageManager: "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
58
- };
59
-
60
- // src/util/FileUtil.ts
61
- import fs from "fs-extra";
62
- import * as path from "path";
63
- var join2 = path.join;
64
- var resolve2 = path.resolve;
65
- function exist(path2) {
66
- return fs.existsSync(path2);
67
- }
68
- function isDir(path2) {
69
- return exist(path2) && fs.lstatSync(path2).isDirectory();
70
- }
71
- function relativePath(from, to) {
72
- return path.relative(from, to);
73
- }
74
- function isFile(path2) {
75
- return exist(path2) && fs.lstatSync(path2).isFile();
76
- }
77
- function read(path2) {
78
- return fs.readFileSync(path2, { encoding: "utf8" });
79
- }
80
- function readdir(path2) {
81
- return fs.readdirSync(path2);
82
- }
83
- function readJsonSlow(path2) {
84
- return fs.readJSONSync(path2);
85
- }
86
- function write(p, content) {
87
- const dir = path.dirname(p);
88
- if (!exist(dir)) {
89
- fs.mkdirSync(dir, { recursive: true });
90
- }
91
- return fs.writeFileSync(p, content);
92
- }
93
- function copy(src, dest, options) {
94
- fs.copySync(src, dest, options);
95
- }
96
- function remove(path2) {
97
- if (!exist(path2)) {
98
- return;
99
- }
100
- if (fs.lstatSync(path2).isDirectory()) {
101
- return fs.rmSync(path2, { force: true, recursive: true });
102
- } else {
103
- return fs.rmSync(path2, { force: true });
104
- }
105
- }
106
- async function iterateDir(path2, fn) {
107
- if (!isDir(path2)) {
108
- return;
109
- }
110
- for (const file of fs.readdirSync(path2)) {
111
- await fn(file);
112
- }
113
- }
114
-
115
- // src/util/OptionHolder.ts
116
- import { fileURLToPath } from "url";
117
- var OptionHolder = {
118
- cli: {
119
- version: package_default.version,
120
- rootDir: resolve2(fileURLToPath(import.meta.url), "../.."),
121
- templateDir: resolve2(fileURLToPath(import.meta.url), "../../template")
122
- },
123
- input: {
124
- git: {}
125
- },
126
- keyholderMap: {},
127
- templateDirNames: ["key"],
128
- projectDir: "",
129
- resourcesDir: "",
130
- keyDir: "",
131
- keyholderFilePath: "",
132
- versionName: "",
133
- versionCode: "",
134
- tempDir: ""
135
- };
136
-
137
- // src/util/setup/hydrateKeyholderFileValues.ts
138
- async function hydrateKeyholderFileValues() {
139
- if (exist(OptionHolder.keyholderFilePath)) {
140
- Object.assign(OptionHolder.keyholderMap, readJsonSlow(OptionHolder.keyholderFilePath));
141
- }
142
- }
143
-
144
- // src/util/logger.ts
145
- import chalk from "chalk";
146
- var logger = {
147
- success: (...msg) => console.log(chalk.green(`\u2714 ${msg.join(", ")}`)),
148
- done: (...msg) => console.log(chalk.green(`\u2714 ${msg.join(", ")} - Done`)),
149
- error: (...msg) => console.log(chalk.red(`\u2716 ${msg.join(", ")}`)),
150
- warn: (...msg) => console.log(chalk.yellow(`\u26A0 ${msg.join(", ")}`)),
151
- info: (...msg) => console.log(chalk.cyan(`\u2139 ${msg.join(", ")}`)),
152
- title: (...msg) => console.log(chalk.bold.blue(`
153
- ${msg.join(", ")}`)),
154
- dim: (...msg) => console.log(chalk.dim(msg.join(", ")))
155
- };
156
-
157
- // src/util/EnvUtil.ts
158
- var isDev = process.env.NODE_ENV === "development";
159
- var isWin = process.platform.startsWith("win");
160
- var isTest = process.env.NODE_ENV === "test";
161
-
162
- // src/util/throwError.ts
163
- function throwError(message, e) {
164
- if (e) {
165
- logger.error(message, e);
166
- } else {
167
- logger.error(message);
168
- }
169
- if (isTest) {
170
- throw new Error("throwError");
171
- }
172
- process.exit(1);
173
- }
174
-
175
- // src/util/setup/VersionUtil.ts
176
- import semver from "semver";
177
- import { padZero } from "@mj-studio/js-util";
178
- var versionNameRegex = () => /const\s+VERSION_NAME\s*?=\s*?['"]([\d\.]*?)['"]\s*?;?/;
179
- var versionCodeRegex = () => /const\s+VERSION_CODE\s*?=\s*?(\d+)\s*?;?/;
180
- async function parseBinaryVersions() {
181
- const files = readdir(OptionHolder.projectDir);
182
- const jsConfigFiles = ["app.config.ts", "app.config.js", "app.config.cjs", "app.config.mjs"];
183
- const jsonConfigFile = "app.json";
184
- for (const jsConfigFile of jsConfigFiles) {
185
- if (files.includes(jsConfigFile)) {
186
- await parseFromJsConfigFile(jsConfigFile);
187
- return;
188
- }
189
- }
190
- if (files.includes(jsonConfigFile)) {
191
- await parseFromJsonConfigFile(jsonConfigFile);
192
- return;
193
- }
194
- throwError("expo config file not found");
195
- async function parseFromJsConfigFile(filename) {
196
- const filePath = resolve2(OptionHolder.projectDir, filename);
197
- const content = read(filePath);
198
- const VERSION_NAME = versionNameRegex().exec(content)?.[1];
199
- const VERSION_CODE = versionCodeRegex().exec(content)?.[1];
200
- if (!VERSION_NAME) {
201
- throwError("cannot parse version name");
202
- }
203
- if (!VERSION_CODE) {
204
- throwError("cannot parse version code");
205
- }
206
- if (!semver.valid(VERSION_NAME)) {
207
- throwError("VERSION_NAME is not a valid semver format");
208
- }
209
- OptionHolder.versionName = VERSION_NAME;
210
- OptionHolder.versionCode = VERSION_CODE;
211
- }
212
- async function parseFromJsonConfigFile(filename) {
213
- const filePath = resolve2(OptionHolder.projectDir, filename);
214
- const json = readJsonSlow(filePath);
215
- const versionName = json.expo?.version + "";
216
- const iosVersionCode = json.expo?.ios?.buildNumber + "";
217
- const androidVersionCode = json.expo?.android?.versionCode + "";
218
- if (!/\d+/.test(iosVersionCode)) {
219
- throwError("app.json expo.ios.buildNumber is not an integer");
220
- }
221
- if (!/\d+/.test(androidVersionCode)) {
222
- throwError("app.json expo.android.versionCode is not an integer");
223
- }
224
- if (iosVersionCode !== androidVersionCode) {
225
- throwError("app.json expo.ios.buildNumber is not equal with expo.android.versionCode");
226
- }
227
- if (!semver.valid(versionName)) {
228
- throwError("VERSION_NAME is not a valid semver format");
229
- }
230
- OptionHolder.versionName = versionName;
231
- OptionHolder.versionCode = iosVersionCode;
232
- }
233
- }
234
-
235
- // src/util/parseConfigFile.ts
236
- import { is } from "@mj-studio/js-util";
237
- async function parseConfigFile() {
238
- const candidates = [
239
- join2(OptionHolder.resourcesDir, "expo-release-it.config.json"),
240
- join2(OptionHolder.projectDir, "expo-release-it.config.json")
241
- ];
242
- if (OptionHolder.input.config) {
243
- candidates.unshift(OptionHolder.input.config);
244
- }
245
- const validConfigFilePath = candidates.find(
246
- (candidate) => exist(candidate) && is.object(readJsonSlow(candidate))
247
- );
248
- if (!validConfigFilePath) return;
249
- const config = readJsonSlow(validConfigFilePath);
250
- assignIfValueIsValidAndNotSetAlready(
251
- OptionHolder.input,
252
- "semverIncrement",
253
- config.bump?.increment
254
- );
255
- assignIfValueIsValidAndNotSetAlready(
256
- OptionHolder.input,
257
- "androidOutput",
258
- config.build?.androidBuildOutput ?? config.upload?.androidBuildOutput
259
- );
260
- assignIfValueIsValidAndNotSetAlready(OptionHolder.input, "pod", config.build?.iosPodInstall);
261
- assignIfValueIsValidAndNotSetAlready(
262
- OptionHolder.input,
263
- "uploadMetadata",
264
- config.upload?.uploadMetadata ?? config.submit?.uploadMetadata
265
- );
266
- assignIfValueIsValidAndNotSetAlready(
267
- OptionHolder.input,
268
- "uploadScreenshot",
269
- config.upload?.uploadScreenshot ?? config.submit?.uploadScreenshot
270
- );
271
- assignIfValueIsValidAndNotSetAlready(OptionHolder.input.git, "commit", config.bump?.git?.commit);
272
- assignIfValueIsValidAndNotSetAlready(
273
- OptionHolder.input.git,
274
- "commitMessage",
275
- config.bump?.git?.commitMessage
276
- );
277
- assignIfValueIsValidAndNotSetAlready(OptionHolder.input.git, "tag", config.bump?.git?.tag);
278
- assignIfValueIsValidAndNotSetAlready(
279
- OptionHolder.input.git,
280
- "tagName",
281
- config.bump?.git?.tagName
282
- );
283
- assignIfValueIsValidAndNotSetAlready(OptionHolder.input.git, "push", config.bump?.git?.push);
284
- }
285
- function assignIfValueIsValidAndNotSetAlready(object, key, value) {
286
- if (!object[key] && !(value === null || value === void 0)) {
287
- object[key] = value;
288
- }
289
- }
290
-
291
- // src/util/setup/setup.ts
292
- async function setup() {
293
- await setupBasicOptions();
294
- await parseConfigFile();
295
- await hydrateKeyholderFileValues();
296
- await parseBinaryVersions();
297
- }
298
- async function setupBasicOptions() {
299
- OptionHolder.projectDir = isDev ? resolve2("example") : resolve2(".");
300
- OptionHolder.resourcesDir = resolve2(OptionHolder.projectDir, "expo-release-it");
301
- OptionHolder.keyDir = resolve2(OptionHolder.resourcesDir, "key");
302
- OptionHolder.keyholderFilePath = resolve2(OptionHolder.resourcesDir, "keyholder.json");
303
- OptionHolder.tempDir = resolve2(OptionHolder.resourcesDir, ".temp");
304
- }
305
-
306
- // src/command/submit.ts
307
- import chalk5 from "chalk";
308
-
309
- // src/util/calculateElapsed.ts
310
- import { padZero as padZero2 } from "@mj-studio/js-util";
311
- function calculateElapsed(t) {
312
- let seconds = Math.floor((Date.now() - t) / 1e3);
313
- const minutes = Math.floor(seconds / 60);
314
- seconds = seconds % 60;
315
- return `${minutes}:${padZero2(seconds)}`;
316
- }
317
-
318
- // src/util/iterateAllFiles.ts
319
- async function iterateAllFiles(root, callback) {
320
- await go(root);
321
- async function go(dirPath) {
322
- const paths = readdir(dirPath).map((f) => join2(dirPath, f));
323
- for (const p of paths) {
324
- if (isFile(p)) {
325
- await callback(p);
326
- } else if (isDir(p)) {
327
- await go(p);
328
- }
329
- }
330
- }
331
- }
332
-
333
- // src/util/injectTemplatePlaceHolders.ts
334
- async function injectTemplatePlaceHolders(root) {
335
- await iterateAllFiles(root, async (filePath) => {
336
- let content = read(filePath);
337
- for (const [key, value] of Object.entries(OptionHolder.keyholderMap)) {
338
- content = content.replaceAll(`{{${key}}}`, value);
339
- }
340
- write(filePath, content);
341
- });
342
- }
343
-
344
- // src/util/spinner.ts
345
- import { oraPromise } from "ora";
346
- import chalk2 from "chalk";
347
- async function spinner(text, promise) {
348
- return oraPromise(promise, {
349
- text,
350
- successText: chalk2.green(`${text} - Done`),
351
- failText: chalk2.red(`${text} - Failed`)
352
- });
353
- }
354
-
355
- // src/util/setup/execShellScript.ts
356
- import { execa } from "execa";
357
- var exe = execa({
358
- stdin: "pipe",
359
- stdout: "inherit",
360
- stderr: "inherit",
361
- shell: false
362
- });
363
- var yesShell = (command, args = [], options) => {
364
- const subProcess = exe(command, args, { ...options, stdin: "pipe" });
365
- subProcess.stdin?.write("y\n");
366
- subProcess.stdin?.end();
367
- return subProcess;
368
- };
369
-
370
- // src/util/MetadataSyncUtil.ts
371
- import chalk3 from "chalk";
372
- function copyIosMetadata(to) {
373
- const iosDir = join2(OptionHolder.projectDir, "ios");
374
- const nativeDir = join2(iosDir, "fastlane");
375
- const metadataNativeDir = join2(nativeDir, "metadata");
376
- const screenshotsNativeDir = join2(nativeDir, "screenshots");
377
- const resourcesDir = join2(OptionHolder.resourcesDir, "metadata/ios");
378
- const metadataResourcesDir = join2(resourcesDir, "metadata");
379
- const screenshotsResourcesDir = join2(resourcesDir, "screenshots");
380
- if (to === "resources") {
381
- if (exist(metadataNativeDir) && exist(screenshotsNativeDir)) {
382
- copy(metadataNativeDir, metadataResourcesDir);
383
- copy(screenshotsNativeDir, screenshotsResourcesDir);
384
- logger.done(
385
- `iOS Metadata saved in ${chalk3.inverse(relativePath(OptionHolder.projectDir, resourcesDir))}. You can edit inside contents.`
386
- );
387
- } else {
388
- logger.warn(
389
- `iOS Metadata not found in ${chalk3.inverse(relativePath(OptionHolder.projectDir, nativeDir))}`
390
- );
391
- }
392
- } else {
393
- if (exist(metadataResourcesDir) && exist(screenshotsResourcesDir)) {
394
- copy(metadataResourcesDir, metadataNativeDir);
395
- copy(screenshotsResourcesDir, screenshotsNativeDir);
396
- logger.done(
397
- `iOS Metadata copyed to ${chalk3.inverse(relativePath(OptionHolder.projectDir, nativeDir))}`
398
- );
399
- } else {
400
- logger.warn(
401
- `iOS Metadata not found in ${chalk3.inverse(relativePath(OptionHolder.projectDir, resourcesDir))}`
402
- );
403
- }
404
- }
405
- }
406
- function copyAndroidMetadata(to) {
407
- const androidDir = join2(OptionHolder.projectDir, "android");
408
- const nativeDir = join2(androidDir, "fastlane/metadata/android");
409
- const resourcesDir = join2(OptionHolder.resourcesDir, "metadata/android");
410
- if (to === "resouces") {
411
- if (exist(nativeDir)) {
412
- copy(nativeDir, resourcesDir);
413
- logger.done(
414
- `Android Metadata saved in ${chalk3.inverse(relativePath(OptionHolder.projectDir, resourcesDir))}. You can edit inside contents.`
415
- );
416
- } else {
417
- logger.warn(
418
- `Android Metadata not found in ${chalk3.inverse(relativePath(OptionHolder.projectDir, nativeDir))}`
419
- );
420
- }
421
- } else {
422
- if (exist(resourcesDir)) {
423
- copy(resourcesDir, nativeDir);
424
- logger.done(
425
- `Android Metadata copyed to ${chalk3.inverse(relativePath(OptionHolder.projectDir, nativeDir))}`
426
- );
427
- } else {
428
- logger.warn(
429
- `Android Metadata not found in ${chalk3.inverse(relativePath(OptionHolder.projectDir, resourcesDir))}`
430
- );
431
- }
432
- }
433
- }
434
-
435
- // src/util/setup/prepareAndroid.ts
436
- async function prepareAndroid() {
437
- const srcDir = resolve2(OptionHolder.cli.templateDir, "android");
438
- const destDir = resolve2(OptionHolder.projectDir, "android");
439
- await yesShell("expo", ["prebuild", "-p", "android", "--no-install"], {
440
- cwd: OptionHolder.projectDir
441
- });
442
- logger.success("Expo Prebuild - Done");
443
- await spinner(
444
- "Inject Templates",
445
- iterateDir(srcDir, async (file) => {
446
- const filePath = resolve2(srcDir, file);
447
- remove(resolve2(destDir, file));
448
- copy(filePath, resolve2(destDir, file));
449
- })
450
- );
451
- await spinner("Overwrite Android Release Signing Config", replaceAndroidSigningConfig(destDir));
452
- await spinner(
453
- "Hydrate template placeholders",
454
- injectTemplatePlaceHolders(resolve2(destDir, "fastlane"))
455
- );
456
- await exe("bundle", ["install"], { cwd: destDir });
457
- logger.success("Bunder Install - Done");
458
- copyAndroidMetadata("native");
459
- }
460
- async function replaceAndroidSigningConfig(destDir) {
461
- const buildGradleDirPath = resolve2(destDir, "app");
462
- const buildGradlePath = resolve2(destDir, "app", "build.gradle");
463
- const {
464
- android_keystore_store_password,
465
- android_keystore_key_alias,
466
- android_keystore_key_password
467
- } = OptionHolder.keyholderMap;
468
- const content = read(buildGradlePath).replace(
469
- /signingConfigs.*?{.*?debug.*?{.*?}.*?}/s,
470
- `
471
- signingConfigs {
472
- debug {
473
- storeFile file('${relativePath(buildGradleDirPath, resolve2(OptionHolder.resourcesDir, "key", "android_release.keystore"))}')
474
- storePassword '${android_keystore_store_password}'
475
- keyAlias '${android_keystore_key_alias}'
476
- keyPassword '${android_keystore_key_password}'
477
- }
478
- }
479
- `
480
- );
481
- write(buildGradlePath, content);
482
- }
483
-
484
- // src/util/setup/prepareIos.ts
485
- async function prepareIos() {
486
- const srcDir = resolve2(OptionHolder.cli.templateDir, "ios");
487
- const destDir = resolve2(OptionHolder.projectDir, "ios");
488
- await yesShell("expo", ["prebuild", "-p", "ios", "--no-install"], {
489
- cwd: OptionHolder.projectDir
490
- });
491
- logger.success("Expo Prebuild - Done");
492
- await spinner(
493
- "Inject templates",
494
- iterateDir(srcDir, async (file) => {
495
- const filePath = resolve2(srcDir, file);
496
- remove(resolve2(destDir, file));
497
- copy(filePath, resolve2(destDir, file));
498
- })
499
- );
500
- await spinner(
501
- "Hydrate template placeholders",
502
- injectTemplatePlaceHolders(resolve2(destDir, "fastlane"))
503
- );
504
- await exe("bundle", ["install"], { cwd: destDir });
505
- logger.success("Bunder Install - Done");
506
- copyIosMetadata("native");
507
- }
508
-
509
- // src/util/input/InqueryInputs.ts
510
- import { select } from "@inquirer/prompts";
511
- import { is as is2 } from "@mj-studio/js-util";
512
- import chalk4 from "chalk";
513
- var InqueryInputs = {
514
- platform: async () => {
515
- if (!OptionHolder.input.platform) {
516
- OptionHolder.input.platform = await select({
517
- message: constructInquirerFormattedMessage({
518
- name: "Platform",
519
- explanation: `Platform to run action`
520
- }),
521
- choices: [
522
- { name: "ios", value: "ios", description: "Release ios" },
523
- { name: "android", value: "android", description: "Release android" }
524
- ]
525
- });
526
- }
527
- },
528
- podinstall: async () => {
529
- if (OptionHolder.input.platform === "ios") {
530
- OptionHolder.input.pod = await select({
531
- message: constructInquirerFormattedMessage({
532
- name: "Install CocoaPods?"
533
- }),
534
- choices: [
535
- { name: "yes", value: true, description: "Install pods before release" },
536
- { name: "no", value: false, description: "Skip pods install" }
537
- ]
538
- });
539
- }
540
- },
541
- androidBuildOutput: async () => {
542
- if (OptionHolder.input.platform === "android") {
543
- if (!OptionHolder.input.androidOutput) {
544
- OptionHolder.input.androidOutput = await select({
545
- message: constructInquirerFormattedMessage({
546
- name: "Android output artifact type"
547
- }),
548
- choices: [
549
- { name: "aab", value: "aab", description: "Build as App bundle" },
550
- { name: "apk", value: "apk", description: "Build as APK" }
551
- ]
552
- });
553
- }
554
- }
555
- },
556
- uploadMetadata: async () => {
557
- if (!is2.boolean(OptionHolder.input.uploadMetadata)) {
558
- OptionHolder.input.uploadMetadata = await select({
559
- message: constructInquirerFormattedMessage({
560
- name: "Upload Text Metadata(title, description, ...)"
561
- }),
562
- choices: [
563
- { name: "yes", value: true, description: "Upload" },
564
- { name: "no", value: false, description: "Don't Upload" }
565
- ]
566
- });
567
- }
568
- },
569
- uploadScreenshot: async () => {
570
- if (!is2.boolean(OptionHolder.input.uploadScreenshot)) {
571
- OptionHolder.input.uploadScreenshot = await select({
572
- message: constructInquirerFormattedMessage({
573
- name: "Upload Screenshots & Images"
574
- }),
575
- choices: [
576
- { name: "yes", value: true, description: "Upload" },
577
- { name: "no", value: false, description: "Don't Upload" }
578
- ]
579
- });
580
- }
581
- },
582
- useLiveVersionIos: async () => {
583
- if (!is2.boolean(OptionHolder.input.useLiveVersionIos) && OptionHolder.input.platform === "ios") {
584
- OptionHolder.input.useLiveVersionIos = await select({
585
- message: constructInquirerFormattedMessage({
586
- name: "Download metadatas from live version rather than draft"
587
- }),
588
- choices: [
589
- { name: "yes", value: true, description: "Download from live version" },
590
- { name: "no", value: false, description: "Download from draft" }
591
- ]
592
- });
593
- }
594
- }
595
- };
596
- function constructInquirerFormattedMessage({
597
- example,
598
- explanation,
599
- referUrl,
600
- name
601
- }) {
602
- let ret = `${chalk4.bold(name)}`;
603
- if (explanation) {
604
- ret += `
605
-
606
- ${chalk4.italic.blue(explanation)}`;
607
- }
608
- if (example) {
609
- ret += `
610
- ${chalk4.italic(`${chalk4.greenBright("example :")} ${example}`)}`;
611
- }
612
- if (referUrl) {
613
- ret += `
614
- ${chalk4.italic(`${chalk4.greenBright("references :")} ${chalk4.underline.blue(referUrl)}`)}`;
615
- }
616
- if (explanation) {
617
- ret += "\n";
618
- if (example || referUrl) {
619
- ret += "\n";
620
- }
621
- }
622
- return ret;
623
- }
624
-
625
- // src/util/FastlaneOption.ts
626
- function getAndroidFastlaneOptions() {
627
- return [
628
- ...Object.entries(OptionHolder.keyholderMap).map(([k, v]) => `${k}:${v}`),
629
- `json_key:${resolve2(OptionHolder.keyDir, "android_play_console_service_account.json")}`,
630
- `version_name:${OptionHolder.versionName}`,
631
- `version_code:${OptionHolder.versionCode}`,
632
- `upload_metadata:${OptionHolder.input.uploadMetadata}`,
633
- `upload_screenshot:${OptionHolder.input.uploadScreenshot}`,
634
- `aab_path:${resolve2(OptionHolder.resourcesDir, "output", "android", "aab", "app-release.aab")}`,
635
- `apk_path:${resolve2(OptionHolder.resourcesDir, "output", "android", "apk", "app-release.apk")}`,
636
- `skip_upload_apk:${OptionHolder.input.androidOutput !== "apk"}`,
637
- `skip_upload_aab:${OptionHolder.input.androidOutput !== "aab"}`
638
- ];
639
- }
640
- function getIosFastlaneOptions() {
641
- return [
642
- ...Object.entries(OptionHolder.keyholderMap).map(([k, v]) => `${k}:${v}`),
643
- `version_name:${OptionHolder.versionName}`,
644
- `version_code:${OptionHolder.versionCode}`,
645
- `api_key_filepath:${resolve2(OptionHolder.keyDir, "ios_app_store_connect_api_key.p8")}`,
646
- `upload_metadata:${OptionHolder.input.uploadMetadata}`,
647
- `upload_screenshot:${OptionHolder.input.uploadScreenshot}`,
648
- `ipa_path:${resolve2(OptionHolder.resourcesDir, "output", "ios", "app.ipa")}`,
649
- `ipa_dir:${resolve2(OptionHolder.resourcesDir, "output", "ios")}`,
650
- `ipa_name:app.ipa`
651
- ];
652
- }
653
-
654
- // src/command/submit.ts
655
- async function submit({ options }) {
656
- Object.assign(OptionHolder.input, options);
657
- const startTime = Date.now();
658
- await setup();
659
- await promptInputs();
660
- logger.info("Submit Started");
661
- if (OptionHolder.input.platform === "ios") {
662
- await submitIos();
663
- logger.success(`Appstore Review Submitted ${chalk5.bold.inverse(calculateElapsed(startTime))}`);
664
- } else {
665
- await submitAndroid();
666
- logger.success(`Playstore Review Submitted ${chalk5.bold.inverse(calculateElapsed(startTime))}`);
667
- }
668
- }
669
- async function promptInputs() {
670
- await InqueryInputs.platform();
671
- await InqueryInputs.uploadMetadata();
672
- await InqueryInputs.uploadScreenshot();
673
- }
674
- async function submitIos() {
675
- const iosDir = resolve2(OptionHolder.projectDir, "ios");
676
- await prepareIos();
677
- await fastlane();
678
- async function fastlane() {
679
- remove(resolve2(iosDir, ".xcode.env.local"));
680
- await exe("bundle", ["exec", "fastlane", "submit", ...getIosFastlaneOptions()], {
681
- cwd: iosDir,
682
- env: {
683
- MATCH_PASSWORD: OptionHolder.keyholderMap.ios_match_password
684
- }
685
- });
686
- }
687
- }
688
- async function submitAndroid() {
689
- await prepareAndroid();
690
- await fastlane();
691
- async function fastlane() {
692
- await exe("bundle", ["exec", "fastlane", "submit", ...getAndroidFastlaneOptions()], {
693
- cwd: resolve2(OptionHolder.projectDir, "android")
694
- });
695
- }
696
- }
697
- export {
698
- submit
699
- };
700
- //# sourceMappingURL=submit.js.map
1
+ import "../EnvUtil-DWWwkHaf.js";
2
+ import "../FileUtil-B9JnWobK.js";
3
+ import "../OptionHolder-H3HG0A95.js";
4
+ import "../FastlaneOption-B9A0ECDL.js";
5
+ import "../calculateElapsed-CynU9UU_.js";
6
+ import "../InqueryInputs-BGj-DlRa.js";
7
+ import "../logger-DvQ7ScMQ.js";
8
+ import "../execShellScript-Bd5xbFX5.js";
9
+ import "../MetadataSyncUtil-j79hX3QT.js";
10
+ import "../iterateAllFiles-CbEPek2B.js";
11
+ import "../injectTemplatePlaceHolders-CpIvd0dG.js";
12
+ import "../replaceStringIfNotContain-CgZ460_D.js";
13
+ import "../spinner-BVmbE9I_.js";
14
+ import "../prepareAndroid-Cjz6r6o0.js";
15
+ import "../prepareIos-ByPLFHC8.js";
16
+ import "../parseConfigFile-hMLUnLZR.js";
17
+ import "../throwError-DMF6E5pu.js";
18
+ import "../VersionUtil-BDB10Hpb.js";
19
+ import "../hydrateKeyholderFileValues-BoaRs3SC.js";
20
+ import "../setup-CRNjdK5q.js";
21
+ import { submit } from "../submit-5gTyWBU2.js";
22
+
23
+ export { submit };