expo-release-it 0.6.1 → 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,5 +1,9 @@
1
- declare function bump({ options }: {
2
- options: any;
1
+ //#region src/command/bump.d.ts
2
+ declare function bump({
3
+ options
4
+ }: {
5
+ options: any;
3
6
  }): Promise<void>;
4
-
7
+ //#endregion
5
8
  export { bump };
9
+ //# sourceMappingURL=bump.d.ts.map
@@ -1,486 +1,14 @@
1
- // package.json
2
- var package_default = {
3
- name: "expo-release-it",
4
- module: "src/index.ts",
5
- type: "module",
6
- version: "0.6.0",
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 read(path2) {
69
- return fs.readFileSync(path2, { encoding: "utf8" });
70
- }
71
- function readdir(path2) {
72
- return fs.readdirSync(path2);
73
- }
74
- function readJsonSlow(path2) {
75
- return fs.readJSONSync(path2);
76
- }
77
- function write(p, content) {
78
- const dir = path.dirname(p);
79
- if (!exist(dir)) {
80
- fs.mkdirSync(dir, { recursive: true });
81
- }
82
- return fs.writeFileSync(p, content);
83
- }
84
- function writeJson(path2, json) {
85
- return write(path2, JSON.stringify(json, null, 2));
86
- }
87
-
88
- // src/util/OptionHolder.ts
89
- import { fileURLToPath } from "url";
90
- var OptionHolder = {
91
- cli: {
92
- version: package_default.version,
93
- rootDir: resolve2(fileURLToPath(import.meta.url), "../.."),
94
- templateDir: resolve2(fileURLToPath(import.meta.url), "../../template")
95
- },
96
- input: {
97
- git: {}
98
- },
99
- keyholderMap: {},
100
- templateDirNames: ["key"],
101
- projectDir: "",
102
- resourcesDir: "",
103
- keyDir: "",
104
- keyholderFilePath: "",
105
- versionName: "",
106
- versionCode: "",
107
- tempDir: ""
108
- };
109
-
110
- // src/util/logger.ts
111
- import chalk from "chalk";
112
- var logger = {
113
- success: (...msg) => console.log(chalk.green(`\u2714 ${msg.join(", ")}`)),
114
- done: (...msg) => console.log(chalk.green(`\u2714 ${msg.join(", ")} - Done`)),
115
- error: (...msg) => console.log(chalk.red(`\u2716 ${msg.join(", ")}`)),
116
- warn: (...msg) => console.log(chalk.yellow(`\u26A0 ${msg.join(", ")}`)),
117
- info: (...msg) => console.log(chalk.cyan(`\u2139 ${msg.join(", ")}`)),
118
- title: (...msg) => console.log(chalk.bold.blue(`
119
- ${msg.join(", ")}`)),
120
- dim: (...msg) => console.log(chalk.dim(msg.join(", ")))
121
- };
122
-
123
- // src/util/EnvUtil.ts
124
- var isDev = process.env.NODE_ENV === "development";
125
- var isWin = process.platform.startsWith("win");
126
- var isTest = process.env.NODE_ENV === "test";
127
-
128
- // src/util/throwError.ts
129
- function throwError(message, e) {
130
- if (e) {
131
- logger.error(message, e);
132
- } else {
133
- logger.error(message);
134
- }
135
- if (isTest) {
136
- throw new Error("throwError");
137
- }
138
- process.exit(1);
139
- }
140
-
141
- // src/util/setup/VersionUtil.ts
142
- import semver from "semver";
143
- import { padZero } from "@mj-studio/js-util";
144
- var versionNameRegex = () => /const\s+VERSION_NAME\s*?=\s*?['"]([\d\.]*?)['"]\s*?;?/;
145
- var versionCodeRegex = () => /const\s+VERSION_CODE\s*?=\s*?(\d+)\s*?;?/;
146
- async function parseBinaryVersions() {
147
- const files = readdir(OptionHolder.projectDir);
148
- const jsConfigFiles = ["app.config.ts", "app.config.js", "app.config.cjs", "app.config.mjs"];
149
- const jsonConfigFile = "app.json";
150
- for (const jsConfigFile of jsConfigFiles) {
151
- if (files.includes(jsConfigFile)) {
152
- await parseFromJsConfigFile(jsConfigFile);
153
- return;
154
- }
155
- }
156
- if (files.includes(jsonConfigFile)) {
157
- await parseFromJsonConfigFile(jsonConfigFile);
158
- return;
159
- }
160
- throwError("expo config file not found");
161
- async function parseFromJsConfigFile(filename) {
162
- const filePath = resolve2(OptionHolder.projectDir, filename);
163
- const content = read(filePath);
164
- const VERSION_NAME = versionNameRegex().exec(content)?.[1];
165
- const VERSION_CODE = versionCodeRegex().exec(content)?.[1];
166
- if (!VERSION_NAME) {
167
- throwError("cannot parse version name");
168
- }
169
- if (!VERSION_CODE) {
170
- throwError("cannot parse version code");
171
- }
172
- if (!semver.valid(VERSION_NAME)) {
173
- throwError("VERSION_NAME is not a valid semver format");
174
- }
175
- OptionHolder.versionName = VERSION_NAME;
176
- OptionHolder.versionCode = VERSION_CODE;
177
- }
178
- async function parseFromJsonConfigFile(filename) {
179
- const filePath = resolve2(OptionHolder.projectDir, filename);
180
- const json = readJsonSlow(filePath);
181
- const versionName = json.expo?.version + "";
182
- const iosVersionCode = json.expo?.ios?.buildNumber + "";
183
- const androidVersionCode = json.expo?.android?.versionCode + "";
184
- if (!/\d+/.test(iosVersionCode)) {
185
- throwError("app.json expo.ios.buildNumber is not an integer");
186
- }
187
- if (!/\d+/.test(androidVersionCode)) {
188
- throwError("app.json expo.android.versionCode is not an integer");
189
- }
190
- if (iosVersionCode !== androidVersionCode) {
191
- throwError("app.json expo.ios.buildNumber is not equal with expo.android.versionCode");
192
- }
193
- if (!semver.valid(versionName)) {
194
- throwError("VERSION_NAME is not a valid semver format");
195
- }
196
- OptionHolder.versionName = versionName;
197
- OptionHolder.versionCode = iosVersionCode;
198
- }
199
- }
200
- async function injectBinaryVersions({
201
- versionCode,
202
- versionName
203
- }) {
204
- const files = readdir(OptionHolder.projectDir);
205
- const jsConfigFiles = ["app.config.ts", "app.config.js", "app.config.cjs", "app.config.mjs"];
206
- const jsonConfigFile = "app.json";
207
- for (const jsConfigFile of jsConfigFiles) {
208
- if (files.includes(jsConfigFile)) {
209
- await injectToJsConfigFile(jsConfigFile);
210
- return;
211
- }
212
- }
213
- if (files.includes(jsonConfigFile)) {
214
- await injectToJsonConfigFile(jsonConfigFile);
215
- return;
216
- }
217
- throwError("expo config file not found");
218
- async function injectToJsConfigFile(filename) {
219
- const filePath = resolve2(OptionHolder.projectDir, filename);
220
- let content = read(filePath);
221
- content = content.replace(versionNameRegex(), `const VERSION_NAME = '${versionName}';`);
222
- content = content.replace(versionCodeRegex(), `const VERSION_CODE = ${versionCode};`);
223
- write(filePath, content);
224
- }
225
- async function injectToJsonConfigFile(filename) {
226
- const filePath = resolve2(OptionHolder.projectDir, filename);
227
- const json = readJsonSlow(filePath);
228
- json.expo.version = versionName;
229
- json.expo.ios.buildNumber = versionCode;
230
- json.expo.android.versionCode = +versionCode;
231
- writeJson(filePath, json);
232
- }
233
- }
234
- function checkVersionCodeIsTiedWithVersionName(versionName, versionCode) {
235
- if (!semver.valid(versionName)) return false;
236
- return generateVersionCodeTiedWithVersionName(versionName) === versionCode;
237
- }
238
- function generateVersionCodeTiedWithVersionName(versionName) {
239
- if (!semver.valid(versionName))
240
- throwError(
241
- "Version Name is not a valid semver format when running `generateVersionCodeTiedWithVersionName`"
242
- );
243
- const major = semver.major(versionName);
244
- const minor = semver.minor(versionName);
245
- const patch = semver.patch(versionName);
246
- return `${major}${padZero(minor, 3)}${padZero(patch, 3)}`;
247
- }
248
-
249
- // src/command/bump.ts
250
- import semver2 from "semver";
251
-
252
- // src/util/setup/hydrateKeyholderFileValues.ts
253
- async function hydrateKeyholderFileValues() {
254
- if (exist(OptionHolder.keyholderFilePath)) {
255
- Object.assign(OptionHolder.keyholderMap, readJsonSlow(OptionHolder.keyholderFilePath));
256
- }
257
- }
258
-
259
- // src/util/parseConfigFile.ts
260
- import { is } from "@mj-studio/js-util";
261
- async function parseConfigFile() {
262
- const candidates = [
263
- join2(OptionHolder.resourcesDir, "expo-release-it.config.json"),
264
- join2(OptionHolder.projectDir, "expo-release-it.config.json")
265
- ];
266
- if (OptionHolder.input.config) {
267
- candidates.unshift(OptionHolder.input.config);
268
- }
269
- const validConfigFilePath = candidates.find(
270
- (candidate) => exist(candidate) && is.object(readJsonSlow(candidate))
271
- );
272
- if (!validConfigFilePath) return;
273
- const config = readJsonSlow(validConfigFilePath);
274
- assignIfValueIsValidAndNotSetAlready(
275
- OptionHolder.input,
276
- "semverIncrement",
277
- config.bump?.increment
278
- );
279
- assignIfValueIsValidAndNotSetAlready(
280
- OptionHolder.input,
281
- "androidOutput",
282
- config.build?.androidBuildOutput ?? config.upload?.androidBuildOutput
283
- );
284
- assignIfValueIsValidAndNotSetAlready(OptionHolder.input, "pod", config.build?.iosPodInstall);
285
- assignIfValueIsValidAndNotSetAlready(
286
- OptionHolder.input,
287
- "uploadMetadata",
288
- config.upload?.uploadMetadata ?? config.submit?.uploadMetadata
289
- );
290
- assignIfValueIsValidAndNotSetAlready(
291
- OptionHolder.input,
292
- "uploadScreenshot",
293
- config.upload?.uploadScreenshot ?? config.submit?.uploadScreenshot
294
- );
295
- assignIfValueIsValidAndNotSetAlready(OptionHolder.input.git, "commit", config.bump?.git?.commit);
296
- assignIfValueIsValidAndNotSetAlready(
297
- OptionHolder.input.git,
298
- "commitMessage",
299
- config.bump?.git?.commitMessage
300
- );
301
- assignIfValueIsValidAndNotSetAlready(OptionHolder.input.git, "tag", config.bump?.git?.tag);
302
- assignIfValueIsValidAndNotSetAlready(
303
- OptionHolder.input.git,
304
- "tagName",
305
- config.bump?.git?.tagName
306
- );
307
- assignIfValueIsValidAndNotSetAlready(OptionHolder.input.git, "push", config.bump?.git?.push);
308
- }
309
- function assignIfValueIsValidAndNotSetAlready(object, key, value) {
310
- if (!object[key] && !(value === null || value === void 0)) {
311
- object[key] = value;
312
- }
313
- }
314
-
315
- // src/util/setup/setup.ts
316
- async function setup() {
317
- await setupBasicOptions();
318
- await parseConfigFile();
319
- await hydrateKeyholderFileValues();
320
- await parseBinaryVersions();
321
- }
322
- async function setupBasicOptions() {
323
- OptionHolder.projectDir = isDev ? resolve2("example") : resolve2(".");
324
- OptionHolder.resourcesDir = resolve2(OptionHolder.projectDir, "expo-release-it");
325
- OptionHolder.keyDir = resolve2(OptionHolder.resourcesDir, "key");
326
- OptionHolder.keyholderFilePath = resolve2(OptionHolder.resourcesDir, "keyholder.json");
327
- OptionHolder.tempDir = resolve2(OptionHolder.resourcesDir, ".temp");
328
- }
329
-
330
- // src/util/setup/execShellScript.ts
331
- import { execa } from "execa";
332
- var exe = execa({
333
- stdin: "pipe",
334
- stdout: "inherit",
335
- stderr: "inherit",
336
- shell: false
337
- });
338
-
339
- // src/command/bump.ts
340
- import { select as select2 } from "@inquirer/prompts";
341
-
342
- // src/util/input/InqueryInputs.ts
343
- import { select } from "@inquirer/prompts";
344
- import { is as is2 } from "@mj-studio/js-util";
345
- import chalk2 from "chalk";
346
- function constructInquirerFormattedMessage({
347
- example,
348
- explanation,
349
- referUrl,
350
- name
351
- }) {
352
- let ret = `${chalk2.bold(name)}`;
353
- if (explanation) {
354
- ret += `
355
-
356
- ${chalk2.italic.blue(explanation)}`;
357
- }
358
- if (example) {
359
- ret += `
360
- ${chalk2.italic(`${chalk2.greenBright("example :")} ${example}`)}`;
361
- }
362
- if (referUrl) {
363
- ret += `
364
- ${chalk2.italic(`${chalk2.greenBright("references :")} ${chalk2.underline.blue(referUrl)}`)}`;
365
- }
366
- if (explanation) {
367
- ret += "\n";
368
- if (example || referUrl) {
369
- ret += "\n";
370
- }
371
- }
372
- return ret;
373
- }
374
-
375
- // src/command/bump.ts
376
- import { is as is3 } from "@mj-studio/js-util";
377
- async function bump({ options }) {
378
- Object.assign(OptionHolder.input, options);
379
- await preCheck();
380
- await setup();
381
- const nextVersionName = semver2.inc(OptionHolder.versionName, OptionHolder.input.semverIncrement);
382
- const nextVersionCode = (() => {
383
- if (checkVersionCodeIsTiedWithVersionName(OptionHolder.versionName, OptionHolder.versionCode)) {
384
- return generateVersionCodeTiedWithVersionName(nextVersionName);
385
- } else {
386
- logger.warn(
387
- "version name is not tied with version code like (1.3.5=1003005). Version code is just incremented by 1."
388
- );
389
- return Number(OptionHolder.versionCode) + 1 + "";
390
- }
391
- })();
392
- logger.info(`Next Version: ${nextVersionName}(${nextVersionCode})`);
393
- await injectBinaryVersions({ versionName: nextVersionName, versionCode: nextVersionCode });
394
- logger.success("Binary versions have been bumped in expo config file");
395
- await processCommit({ nextVersionName, nextVersionCode });
396
- if (OptionHolder.input.git.commit) {
397
- await promptTagAndPush({ nextVersionName, nextVersionCode });
398
- }
399
- }
400
- async function preCheck() {
401
- if (isDev) return;
402
- try {
403
- let hasChange = false;
404
- try {
405
- await exe("git", ["diff", "--quiet", "HEAD"]);
406
- } catch (_) {
407
- hasChange = true;
408
- }
409
- if (hasChange) {
410
- throwError("Workspace is not clean. Before bump version, you should commit all changes.");
411
- }
412
- } catch (e) {
413
- throwError("Precheck Failed", e);
414
- }
415
- }
416
- async function processCommit({
417
- nextVersionCode,
418
- nextVersionName
419
- }) {
420
- if (!is3.boolean(OptionHolder.input.git.commit)) {
421
- OptionHolder.input.git.commit = await select2({
422
- message: constructInquirerFormattedMessage({ name: "Commit?" }),
423
- choices: [
424
- { name: "yes", value: true },
425
- { name: "no", value: false }
426
- ]
427
- });
428
- }
429
- if (!is3.notEmptyString(OptionHolder.input.git.commitMessage)) {
430
- OptionHolder.input.git.commitMessage = "chore: release $(version) \u{1F680}";
431
- }
432
- if (OptionHolder.input.git.commit) {
433
- await exe("git", ["add", "--all"]);
434
- await exe("git", [
435
- "commit",
436
- "-m",
437
- OptionHolder.input.git.commitMessage.replaceAll(
438
- "$(version)",
439
- `${nextVersionName}(${nextVersionCode})`
440
- )
441
- ]);
442
- }
443
- }
444
- async function promptTagAndPush({
445
- nextVersionCode,
446
- nextVersionName
447
- }) {
448
- if (!is3.boolean(OptionHolder.input.git.tag)) {
449
- OptionHolder.input.git.tag = await select2({
450
- message: constructInquirerFormattedMessage({ name: "Tag?" }),
451
- choices: [
452
- { name: "yes", value: true },
453
- { name: "no", value: false }
454
- ]
455
- });
456
- }
457
- if (!is3.notEmptyString(OptionHolder.input.git.tagName)) {
458
- OptionHolder.input.git.tagName = "v$(version)";
459
- }
460
- const tagName = OptionHolder.input.git.tagName.replaceAll(
461
- "$(version)",
462
- `${nextVersionName}(${nextVersionCode})`
463
- );
464
- if (OptionHolder.input.git.tag) {
465
- await exe("git", ["tag", "-a", tagName, "-m", tagName]);
466
- }
467
- if (!is3.boolean(OptionHolder.input.git.push)) {
468
- OptionHolder.input.git.push = await select2({
469
- message: constructInquirerFormattedMessage({ name: "Push?" }),
470
- choices: [
471
- { name: "yes", value: true },
472
- { name: "no", value: false }
473
- ]
474
- });
475
- }
476
- if (OptionHolder.input.git.push) {
477
- if (OptionHolder.input.git.tag) {
478
- await exe("git", ["push", "origin", tagName]);
479
- }
480
- await exe("git", ["push"]);
481
- }
482
- }
483
- export {
484
- bump
485
- };
486
- //# sourceMappingURL=bump.js.map
1
+ import "../EnvUtil-DWWwkHaf.js";
2
+ import "../FileUtil-B9JnWobK.js";
3
+ import "../OptionHolder-H3HG0A95.js";
4
+ import "../InqueryInputs-BGj-DlRa.js";
5
+ import "../logger-DvQ7ScMQ.js";
6
+ import "../execShellScript-Bd5xbFX5.js";
7
+ import "../parseConfigFile-hMLUnLZR.js";
8
+ import "../throwError-DMF6E5pu.js";
9
+ import "../VersionUtil-BDB10Hpb.js";
10
+ import "../hydrateKeyholderFileValues-BoaRs3SC.js";
11
+ import "../setup-CRNjdK5q.js";
12
+ import { bump } from "../bump-0hlTovjE.js";
13
+
14
+ export { bump };
@@ -1,5 +1,9 @@
1
- declare function init({ options }: {
2
- options: any;
1
+ //#region src/command/init.d.ts
2
+ declare function init({
3
+ options
4
+ }: {
5
+ options: any;
3
6
  }): Promise<void>;
4
-
7
+ //#endregion
5
8
  export { init };
9
+ //# sourceMappingURL=init.d.ts.map