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,711 +1,23 @@
1
- // src/util/FileUtil.ts
2
- import fs from "fs-extra";
3
- import * as path from "path";
4
- var join2 = path.join;
5
- var resolve2 = path.resolve;
6
- function exist(path2) {
7
- return fs.existsSync(path2);
8
- }
9
- function isDir(path2) {
10
- return exist(path2) && fs.lstatSync(path2).isDirectory();
11
- }
12
- function relativePath(from, to) {
13
- return path.relative(from, to);
14
- }
15
- function isFile(path2) {
16
- return exist(path2) && fs.lstatSync(path2).isFile();
17
- }
18
- function read(path2) {
19
- return fs.readFileSync(path2, { encoding: "utf8" });
20
- }
21
- function readdir(path2) {
22
- return fs.readdirSync(path2);
23
- }
24
- function readJsonSlow(path2) {
25
- return fs.readJSONSync(path2);
26
- }
27
- function write(p, content) {
28
- const dir = path.dirname(p);
29
- if (!exist(dir)) {
30
- fs.mkdirSync(dir, { recursive: true });
31
- }
32
- return fs.writeFileSync(p, content);
33
- }
34
- function copy(src, dest, options) {
35
- fs.copySync(src, dest, options);
36
- }
37
- function remove(path2) {
38
- if (!exist(path2)) {
39
- return;
40
- }
41
- if (fs.lstatSync(path2).isDirectory()) {
42
- return fs.rmSync(path2, { force: true, recursive: true });
43
- } else {
44
- return fs.rmSync(path2, { force: true });
45
- }
46
- }
47
- async function iterateDir(path2, fn) {
48
- if (!isDir(path2)) {
49
- return;
50
- }
51
- for (const file of fs.readdirSync(path2)) {
52
- await fn(file);
53
- }
54
- }
55
-
56
- // package.json
57
- var package_default = {
58
- name: "expo-release-it",
59
- module: "src/index.ts",
60
- type: "module",
61
- version: "0.5.3",
62
- license: "MIT",
63
- homepage: "https://expo-release-it.mjstudio.net/",
64
- repository: "https://github.com/mym0404/expo-release-it",
65
- scripts: {
66
- build: "pnpm build:json-schema-type && tsup",
67
- "build:json-schema-type": "json2ts --input expo-release-it.schema.json --output src/type/ExpoReleaseItConfiguration.d.ts",
68
- dev: "pnpm build && NODE_ENV=development node bin/expo-release-it.mjs",
69
- release: "pnpm build && pnpm run t && release-it && pnpm publish",
70
- t: "lefthook run check"
71
- },
72
- dependencies: {
73
- "@inquirer/prompts": "^7.4.1",
74
- "@mj-studio/js-util": "^1.1.20",
75
- chalk: "^5.4.1",
76
- commander: "^13.1.0",
77
- execa: "^9.5.2",
78
- "fs-extra": "^11.3.0",
79
- ora: "^8.2.0",
80
- react: "catalog:native",
81
- "react-native": "catalog:native",
82
- semver: "^7.7.1",
83
- url: "^0.11.4"
84
- },
85
- devDependencies: {
86
- "@commitlint/config-conventional": "^19.8.0",
87
- "@release-it/conventional-changelog": "^10.0.1",
88
- "@types/fs-extra": "^11.0.4",
89
- "@types/semver": "^7.7.0",
90
- "json-schema-to-typescript": "^15.0.4",
91
- lefthook: "^1.11.11",
92
- prettier: "catalog:",
93
- "release-it": "^19.0.1",
94
- "tiny-glob": "^0.2.9",
95
- tsup: "^8.4.0",
96
- typescript: "catalog:",
97
- vitest: "^3.1.2"
98
- },
99
- bin: "./bin/expo-release-it.mjs",
100
- files: [
101
- "build",
102
- "package.json",
103
- "bin",
104
- "template",
105
- "expo-release-it.schema.json"
106
- ],
107
- commitlint: {
108
- extends: [
109
- "@commitlint/config-conventional"
110
- ]
111
- },
112
- packageManager: "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
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/iterateAllFiles.ts
138
- async function iterateAllFiles(root, callback) {
139
- await go(root);
140
- async function go(dirPath) {
141
- const paths = readdir(dirPath).map((f) => join2(dirPath, f));
142
- for (const p of paths) {
143
- if (isFile(p)) {
144
- await callback(p);
145
- } else if (isDir(p)) {
146
- await go(p);
147
- }
148
- }
149
- }
150
- }
151
-
152
- // src/util/injectTemplatePlaceHolders.ts
153
- async function injectTemplatePlaceHolders(root) {
154
- await iterateAllFiles(root, async (filePath) => {
155
- let content = read(filePath);
156
- for (const [key, value] of Object.entries(OptionHolder.keyholderMap)) {
157
- content = content.replaceAll(`{{${key}}}`, value);
158
- }
159
- write(filePath, content);
160
- });
161
- }
162
-
163
- // src/util/spinner.ts
164
- import { oraPromise } from "ora";
165
- import chalk from "chalk";
166
- async function spinner(text, promise) {
167
- return oraPromise(promise, {
168
- text,
169
- successText: chalk.green(`${text} - Done`),
170
- failText: chalk.red(`${text} - Failed`)
171
- });
172
- }
173
-
174
- // src/util/setup/execShellScript.ts
175
- import { execa } from "execa";
176
- var exe = execa({
177
- stdin: "pipe",
178
- stdout: "inherit",
179
- stderr: "inherit",
180
- shell: false
181
- });
182
- var yesShell = (command, args = [], options) => {
183
- const subProcess = exe(command, args, { ...options, stdin: "pipe" });
184
- subProcess.stdin?.write("y\n");
185
- subProcess.stdin?.end();
186
- return subProcess;
187
- };
188
-
189
- // src/util/logger.ts
190
- import chalk2 from "chalk";
191
- var logger = {
192
- success: (...msg) => console.log(chalk2.green(`\u2714 ${msg.join(", ")}`)),
193
- done: (...msg) => console.log(chalk2.green(`\u2714 ${msg.join(", ")} - Done`)),
194
- error: (...msg) => console.log(chalk2.red(`\u2716 ${msg.join(", ")}`)),
195
- warn: (...msg) => console.log(chalk2.yellow(`\u26A0 ${msg.join(", ")}`)),
196
- info: (...msg) => console.log(chalk2.cyan(`\u2139 ${msg.join(", ")}`)),
197
- title: (...msg) => console.log(chalk2.bold.blue(`
198
- ${msg.join(", ")}`)),
199
- dim: (...msg) => console.log(chalk2.dim(msg.join(", ")))
200
- };
201
-
202
- // src/util/MetadataSyncUtil.ts
203
- import chalk3 from "chalk";
204
- function copyIosMetadata(to) {
205
- const iosDir = join2(OptionHolder.projectDir, "ios");
206
- const nativeDir = join2(iosDir, "fastlane");
207
- const metadataNativeDir = join2(nativeDir, "metadata");
208
- const screenshotsNativeDir = join2(nativeDir, "screenshots");
209
- const resourcesDir = join2(OptionHolder.resourcesDir, "metadata/ios");
210
- const metadataResourcesDir = join2(resourcesDir, "metadata");
211
- const screenshotsResourcesDir = join2(resourcesDir, "screenshots");
212
- if (to === "resources") {
213
- if (exist(metadataNativeDir) && exist(screenshotsNativeDir)) {
214
- copy(metadataNativeDir, metadataResourcesDir);
215
- copy(screenshotsNativeDir, screenshotsResourcesDir);
216
- logger.done(
217
- `iOS Metadata saved in ${chalk3.inverse(relativePath(OptionHolder.projectDir, resourcesDir))}. You can edit inside contents.`
218
- );
219
- } else {
220
- logger.warn(
221
- `iOS Metadata not found in ${chalk3.inverse(relativePath(OptionHolder.projectDir, nativeDir))}`
222
- );
223
- }
224
- } else {
225
- if (exist(metadataResourcesDir) && exist(screenshotsResourcesDir)) {
226
- copy(metadataResourcesDir, metadataNativeDir);
227
- copy(screenshotsResourcesDir, screenshotsNativeDir);
228
- logger.done(
229
- `iOS Metadata copyed to ${chalk3.inverse(relativePath(OptionHolder.projectDir, nativeDir))}`
230
- );
231
- } else {
232
- logger.warn(
233
- `iOS Metadata not found in ${chalk3.inverse(relativePath(OptionHolder.projectDir, resourcesDir))}`
234
- );
235
- }
236
- }
237
- }
238
- function copyAndroidMetadata(to) {
239
- const androidDir = join2(OptionHolder.projectDir, "android");
240
- const nativeDir = join2(androidDir, "fastlane/metadata/android");
241
- const resourcesDir = join2(OptionHolder.resourcesDir, "metadata/android");
242
- if (to === "resouces") {
243
- if (exist(nativeDir)) {
244
- copy(nativeDir, resourcesDir);
245
- logger.done(
246
- `Android Metadata saved in ${chalk3.inverse(relativePath(OptionHolder.projectDir, resourcesDir))}. You can edit inside contents.`
247
- );
248
- } else {
249
- logger.warn(
250
- `Android Metadata not found in ${chalk3.inverse(relativePath(OptionHolder.projectDir, nativeDir))}`
251
- );
252
- }
253
- } else {
254
- if (exist(resourcesDir)) {
255
- copy(resourcesDir, nativeDir);
256
- logger.done(
257
- `Android Metadata copyed to ${chalk3.inverse(relativePath(OptionHolder.projectDir, nativeDir))}`
258
- );
259
- } else {
260
- logger.warn(
261
- `Android Metadata not found in ${chalk3.inverse(relativePath(OptionHolder.projectDir, resourcesDir))}`
262
- );
263
- }
264
- }
265
- }
266
-
267
- // src/util/setup/prepareAndroid.ts
268
- async function prepareAndroid() {
269
- const srcDir = resolve2(OptionHolder.cli.templateDir, "android");
270
- const destDir = resolve2(OptionHolder.projectDir, "android");
271
- await yesShell("expo", ["prebuild", "-p", "android", "--no-install"], {
272
- cwd: OptionHolder.projectDir
273
- });
274
- logger.success("Expo Prebuild - Done");
275
- await spinner(
276
- "Inject Templates",
277
- iterateDir(srcDir, async (file) => {
278
- const filePath = resolve2(srcDir, file);
279
- remove(resolve2(destDir, file));
280
- copy(filePath, resolve2(destDir, file));
281
- })
282
- );
283
- await spinner("Overwrite Android Release Signing Config", replaceAndroidSigningConfig(destDir));
284
- await spinner(
285
- "Hydrate template placeholders",
286
- injectTemplatePlaceHolders(resolve2(destDir, "fastlane"))
287
- );
288
- await exe("bundle", ["install"], { cwd: destDir });
289
- logger.success("Bunder Install - Done");
290
- copyAndroidMetadata("native");
291
- }
292
- async function replaceAndroidSigningConfig(destDir) {
293
- const buildGradleDirPath = resolve2(destDir, "app");
294
- const buildGradlePath = resolve2(destDir, "app", "build.gradle");
295
- const {
296
- android_keystore_store_password,
297
- android_keystore_key_alias,
298
- android_keystore_key_password
299
- } = OptionHolder.keyholderMap;
300
- const content = read(buildGradlePath).replace(
301
- /signingConfigs.*?{.*?debug.*?{.*?}.*?}/s,
302
- `
303
- signingConfigs {
304
- debug {
305
- storeFile file('${relativePath(buildGradleDirPath, resolve2(OptionHolder.resourcesDir, "key", "android_release.keystore"))}')
306
- storePassword '${android_keystore_store_password}'
307
- keyAlias '${android_keystore_key_alias}'
308
- keyPassword '${android_keystore_key_password}'
309
- }
310
- }
311
- `
312
- );
313
- write(buildGradlePath, content);
314
- }
315
-
316
- // src/util/setup/hydrateKeyholderFileValues.ts
317
- async function hydrateKeyholderFileValues() {
318
- if (exist(OptionHolder.keyholderFilePath)) {
319
- Object.assign(OptionHolder.keyholderMap, readJsonSlow(OptionHolder.keyholderFilePath));
320
- }
321
- }
322
-
323
- // src/util/EnvUtil.ts
324
- var isDev = process.env.NODE_ENV === "development";
325
- var isWin = process.platform.startsWith("win");
326
- var isTest = process.env.NODE_ENV === "test";
327
-
328
- // src/util/throwError.ts
329
- function throwError(message, e) {
330
- if (e) {
331
- logger.error(message, e);
332
- } else {
333
- logger.error(message);
334
- }
335
- if (isTest) {
336
- throw new Error("throwError");
337
- }
338
- process.exit(1);
339
- }
340
-
341
- // src/util/setup/VersionUtil.ts
342
- import semver from "semver";
343
- import { padZero } from "@mj-studio/js-util";
344
- var versionNameRegex = () => /const\s+VERSION_NAME\s*?=\s*?['"]([\d\.]*?)['"]\s*?;?/;
345
- var versionCodeRegex = () => /const\s+VERSION_CODE\s*?=\s*?(\d+)\s*?;?/;
346
- async function parseBinaryVersions() {
347
- const files = readdir(OptionHolder.projectDir);
348
- const jsConfigFiles = ["app.config.ts", "app.config.js", "app.config.cjs", "app.config.mjs"];
349
- const jsonConfigFile = "app.json";
350
- for (const jsConfigFile of jsConfigFiles) {
351
- if (files.includes(jsConfigFile)) {
352
- await parseFromJsConfigFile(jsConfigFile);
353
- return;
354
- }
355
- }
356
- if (files.includes(jsonConfigFile)) {
357
- await parseFromJsonConfigFile(jsonConfigFile);
358
- return;
359
- }
360
- throwError("expo config file not found");
361
- async function parseFromJsConfigFile(filename) {
362
- const filePath = resolve2(OptionHolder.projectDir, filename);
363
- const content = read(filePath);
364
- const VERSION_NAME = versionNameRegex().exec(content)?.[1];
365
- const VERSION_CODE = versionCodeRegex().exec(content)?.[1];
366
- if (!VERSION_NAME) {
367
- throwError("cannot parse version name");
368
- }
369
- if (!VERSION_CODE) {
370
- throwError("cannot parse version code");
371
- }
372
- if (!semver.valid(VERSION_NAME)) {
373
- throwError("VERSION_NAME is not a valid semver format");
374
- }
375
- OptionHolder.versionName = VERSION_NAME;
376
- OptionHolder.versionCode = VERSION_CODE;
377
- }
378
- async function parseFromJsonConfigFile(filename) {
379
- const filePath = resolve2(OptionHolder.projectDir, filename);
380
- const json = readJsonSlow(filePath);
381
- const versionName = json.expo?.version + "";
382
- const iosVersionCode = json.expo?.ios?.buildNumber + "";
383
- const androidVersionCode = json.expo?.android?.versionCode + "";
384
- if (!/\d+/.test(iosVersionCode)) {
385
- throwError("app.json expo.ios.buildNumber is not an integer");
386
- }
387
- if (!/\d+/.test(androidVersionCode)) {
388
- throwError("app.json expo.android.versionCode is not an integer");
389
- }
390
- if (iosVersionCode !== androidVersionCode) {
391
- throwError("app.json expo.ios.buildNumber is not equal with expo.android.versionCode");
392
- }
393
- if (!semver.valid(versionName)) {
394
- throwError("VERSION_NAME is not a valid semver format");
395
- }
396
- OptionHolder.versionName = versionName;
397
- OptionHolder.versionCode = iosVersionCode;
398
- }
399
- }
400
-
401
- // src/util/parseConfigFile.ts
402
- import { is } from "@mj-studio/js-util";
403
- async function parseConfigFile() {
404
- const candidates = [
405
- join2(OptionHolder.resourcesDir, "expo-release-it.config.json"),
406
- join2(OptionHolder.projectDir, "expo-release-it.config.json")
407
- ];
408
- if (OptionHolder.input.config) {
409
- candidates.unshift(OptionHolder.input.config);
410
- }
411
- const validConfigFilePath = candidates.find(
412
- (candidate) => exist(candidate) && is.object(readJsonSlow(candidate))
413
- );
414
- if (!validConfigFilePath) return;
415
- const config = readJsonSlow(validConfigFilePath);
416
- assignIfValueIsValidAndNotSetAlready(
417
- OptionHolder.input,
418
- "semverIncrement",
419
- config.bump?.increment
420
- );
421
- assignIfValueIsValidAndNotSetAlready(
422
- OptionHolder.input,
423
- "androidOutput",
424
- config.build?.androidBuildOutput ?? config.upload?.androidBuildOutput
425
- );
426
- assignIfValueIsValidAndNotSetAlready(OptionHolder.input, "pod", config.build?.iosPodInstall);
427
- assignIfValueIsValidAndNotSetAlready(
428
- OptionHolder.input,
429
- "uploadMetadata",
430
- config.upload?.uploadMetadata ?? config.submit?.uploadMetadata
431
- );
432
- assignIfValueIsValidAndNotSetAlready(
433
- OptionHolder.input,
434
- "uploadScreenshot",
435
- config.upload?.uploadScreenshot ?? config.submit?.uploadScreenshot
436
- );
437
- assignIfValueIsValidAndNotSetAlready(OptionHolder.input.git, "commit", config.bump?.git?.commit);
438
- assignIfValueIsValidAndNotSetAlready(
439
- OptionHolder.input.git,
440
- "commitMessage",
441
- config.bump?.git?.commitMessage
442
- );
443
- assignIfValueIsValidAndNotSetAlready(OptionHolder.input.git, "tag", config.bump?.git?.tag);
444
- assignIfValueIsValidAndNotSetAlready(
445
- OptionHolder.input.git,
446
- "tagName",
447
- config.bump?.git?.tagName
448
- );
449
- assignIfValueIsValidAndNotSetAlready(OptionHolder.input.git, "push", config.bump?.git?.push);
450
- }
451
- function assignIfValueIsValidAndNotSetAlready(object, key, value) {
452
- if (!object[key] && !(value === null || value === void 0)) {
453
- object[key] = value;
454
- }
455
- }
456
-
457
- // src/util/setup/setup.ts
458
- async function setup() {
459
- await setupBasicOptions();
460
- await parseConfigFile();
461
- await hydrateKeyholderFileValues();
462
- await parseBinaryVersions();
463
- }
464
- async function setupBasicOptions() {
465
- OptionHolder.projectDir = isDev ? resolve2("example") : resolve2(".");
466
- OptionHolder.resourcesDir = resolve2(OptionHolder.projectDir, "expo-release-it");
467
- OptionHolder.keyDir = resolve2(OptionHolder.resourcesDir, "key");
468
- OptionHolder.keyholderFilePath = resolve2(OptionHolder.resourcesDir, "keyholder.json");
469
- OptionHolder.tempDir = resolve2(OptionHolder.resourcesDir, ".temp");
470
- }
471
-
472
- // src/util/setup/prepareIos.ts
473
- async function prepareIos() {
474
- const srcDir = resolve2(OptionHolder.cli.templateDir, "ios");
475
- const destDir = resolve2(OptionHolder.projectDir, "ios");
476
- await yesShell("expo", ["prebuild", "-p", "ios", "--no-install"], {
477
- cwd: OptionHolder.projectDir
478
- });
479
- logger.success("Expo Prebuild - Done");
480
- await spinner(
481
- "Inject templates",
482
- iterateDir(srcDir, async (file) => {
483
- const filePath = resolve2(srcDir, file);
484
- remove(resolve2(destDir, file));
485
- copy(filePath, resolve2(destDir, file));
486
- })
487
- );
488
- await spinner(
489
- "Hydrate template placeholders",
490
- injectTemplatePlaceHolders(resolve2(destDir, "fastlane"))
491
- );
492
- await exe("bundle", ["install"], { cwd: destDir });
493
- logger.success("Bunder Install - Done");
494
- copyIosMetadata("native");
495
- }
496
-
497
- // src/command/build.ts
498
- import chalk5 from "chalk";
499
-
500
- // src/util/calculateElapsed.ts
501
- import { padZero as padZero2 } from "@mj-studio/js-util";
502
- function calculateElapsed(t) {
503
- let seconds = Math.floor((Date.now() - t) / 1e3);
504
- const minutes = Math.floor(seconds / 60);
505
- seconds = seconds % 60;
506
- return `${minutes}:${padZero2(seconds)}`;
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 getIosFastlaneOptions() {
627
- return [
628
- ...Object.entries(OptionHolder.keyholderMap).map(([k, v]) => `${k}:${v}`),
629
- `version_name:${OptionHolder.versionName}`,
630
- `version_code:${OptionHolder.versionCode}`,
631
- `api_key_filepath:${resolve2(OptionHolder.keyDir, "ios_app_store_connect_api_key.p8")}`,
632
- `upload_metadata:${OptionHolder.input.uploadMetadata}`,
633
- `upload_screenshot:${OptionHolder.input.uploadScreenshot}`,
634
- `ipa_path:${resolve2(OptionHolder.resourcesDir, "output", "ios", "app.ipa")}`,
635
- `ipa_dir:${resolve2(OptionHolder.resourcesDir, "output", "ios")}`,
636
- `ipa_name:app.ipa`
637
- ];
638
- }
639
-
640
- // src/command/build.ts
641
- async function build({ options }) {
642
- Object.assign(OptionHolder.input, options);
643
- const startTime = Date.now();
644
- await setup();
645
- await promptInputs();
646
- logger.info("Build Started");
647
- if (OptionHolder.input.platform === "ios") {
648
- await buildIos();
649
- logger.success(`iOS Build ${chalk5.bold.inverse(calculateElapsed(startTime))}`);
650
- } else {
651
- await buildAndroid();
652
- logger.success(`Android Build ${chalk5.bold.inverse(calculateElapsed(startTime))}`);
653
- }
654
- }
655
- async function promptInputs() {
656
- await InqueryInputs.platform();
657
- await InqueryInputs.podinstall();
658
- await InqueryInputs.androidBuildOutput();
659
- }
660
- async function buildIos() {
661
- const iosDir = resolve2(OptionHolder.projectDir, "ios");
662
- const exeEnv = exe({
663
- cwd: iosDir,
664
- env: {
665
- MATCH_PASSWORD: OptionHolder.keyholderMap.ios_match_password
666
- }
667
- });
668
- await prepareIos();
669
- await fastlane();
670
- async function fastlane() {
671
- if (OptionHolder.input.pod) {
672
- await exeEnv("bundle", ["exec", "pod", "install"]);
673
- logger.done("Pod Install");
674
- }
675
- remove(resolve2(iosDir, ".xcode.env.local"));
676
- await exeEnv("bundle", ["exec", "fastlane", "build", ...getIosFastlaneOptions()]);
677
- logger.success(
678
- `artifact generated: ${relativePath(OptionHolder.projectDir, resolve2(OptionHolder.resourcesDir, "output", "ios", "app.ipa"))}`
679
- );
680
- }
681
- }
682
- async function buildAndroid() {
683
- const androidDir = resolve2(OptionHolder.projectDir, "android");
684
- const exeEnv = exe({
685
- cwd: androidDir
686
- });
687
- await prepareAndroid();
688
- await fastlane();
689
- async function fastlane() {
690
- let buildOutputDir;
691
- let outputDir;
692
- if (OptionHolder.input.androidOutput === "aab") {
693
- await exeEnv(isWin ? "gradle.bat" : "./gradlew", ["app:bundleRelease"]);
694
- logger.done("Bundle AAB");
695
- buildOutputDir = resolve2(androidDir, "app", "build", "outputs", "bundle", "release");
696
- outputDir = resolve2(OptionHolder.resourcesDir, "output", "android", "aab");
697
- } else {
698
- await exeEnv(isWin ? "gradle.bat" : "./gradlew", ["app:assembleRelease"]);
699
- logger.done("Assemble APK");
700
- buildOutputDir = resolve2(androidDir, "app", "build", "outputs", "apk", "release");
701
- outputDir = resolve2(OptionHolder.resourcesDir, "output", "android", "apk");
702
- }
703
- remove(outputDir);
704
- copy(buildOutputDir, outputDir);
705
- logger.success(`artifact generated: ${relativePath(OptionHolder.projectDir, outputDir)}`);
706
- }
707
- }
708
- export {
709
- build
710
- };
711
- //# sourceMappingURL=build.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 { build } from "../build-DLOdnj2j.js";
22
+
23
+ export { build };