Skip to content

Commit

Permalink
fix(apps): --rollout option was ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
robingenz committed Nov 1, 2024
1 parent 9cd176d commit 5f1b2d8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/commands/apps/bundles/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default defineCommand({
let iosMin = ctx.args.iosMin as string | undefined;
let path = ctx.args.path as string | undefined;
let privateKey = ctx.args.privateKey as string | undefined;
let rollout = ctx.args.rollout as string | undefined;
let rolloutAsString = ctx.args.rollout as string | undefined;
let url = ctx.args.url as string | undefined;
// Validate the expiration days
let expiresAt: string | undefined;
Expand All @@ -102,6 +102,16 @@ export default defineCommand({
expiresAtDate.setDate(expiresAtDate.getDate() + expiresInDaysAsNumber);
expiresAt = expiresAtDate.toISOString();
}
// Validate the rollout percentage
let rolloutPercentage = 1;
if (rolloutAsString) {
const rolloutAsNumber = parseFloat(rolloutAsString);
if (isNaN(rolloutAsNumber) || rolloutAsNumber < 0 || rolloutAsNumber > 1) {
consola.error('Rollout percentage must be a number between 0 and 1.');
return;
}
rolloutPercentage = rolloutAsNumber;
}
if (!path && !url) {
path = await prompt('Enter the path to the app bundle:', {
type: 'text',
Expand Down Expand Up @@ -185,6 +195,7 @@ export default defineCommand({
maxIosAppVersionCode: iosMax,
minAndroidAppVersionCode: androidMin,
minIosAppVersionCode: androidMin,
rolloutPercentage,
});
appBundleId = response.id;
if (path) {
Expand Down

0 comments on commit 5f1b2d8

Please sign in to comment.