diff --git a/cli.json b/cli.json index a71933c..2f77f84 100644 --- a/cli.json +++ b/cli.json @@ -118,7 +118,7 @@ "description": "Bundle javascript and copy assets." }, "bundle": { - "description": "Bundle javascript code only.", + "description": "Bundle javascript code only and optionally publish.", "options": { "dev": { "default": "false", @@ -157,6 +157,18 @@ }, "disableHermes": { "default": false + }, + "name": { + "hasValue": true, + "description": "Version name for publishing" + }, + "description": { + "hasValue": true, + "description": "Version description for publishing" + }, + "metaInfo": { + "hasValue": true, + "description": "Meta information for publishing" } } }, diff --git a/src/bundle.ts b/src/bundle.ts index 5c3d1cb..5a58b1c 100644 --- a/src/bundle.ts +++ b/src/bundle.ts @@ -19,6 +19,7 @@ import { t } from './utils/i18n'; import { tempDir } from './utils/constants'; import { checkLockFiles } from './utils/check-lockfile'; import { addGitIgnore } from './utils/add-gitignore'; +import { commands as versionCommands } from './versions'; type Diff = (oldSource?: Buffer, newSource?: Buffer) => Buffer; @@ -916,6 +917,9 @@ export const commands = { expo, rncli, disableHermes, + name, + description, + metaInfo, } = translateOptions({ ...options, tempDir, @@ -956,14 +960,17 @@ export const commands = { await pack(path.resolve(intermediaDir), realOutput); - const v = await question(t('uploadBundlePrompt')); - if (v.toLowerCase() === 'y') { - const versionName = await this.publish({ + if (name) { + const versionName = await versionCommands.publish({ args: [realOutput], options: { platform, + name, + description, + metaInfo, }, }); + if (isSentry) { await copyDebugidForSentry(bundleName, intermediaDir, sourcemapOutput); await uploadSourcemapForSentry( @@ -973,6 +980,25 @@ export const commands = { versionName, ); } + } else if (!options['no-interactive']) { + const v = await question(t('uploadBundlePrompt')); + if (v.toLowerCase() === 'y') { + const versionName = await versionCommands.publish({ + args: [realOutput], + options: { + platform, + }, + }); + if (isSentry) { + await copyDebugidForSentry(bundleName, intermediaDir, sourcemapOutput); + await uploadSourcemapForSentry( + bundleName, + intermediaDir, + sourcemapOutput, + versionName, + ); + } + } } },