Skip to content

Commit

Permalink
[eas-cli] Fix flags and args
Browse files Browse the repository at this point in the history
Fixed flags and args in `update` commands

See: https://linear.app/expo/issue/ENG-9175/update-oclif-in-eas-cli
  • Loading branch information
radoslawkrzemien committed Dec 1, 2023
1 parent 8e46cfc commit a32ee86
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 26 deletions.
6 changes: 4 additions & 2 deletions packages/eas-cli/src/commands/update/configure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ import {
ensureEASUpdateIsConfiguredInEasJsonAsync,
} from '../../update/configure';

const PLATFORM_FLAG_OPTIONS = ['android', 'ios', 'all'];

export default class UpdateConfigure extends EasCommand {
static override description = 'configure the project to support EAS Update';

static override flags = {
platform: Flags.enum({
platform: Flags.string({
description: 'Platform to configure',
char: 'p',
options: ['android', 'ios', 'all'],
options: PLATFORM_FLAG_OPTIONS,
default: 'all',
}),
...EASNonInteractiveFlag,
Expand Down
10 changes: 5 additions & 5 deletions packages/eas-cli/src/commands/update/delete.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Args } from '@oclif/core';
import chalk from 'chalk';
import gql from 'graphql-tag';

Expand Down Expand Up @@ -42,13 +43,12 @@ async function deleteUpdateGroupAsync(
export default class UpdateDelete extends EasCommand {
static override description = 'delete all the updates in an update group';

static override args = [
{
name: 'groupId',
static override args = {
groupId: Args.string({
required: true,
description: 'The ID of an update group to delete.',
},
];
}),
};

static override flags = {
...EasNonInteractiveAndJsonFlags,
Expand Down
14 changes: 8 additions & 6 deletions packages/eas-cli/src/commands/update/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ type UpdateFlags = {
nonInteractive: boolean;
};

const PLATFORM_FLAG_OPTIONS = [
// TODO: Add web when it's fully supported
...defaultPublishPlatforms,
'all',
];

export default class UpdatePublish extends EasCommand {
static override description = 'publish an update group';

Expand Down Expand Up @@ -125,13 +131,9 @@ export default class UpdatePublish extends EasCommand {
description: `Clear the bundler cache before publishing`,
default: false,
}),
platform: Flags.enum({
platform: Flags.string({
char: 'p',
options: [
// TODO: Add web when it's fully supported
...defaultPublishPlatforms,
'all',
],
options: PLATFORM_FLAG_OPTIONS,
default: 'all',
required: false,
}),
Expand Down
6 changes: 4 additions & 2 deletions packages/eas-cli/src/commands/update/republish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ type UpdateRepublishFlags = {
json: boolean;
};

const PLATFORM_FLAG_OPTIONS = [...defaultRepublishPlatforms, 'all'];

export default class UpdateRepublish extends EasCommand {
static override description = 'roll back to an existing update';

Expand All @@ -62,9 +64,9 @@ export default class UpdateRepublish extends EasCommand {
description: 'Short message describing the republished update group',
required: false,
}),
platform: Flags.enum({
platform: Flags.string({
char: 'p',
options: [...defaultRepublishPlatforms, 'all'],
options: PLATFORM_FLAG_OPTIONS,
default: 'all',
required: false,
}),
Expand Down
14 changes: 8 additions & 6 deletions packages/eas-cli/src/commands/update/roll-back-to-embedded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ type UpdateFlags = {
nonInteractive: boolean;
};

const PLATFORM_FLAG_OPTIONS = [
// TODO: Add web when it's fully supported
...defaultPublishPlatforms,
'all',
];

export default class UpdateRollBackToEmbedded extends EasCommand {
static override description = 'roll back to the embedded update';

Expand All @@ -85,13 +91,9 @@ export default class UpdateRollBackToEmbedded extends EasCommand {
description: 'A short message describing the rollback to embedded update',
required: false,
}),
platform: Flags.enum({
platform: Flags.string({
char: 'p',
options: [
// TODO: Add web when it's fully supported
...defaultPublishPlatforms,
'all',
],
options: PLATFORM_FLAG_OPTIONS,
default: 'all',
required: false,
}),
Expand Down
10 changes: 5 additions & 5 deletions packages/eas-cli/src/commands/update/view.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Args } from '@oclif/core';
import chalk from 'chalk';

import EasCommand from '../../commandUtils/EasCommand';
Expand All @@ -14,13 +15,12 @@ import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
export default class UpdateView extends EasCommand {
static override description = 'update group details';

static override args = [
{
name: 'groupId',
static override args = {
groupId: Args.string({
required: true,
description: 'The ID of an update group.',
},
];
}),
};

static override flags = {
...EasJsonOnlyFlag,
Expand Down

0 comments on commit a32ee86

Please sign in to comment.