Skip to content

Commit

Permalink
feat: add rollout argument to apps:bundles:create command
Browse files Browse the repository at this point in the history
  • Loading branch information
robingenz committed May 27, 2024
1 parent 9dbad37 commit 30b892c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/commands/apps/bundles/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export default defineCommand({
type: 'string',
description: 'Path to the bundle to upload. Must be a folder (e.g. `www` or `dist`) or a zip file.',
},
rollout: {
type: 'string',
description: 'The percentage of devices to deploy the bundle to. Must be a number between 0 and 1 (e.g. 0.5).',
},
iosMax: {
type: 'string',
description: 'The maximum iOS bundle version (`CFBundleVersion`) that the bundle supports.',
Expand All @@ -49,7 +53,7 @@ export default defineCommand({
return;
}

const { androidMax, androidMin, iosMax, iosMin } = ctx.args;
const { androidMax, androidMin, rollout, iosMax, iosMin } = ctx.args;
let appId = ctx.args.appId;
let path = ctx.args.path;
let channelName = ctx.args.channel;
Expand Down Expand Up @@ -96,6 +100,14 @@ export default defineCommand({
if (androidMin) {
formData.append('minAndroidAppVersionCode', androidMin);
}
if (rollout) {
const rolloutAsNumber = parseFloat(rollout);
if (isNaN(rolloutAsNumber) || rolloutAsNumber < 0 || rolloutAsNumber > 1) {
consola.error('Rollout percentage must be a number between 0 and 1 (e.g. 0.5).');
return;
}
formData.append('rolloutPercentage', rolloutAsNumber);
}
if (iosMax) {
formData.append('maxIosAppVersionCode', iosMax);
}
Expand Down

0 comments on commit 30b892c

Please sign in to comment.