Skip to content

Commit b22c598

Browse files
bozaigaosunnylqm
andauthored
add paramaters for bundle command to auto publish (#12)
* add paramaters for bundle command to auto publish * Update bundle.ts --------- Co-authored-by: Sunny Luo <sunnylqm@gmail.com>
1 parent 573ab60 commit b22c598

File tree

2 files changed

+42
-4
lines changed

2 files changed

+42
-4
lines changed

cli.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
"description": "Bundle javascript and copy assets."
119119
},
120120
"bundle": {
121-
"description": "Bundle javascript code only.",
121+
"description": "Bundle javascript code only and optionally publish.",
122122
"options": {
123123
"dev": {
124124
"default": "false",
@@ -157,6 +157,18 @@
157157
},
158158
"disableHermes": {
159159
"default": false
160+
},
161+
"name": {
162+
"hasValue": true,
163+
"description": "Version name for publishing"
164+
},
165+
"description": {
166+
"hasValue": true,
167+
"description": "Version description for publishing"
168+
},
169+
"metaInfo": {
170+
"hasValue": true,
171+
"description": "Meta information for publishing"
160172
}
161173
}
162174
},

src/bundle.ts

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { t } from './utils/i18n';
1919
import { tempDir } from './utils/constants';
2020
import { checkLockFiles } from './utils/check-lockfile';
2121
import { addGitIgnore } from './utils/add-gitignore';
22+
import { commands as versionCommands } from './versions';
2223

2324
type Diff = (oldSource?: Buffer, newSource?: Buffer) => Buffer;
2425

@@ -916,6 +917,9 @@ export const commands = {
916917
expo,
917918
rncli,
918919
disableHermes,
920+
name,
921+
description,
922+
metaInfo,
919923
} = translateOptions({
920924
...options,
921925
tempDir,
@@ -956,14 +960,17 @@ export const commands = {
956960

957961
await pack(path.resolve(intermediaDir), realOutput);
958962

959-
const v = await question(t('uploadBundlePrompt'));
960-
if (v.toLowerCase() === 'y') {
961-
const versionName = await this.publish({
963+
if (name) {
964+
const versionName = await versionCommands.publish({
962965
args: [realOutput],
963966
options: {
964967
platform,
968+
name,
969+
description,
970+
metaInfo,
965971
},
966972
});
973+
967974
if (isSentry) {
968975
await copyDebugidForSentry(bundleName, intermediaDir, sourcemapOutput);
969976
await uploadSourcemapForSentry(
@@ -973,6 +980,25 @@ export const commands = {
973980
versionName,
974981
);
975982
}
983+
} else if (!options['no-interactive']) {
984+
const v = await question(t('uploadBundlePrompt'));
985+
if (v.toLowerCase() === 'y') {
986+
const versionName = await versionCommands.publish({
987+
args: [realOutput],
988+
options: {
989+
platform,
990+
},
991+
});
992+
if (isSentry) {
993+
await copyDebugidForSentry(bundleName, intermediaDir, sourcemapOutput);
994+
await uploadSourcemapForSentry(
995+
bundleName,
996+
intermediaDir,
997+
sourcemapOutput,
998+
versionName,
999+
);
1000+
}
1001+
}
9761002
}
9771003
},
9781004

0 commit comments

Comments
 (0)