diff --git a/CHANGELOG.md b/CHANGELOG.md index 3883b2d230..8786c693c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ This is the log of notable changes to EAS CLI and related packages. ### 🛠 Breaking changes +- Change behavior of roll-back-to-embedded to not use current project state. ([#2722](https://github.com/expo/eas-cli/pull/2722) by [@wschurman](https://github.com/wschurman)) + ### 🎉 New features ### 🐛 Bug fixes diff --git a/packages/eas-cli/src/branch/queries.ts b/packages/eas-cli/src/branch/queries.ts index de314becca..08168da968 100644 --- a/packages/eas-cli/src/branch/queries.ts +++ b/packages/eas-cli/src/branch/queries.ts @@ -1,4 +1,5 @@ import chalk from 'chalk'; +import { print } from 'graphql'; import gql from 'graphql-tag'; import { BranchNotFoundError } from './utils'; @@ -8,10 +9,11 @@ import { withErrorHandlingAsync } from '../graphql/client'; import { CreateUpdateBranchForAppMutation, CreateUpdateBranchForAppMutationVariables, - UpdateBranch, + UpdateBranchBasicInfoFragment, UpdateBranchFragment, } from '../graphql/generated'; import { BranchQuery } from '../graphql/queries/BranchQuery'; +import { UpdateBranchBasicInfoFragmentNode } from '../graphql/types/UpdateBranchBasicInfo'; import Log from '../log'; import { formatBranch, getBranchDescription } from '../update/utils'; import { printJsonOnlyOutput } from '../utils/json'; @@ -126,7 +128,7 @@ function renderPageOfBranches( export async function createUpdateBranchOnAppAsync( graphqlClient: ExpoGraphqlClient, { appId, name }: CreateUpdateBranchForAppMutationVariables -): Promise> { +): Promise { const result = await withErrorHandlingAsync( graphqlClient .mutation( @@ -135,15 +137,17 @@ export async function createUpdateBranchOnAppAsync( updateBranch { createUpdateBranchForApp(appId: $appId, name: $name) { id - name + ...UpdateBranchBasicInfoFragment } } } + ${print(UpdateBranchBasicInfoFragmentNode)} `, { appId, name, - } + }, + { additionalTypenames: ['UpdateBranch'] } ) .toPromise() ); @@ -163,22 +167,21 @@ export async function ensureBranchExistsAsync( appId: string; branchName: string; } -): Promise<{ branchId: string; createdBranch: boolean }> { +): Promise<{ branch: UpdateBranchBasicInfoFragment; createdBranch: boolean }> { try { const updateBranch = await BranchQuery.getBranchByNameAsync(graphqlClient, { appId, name: branchName, }); - const { id } = updateBranch; - return { branchId: id, createdBranch: false }; + return { branch: updateBranch, createdBranch: false }; } catch (error) { if (error instanceof BranchNotFoundError) { const newUpdateBranch = await createUpdateBranchOnAppAsync(graphqlClient, { appId, name: branchName, }); - return { branchId: newUpdateBranch.id, createdBranch: true }; + return { branch: newUpdateBranch, createdBranch: true }; } else { throw error; } diff --git a/packages/eas-cli/src/commands/update/__tests__/index.test.ts b/packages/eas-cli/src/commands/update/__tests__/index.test.ts index aaad94b3ab..1a19df4067 100644 --- a/packages/eas-cli/src/commands/update/__tests__/index.test.ts +++ b/packages/eas-cli/src/commands/update/__tests__/index.test.ts @@ -88,7 +88,10 @@ describe(UpdatePublish.name, () => { const { platforms, runtimeVersion } = mockTestExport(); jest.mocked(ensureBranchExistsAsync).mockResolvedValue({ - branchId: 'branch123', + branch: { + id: 'branch123', + name: 'wat', + }, createdBranch: false, }); @@ -111,7 +114,10 @@ describe(UpdatePublish.name, () => { .mocked(getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync) .mockResolvedValue({ branchId: 'branch123', branchName: 'branchFromChannel' }); jest.mocked(ensureBranchExistsAsync).mockResolvedValue({ - branchId: 'branch123', + branch: { + id: 'branch123', + name: 'wat', + }, createdBranch: false, }); @@ -146,7 +152,10 @@ describe(UpdatePublish.name, () => { // Mock an existing branch, so we don't create a new one jest.mocked(ensureBranchExistsAsync).mockResolvedValue({ - branchId: 'branch123', + branch: { + id: 'branch123', + name: 'wat', + }, createdBranch: false, }); diff --git a/packages/eas-cli/src/commands/update/__tests__/roll-back-to-embedded.test.ts b/packages/eas-cli/src/commands/update/__tests__/roll-back-to-embedded.test.ts index e7ebea2481..256919091f 100644 --- a/packages/eas-cli/src/commands/update/__tests__/roll-back-to-embedded.test.ts +++ b/packages/eas-cli/src/commands/update/__tests__/roll-back-to-embedded.test.ts @@ -1,5 +1,4 @@ import { AppJSONConfig, ExpoConfig, PackageJSONConfig, getConfig } from '@expo/config'; -import { Updates } from '@expo/config-plugins'; import { vol } from 'memfs'; import nullthrows from 'nullthrows'; import path from 'path'; @@ -82,16 +81,23 @@ describe(UpdateRollBackToEmbedded.name, () => { ); }); - it('creates a roll back to embedded with --non-interactive, --branch, and --message', async () => { - const flags = ['--non-interactive', '--branch=branch123', '--message=abc']; + it('creates a roll back to embedded with --non-interactive, --branch, --message, and --runtime-version', async () => { + const flags = [ + '--non-interactive', + '--branch=branch123', + '--message=abc', + '--runtime-version=exposdk:47.0.0', + ]; mockTestProject(); const platforms = ['android', 'ios']; const runtimeVersion = 'exposdk:47.0.0'; - jest.mocked(Updates.getRuntimeVersionAsync).mockResolvedValue(runtimeVersion); jest.mocked(ensureBranchExistsAsync).mockResolvedValue({ - branchId: 'branch123', + branch: { + id: 'branch123', + name: 'wat', + }, createdBranch: false, }); @@ -104,19 +110,26 @@ describe(UpdateRollBackToEmbedded.name, () => { expect(PublishMutation.publishUpdateGroupAsync).toHaveBeenCalled(); }); - it('creates a roll back to embedded with --non-interactive, --channel, and --message', async () => { - const flags = ['--non-interactive', '--channel=channel123', '--message=abc']; + it('creates a roll back to embedded with --non-interactive, --channel, --message, and --runtime-version', async () => { + const flags = [ + '--non-interactive', + '--channel=channel123', + '--message=abc', + '--runtime-version=exposdk:47.0.0', + ]; const { projectId } = mockTestProject(); const platforms = ['android', 'ios']; const runtimeVersion = 'exposdk:47.0.0'; - jest.mocked(Updates.getRuntimeVersionAsync).mockResolvedValue(runtimeVersion); jest .mocked(getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync) .mockResolvedValue({ branchId: updateStub.branch.id, branchName: 'branchFromChannel' }); jest.mocked(ensureBranchExistsAsync).mockResolvedValue({ - branchId: 'branch123', + branch: { + id: 'branch123', + name: 'wat', + }, createdBranch: false, }); @@ -142,18 +155,25 @@ describe(UpdateRollBackToEmbedded.name, () => { }); it('creates a roll back to embedded with the public expo config', async () => { - const flags = ['--non-interactive', '--branch=branch123', '--message=abc']; + const flags = [ + '--non-interactive', + '--branch=branch123', + '--message=abc', + '--runtime-version=exposdk:47.0.0', + ]; // Add configuration to the project that should not be included in the update mockTestProject(); const platforms = ['ios']; const runtimeVersion = 'exposdk:47.0.0'; - jest.mocked(Updates.getRuntimeVersionAsync).mockResolvedValue(runtimeVersion); // Mock an existing branch, so we don't create a new one jest.mocked(ensureBranchExistsAsync).mockResolvedValue({ - branchId: 'branch123', + branch: { + id: 'branch123', + name: 'wat', + }, createdBranch: false, }); diff --git a/packages/eas-cli/src/commands/update/index.ts b/packages/eas-cli/src/commands/update/index.ts index 3f01c636ca..ca7fc2c736 100644 --- a/packages/eas-cli/src/commands/update/index.ts +++ b/packages/eas-cli/src/commands/update/index.ts @@ -400,7 +400,7 @@ export default class UpdatePublish extends EasCommand { runtimeVersionInfoObjects ); - const { branchId } = await ensureBranchExistsAsync(graphqlClient, { + const { branch } = await ensureBranchExistsAsync(graphqlClient, { appId: projectId, branchName, }); @@ -482,7 +482,7 @@ export default class UpdatePublish extends EasCommand { ); return { - branchId, + branchId: branch.id, updateInfoGroup: localUpdateInfoGroup, rolloutInfoGroup: localRolloutInfoGroup, runtimeFingerprintSource: fingerprintSource diff --git a/packages/eas-cli/src/commands/update/roll-back-to-embedded.ts b/packages/eas-cli/src/commands/update/roll-back-to-embedded.ts index 2db4c6ce40..5bd58d77d3 100644 --- a/packages/eas-cli/src/commands/update/roll-back-to-embedded.ts +++ b/packages/eas-cli/src/commands/update/roll-back-to-embedded.ts @@ -1,5 +1,4 @@ import { Platform as PublishPlatform } from '@expo/config'; -import { Workflow } from '@expo/eas-build-job'; import { Errors, Flags } from '@oclif/core'; import nullthrows from 'nullthrows'; @@ -12,10 +11,12 @@ import { getPaginatedQueryOptions } from '../../commandUtils/pagination'; import fetch from '../../fetch'; import { PublishUpdateGroupInput, + RuntimeFragment, StatuspageServiceName, UpdatePublishMutation, } from '../../graphql/generated'; import { PublishMutation } from '../../graphql/mutations/PublishMutation'; +import { RuntimeQuery } from '../../graphql/queries/RuntimeQuery'; import Log, { link } from '../../log'; import { ora } from '../../ora'; import { RequestedPlatform } from '../../platform'; @@ -29,10 +30,8 @@ import { defaultPublishPlatforms, getBranchNameForCommandAsync, getRuntimeToPlatformsAndFingerprintInfoMappingFromRuntimeVersionInfoObjects, - getRuntimeVersionInfoObjectsAsync, getUpdateMessageForCommandAsync, } from '../../project/publish'; -import { resolveWorkflowPerPlatformAsync } from '../../project/workflow'; import { ensureEASUpdateIsConfiguredAsync } from '../../update/configure'; import { getUpdateJsonInfosForUpdates } from '../../update/utils'; import { @@ -45,12 +44,13 @@ import { import uniqBy from '../../utils/expodash/uniqBy'; import formatFields from '../../utils/formatFields'; import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json'; +import { Connection, QueryParams, selectPaginatedAsync } from '../../utils/relay'; import { maybeWarnAboutEasOutagesAsync } from '../../utils/statuspageService'; type RawUpdateFlags = { - auto: boolean; branch?: string; channel?: string; + 'runtime-version'?: string; message?: string; platform: string; 'private-key-path'?: string; @@ -59,10 +59,10 @@ type RawUpdateFlags = { }; type UpdateFlags = { - auto: boolean; platform: RequestedPlatform; branchName?: string; channelName?: string; + runtimeVersion?: string; updateMessage?: string; privateKeyPath?: string; json: boolean; @@ -81,6 +81,10 @@ export default class UpdateRollBackToEmbedded extends EasCommand { description: 'Channel that the published rollback to embedded update should affect', required: false, }), + 'runtime-version': Flags.string({ + description: 'Runtime version that the rollback to embedded update should target', + required: false, + }), message: Flags.string({ description: 'A short message describing the rollback to embedded update', required: false, @@ -95,11 +99,6 @@ export default class UpdateRollBackToEmbedded extends EasCommand { default: 'all', required: false, }), - auto: Flags.boolean({ - description: - 'Use the current git branch and commit message for the EAS branch and update message', - default: false, - }), 'private-key-path': Flags.string({ description: `File containing the PEM-encoded private key corresponding to the certificate in expo-updates' configuration. Defaults to a file named "private-key.pem" in the certificate's directory. Only relevant if you are using code signing: https://docs.expo.dev/eas-update/code-signing/`, required: false, @@ -117,10 +116,10 @@ export default class UpdateRollBackToEmbedded extends EasCommand { const { flags: rawFlags } = await this.parse(UpdateRollBackToEmbedded); const paginatedQueryOptions = getPaginatedQueryOptions(rawFlags); const { - auto: autoFlag, platform: platformFlag, channelName: channelNameArg, updateMessage: updateMessageArg, + runtimeVersion: runtimeVersionArg, privateKeyPath, json: jsonFlag, nonInteractive, @@ -171,14 +170,14 @@ export default class UpdateRollBackToEmbedded extends EasCommand { projectId, channelNameArg, branchNameArg, - autoFlag, + autoFlag: false, nonInteractive, paginatedQueryOptions, }); const updateMessage = await getUpdateMessageForCommandAsync(vcsClient, { updateMessageArg, - autoFlag, + autoFlag: false, nonInteractive, jsonFlag, }); @@ -186,28 +185,33 @@ export default class UpdateRollBackToEmbedded extends EasCommand { const realizedPlatforms: UpdatePublishPlatform[] = platformFlag === 'all' ? defaultPublishPlatforms : [platformFlag]; - const { branchId } = await ensureBranchExistsAsync(graphqlClient, { + const { branch } = await ensureBranchExistsAsync(graphqlClient, { appId: projectId, branchName, }); - const gitCommitHash = await vcsClient.getCommitHashAsync(); - const isGitWorkingTreeDirty = await vcsClient.hasUncommittedChangesAsync(); + const selectedRuntime = + runtimeVersionArg ?? + ( + await UpdateRollBackToEmbedded.selectRuntimeAsync(graphqlClient, { + appId: projectId, + branchName, + }) + )?.version; + if (!selectedRuntime) { + Errors.error('Must select a runtime or provide the --runtimeVersion flag', { exit: 1 }); + } - const workflows = await resolveWorkflowPerPlatformAsync(projectDir, vcsClient); - const runtimeVersionInfoObjects = await getRuntimeVersionInfoObjectsAsync({ - exp, - platforms: realizedPlatforms, - projectDir, - workflows: { - ...workflows, - web: Workflow.UNKNOWN, - }, - env: undefined, - }); const runtimeToPlatformsAndFingerprintInfoMapping = getRuntimeToPlatformsAndFingerprintInfoMappingFromRuntimeVersionInfoObjects( - runtimeVersionInfoObjects + realizedPlatforms.map(platform => ({ + platform, + runtimeVersionInfo: { + runtimeVersion: selectedRuntime, + fingerprint: null, + fingerprintHash: null, + }, + })) ); let newUpdates: UpdatePublishMutation['updateBranch']['publishUpdateGroups']; @@ -215,10 +219,8 @@ export default class UpdateRollBackToEmbedded extends EasCommand { try { newUpdates = await this.publishRollbacksAsync({ graphqlClient, - isGitWorkingTreeDirty, - gitCommitHash, updateMessage, - branchId, + branchId: branch.id, codeSigningInfo, runtimeToPlatformsAndFingerprintInfoMapping, realizedPlatforms, @@ -232,13 +234,6 @@ export default class UpdateRollBackToEmbedded extends EasCommand { if (jsonFlag) { printJsonOnlyOutput(getUpdateJsonInfosForUpdates(newUpdates)); } else { - if (new Set(newUpdates.map(update => update.group)).size > 1) { - Log.addNewLineIfNone(); - Log.log( - '👉 Since multiple runtime versions are defined, multiple update groups have been published.' - ); - } - Log.addNewLineIfNone(); for (const runtime of uniqBy( @@ -276,14 +271,6 @@ export default class UpdateRollBackToEmbedded extends EasCommand { : []), ...(newIosUpdate ? [{ label: 'iOS update ID', value: newIosUpdate.id }] : []), { label: 'Message', value: updateMessage ?? '' }, - ...(gitCommitHash - ? [ - { - label: 'Commit', - value: `${gitCommitHash}${isGitWorkingTreeDirty ? '*' : ''}`, - }, - ] - : []), { label: 'EAS Dashboard', value: updateGroupLink }, ]) ); @@ -294,8 +281,6 @@ export default class UpdateRollBackToEmbedded extends EasCommand { private async publishRollbacksAsync({ graphqlClient, - isGitWorkingTreeDirty, - gitCommitHash, updateMessage, branchId, codeSigningInfo, @@ -303,8 +288,6 @@ export default class UpdateRollBackToEmbedded extends EasCommand { realizedPlatforms, }: { graphqlClient: ExpoGraphqlClient; - isGitWorkingTreeDirty: boolean | undefined; - gitCommitHash: string | undefined; updateMessage: string | undefined; branchId: string; codeSigningInfo: CodeSigningInfo | undefined; @@ -329,8 +312,6 @@ export default class UpdateRollBackToEmbedded extends EasCommand { rollBackToEmbeddedInfoGroup: localRollbackInfoGroup, runtimeVersion, message: updateMessage, - gitCommitHash, - isGitWorkingTreeDirty, awaitingCodeSigningInfo: !!codeSigningInfo, }; } @@ -381,22 +362,63 @@ export default class UpdateRollBackToEmbedded extends EasCommand { return newUpdates; } + private static async selectRuntimeAsync( + graphqlClient: ExpoGraphqlClient, + { + appId, + branchName, + batchSize = 5, + }: { + appId: string; + branchName: string; + batchSize?: number; + } + ): Promise { + const queryAsync = async (queryParams: QueryParams): Promise> => { + return await RuntimeQuery.getRuntimesOnBranchAsync(graphqlClient, { + appId, + name: branchName, + first: queryParams.first, + after: queryParams.after, + last: queryParams.last, + before: queryParams.before, + }); + }; + const getTitleAsync = async (runtime: RuntimeFragment): Promise => { + return runtime.version; + }; + return await selectPaginatedAsync({ + queryAsync, + getTitleAsync, + printedType: 'target runtime', + pageSize: batchSize, + }); + } + private sanitizeFlags(flags: RawUpdateFlags): UpdateFlags { const nonInteractive = flags['non-interactive'] ?? false; - const { auto, branch: branchName, channel: channelName, message: updateMessage } = flags; - if (nonInteractive && !auto && !(updateMessage && (branchName || channelName))) { + const { + branch: branchName, + channel: channelName, + message: updateMessage, + 'runtime-version': runtimeVersion, + } = flags; + if (nonInteractive && !(updateMessage && (branchName || channelName))) { Errors.error( - '--branch and --message, or --channel and --message are required when updating in non-interactive mode unless --auto is specified', + '--branch and --message, or --channel and --message are required in non-interactive mode', { exit: 1 } ); } + if (nonInteractive && !runtimeVersion) { + Errors.error('--runtimeVersion is required in non-interactive mode', { exit: 1 }); + } return { - auto, branchName, channelName, updateMessage, + runtimeVersion, platform: flags.platform as RequestedPlatform, privateKeyPath: flags['private-key-path'], nonInteractive, diff --git a/packages/eas-cli/src/rollout/actions/CreateRollout.ts b/packages/eas-cli/src/rollout/actions/CreateRollout.ts index 6fde52728c..2e89cc1dfb 100644 --- a/packages/eas-cli/src/rollout/actions/CreateRollout.ts +++ b/packages/eas-cli/src/rollout/actions/CreateRollout.ts @@ -149,7 +149,7 @@ export class CreateRollout implements EASUpdateAction { + private async confirmCreationAsync(ctx: EASUpdateContext): Promise { const { nonInteractive } = ctx; if (nonInteractive) { return true; @@ -159,7 +159,7 @@ export class CreateRollout implements EASUpdateAction { @@ -172,7 +172,7 @@ export class CreateRollout implements EASUpdateAction { + private async selectRuntimeVersionFromProjectConfigAsync(ctx: EASUpdateContext): Promise { const platforms: ('ios' | 'android')[] = ['ios', 'android']; const workflows = await resolveWorkflowPerPlatformAsync(ctx.app.projectDir, ctx.vcsClient); const runtimes = ( @@ -313,7 +313,7 @@ export class CreateRollout implements EASUpdateAction { @@ -333,7 +333,7 @@ export class CreateRollout implements EASUpdateAction { diff --git a/packages/eas-cli/src/rollout/actions/EditRollout.ts b/packages/eas-cli/src/rollout/actions/EditRollout.ts index c00cbe8bc5..83da2c5d4c 100644 --- a/packages/eas-cli/src/rollout/actions/EditRollout.ts +++ b/packages/eas-cli/src/rollout/actions/EditRollout.ts @@ -86,7 +86,7 @@ export class EditRollout implements EASUpdateAction { + private async confirmEditAsync(ctx: EASUpdateContext): Promise { const { nonInteractive } = ctx; if (nonInteractive) { return true; @@ -96,7 +96,7 @@ export class EditRollout implements EASUpdateAction { + private async getChannelObjectAsync(ctx: EASUpdateContext): Promise { const { graphqlClient, app } = ctx; const { projectId } = app; if (!isRollout(this.channelInfo)) { diff --git a/packages/eas-cli/src/rollout/actions/EndRollout.ts b/packages/eas-cli/src/rollout/actions/EndRollout.ts index 88645d0399..d8ceb6de4a 100644 --- a/packages/eas-cli/src/rollout/actions/EndRollout.ts +++ b/packages/eas-cli/src/rollout/actions/EndRollout.ts @@ -87,7 +87,7 @@ export class EndRollout implements EASUpdateAction { + private async getChannelObjectAsync(ctx: EASUpdateContext): Promise { const { graphqlClient, app } = ctx; const { projectId } = app; if (!isRollout(this.channelInfo)) { @@ -107,7 +107,7 @@ export class EndRollout implements EASUpdateAction): Promise { + private async selectOutcomeAsync(rollout: Rollout): Promise { const { rolledOutBranch, percentRolledOut, defaultBranch } = rollout; const rolledOutUpdateGroup = rolledOutBranch.updateGroups[0]; const defaultUpdateGroup = defaultBranch.updateGroups[0]; @@ -144,7 +144,7 @@ export class EndRollout implements EASUpdateAction, outcome: EndOutcome @@ -185,7 +185,7 @@ export class EndRollout implements EASUpdateAction diff --git a/packages/eas-cli/src/rollout/actions/ManageRollout.ts b/packages/eas-cli/src/rollout/actions/ManageRollout.ts index 94a4ac582b..19bf637239 100644 --- a/packages/eas-cli/src/rollout/actions/ManageRollout.ts +++ b/packages/eas-cli/src/rollout/actions/ManageRollout.ts @@ -61,7 +61,7 @@ export class ManageRollout implements EASUpdateAction { } } - async selectActionAsync(): Promise { + private async selectActionAsync(): Promise { const manageOptions = [ManageRolloutActions.EDIT, ManageRolloutActions.END]; if (this.options.callingAction) { manageOptions.push(ManageRolloutActions.GO_BACK); @@ -78,7 +78,7 @@ export class ManageRollout implements EASUpdateAction { return selectedManageOption; } - async getChannelObjectAsync(ctx: EASUpdateContext): Promise { + private async getChannelObjectAsync(ctx: EASUpdateContext): Promise { const { graphqlClient, app } = ctx; const { projectId } = app; if (!isRollout(this.channelInfo)) { diff --git a/packages/eas-cli/src/rollout/actions/NonInteractiveRollout.ts b/packages/eas-cli/src/rollout/actions/NonInteractiveRollout.ts index 9217c39e4b..05da96d4ba 100644 --- a/packages/eas-cli/src/rollout/actions/NonInteractiveRollout.ts +++ b/packages/eas-cli/src/rollout/actions/NonInteractiveRollout.ts @@ -91,7 +91,7 @@ export class NonInteractiveRollout implements EASUpdateAction { } } - async runActionAsync( + private async runActionAsync( ctx: EASUpdateContext, action: RolloutActions, channelObject: UpdateChannelObject @@ -108,7 +108,7 @@ export class NonInteractiveRollout implements EASUpdateAction { } } - viewRollout(channelObject: UpdateChannelObject): UpdateChannelObject { + private viewRollout(channelObject: UpdateChannelObject): UpdateChannelObject { if (!this.options.json) { printRollout(channelObject); Log.warn('For formatted output, add the --json flag to your command.'); @@ -116,7 +116,7 @@ export class NonInteractiveRollout implements EASUpdateAction { return channelObject; } - async getJsonAsync({ + private async getJsonAsync({ originalChannelObject, updatedChannelObject, }: { @@ -134,7 +134,9 @@ export class NonInteractiveRollout implements EASUpdateAction { }; } - async getRolloutJsonAsync(channelObject: UpdateChannelObject): Promise { + private async getRolloutJsonAsync( + channelObject: UpdateChannelObject + ): Promise { const rollout = getRollout(channelObject); return { defaultBranch: rollout.defaultBranch, @@ -145,7 +147,7 @@ export class NonInteractiveRollout implements EASUpdateAction { }; } - getRuntimeVersion(channelInfo: UpdateChannelBasicInfoFragment): string | undefined { + private getRuntimeVersion(channelInfo: UpdateChannelBasicInfoFragment): string | undefined { if (isRollout(channelInfo)) { const updatedRolloutInfo = getRolloutInfo(channelInfo); if (isConstrainedRolloutInfo(updatedRolloutInfo)) { @@ -155,7 +157,7 @@ export class NonInteractiveRollout implements EASUpdateAction { return undefined; } - async getChannelObjectAsync( + private async getChannelObjectAsync( ctx: EASUpdateContext, { channelName, runtimeVersion }: { channelName: string; runtimeVersion?: string } ): Promise { diff --git a/packages/eas-cli/src/rollout/actions/RolloutMainMenu.ts b/packages/eas-cli/src/rollout/actions/RolloutMainMenu.ts index 0a5a46231e..5fb9d0eff9 100644 --- a/packages/eas-cli/src/rollout/actions/RolloutMainMenu.ts +++ b/packages/eas-cli/src/rollout/actions/RolloutMainMenu.ts @@ -54,7 +54,7 @@ export class RolloutMainMenu implements EASUpdateAction { await this.runActionAsync(ctx, menuOption); } - async runActionAsync(ctx: EASUpdateContext, menuAction: MainMenuActions): Promise { + private async runActionAsync(ctx: EASUpdateContext, menuAction: MainMenuActions): Promise { const { channelName } = this.options; switch (menuAction) { case MainMenuActions.CREATE_NEW: { @@ -87,13 +87,15 @@ export class RolloutMainMenu implements EASUpdateAction { } } - async selectRolloutAsync(ctx: EASUpdateContext): Promise { + private async selectRolloutAsync( + ctx: EASUpdateContext + ): Promise { const selectRollout = new SelectRollout(); const channelInfo = await selectRollout.runAsync(ctx); return channelInfo; } - async selectChannelToRolloutAsync( + private async selectChannelToRolloutAsync( ctx: EASUpdateContext ): Promise { let hasSomeChannel = false; @@ -113,7 +115,7 @@ export class RolloutMainMenu implements EASUpdateAction { return channelInfo; } - async resolveChannelNameAsync( + private async resolveChannelNameAsync( ctx: EASUpdateContext, channelName: string ): Promise { @@ -124,7 +126,7 @@ export class RolloutMainMenu implements EASUpdateAction { }); } - toMainMenuAction(action: RolloutActions): MainMenuActions { + private toMainMenuAction(action: RolloutActions): MainMenuActions { if (action === MainMenuActions.CREATE_NEW) { return MainMenuActions.CREATE_NEW; } else if ( @@ -138,7 +140,7 @@ export class RolloutMainMenu implements EASUpdateAction { } } - async promptMenuActionAsync(): Promise { + private async promptMenuActionAsync(): Promise { const menuOptions = [MainMenuActions.CREATE_NEW, MainMenuActions.MANAGE_EXISTING]; const { menuOption: selectedMenuOption } = await promptAsync({ type: 'select', diff --git a/packages/eas-cli/src/rollout/actions/SelectRuntime.ts b/packages/eas-cli/src/rollout/actions/SelectRuntime.ts index 632268b0a0..ba0ba27d8d 100644 --- a/packages/eas-cli/src/rollout/actions/SelectRuntime.ts +++ b/packages/eas-cli/src/rollout/actions/SelectRuntime.ts @@ -27,7 +27,7 @@ export class SelectRuntime implements EASUpdateAction { : `runtime`; } - warnNoRuntime(): void { + private warnNoRuntime(): void { if (this.options.anotherBranchToIntersectRuntimesBy) { const intersectBranchName = this.options.anotherBranchToIntersectRuntimesBy.name; Log.warn( @@ -42,7 +42,7 @@ export class SelectRuntime implements EASUpdateAction { } } - formatCantFindRuntime(): string { + private formatCantFindRuntime(): string { return `🕵️ Not finding the update you were looking for? ${learnMore( 'https://expo.fyi/eas-update-rollouts' )}`; @@ -104,7 +104,7 @@ export class SelectRuntime implements EASUpdateAction { return selectedRuntime.version; } - async getNewestRuntimeAsync( + private async getNewestRuntimeAsync( graphqlClient: ExpoGraphqlClient, { appId, @@ -126,7 +126,7 @@ export class SelectRuntime implements EASUpdateAction { }); } - async displayLatestUpdateGroupAsync({ + private async displayLatestUpdateGroupAsync({ graphqlClient, appId, branchName, @@ -153,7 +153,7 @@ export class SelectRuntime implements EASUpdateAction { return formatRuntimeWithUpdateGroup(updateGroups[0], runtime, branchName); } - async selectRuntimesAsync( + private async selectRuntimesAsync( graphqlClient: ExpoGraphqlClient, { appId, diff --git a/packages/eas-cli/src/update/getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync.ts b/packages/eas-cli/src/update/getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync.ts index 09f121d2bc..8c2d0c414b 100644 --- a/packages/eas-cli/src/update/getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync.ts +++ b/packages/eas-cli/src/update/getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync.ts @@ -34,7 +34,7 @@ export async function getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync( throw error; } - const { branchId } = await ensureBranchExistsAsync(graphqlClient, { + const { branch } = await ensureBranchExistsAsync(graphqlClient, { appId: projectId, branchName: channelName, }); @@ -43,7 +43,7 @@ export async function getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync( } = await createChannelOnAppAsync(graphqlClient, { appId: projectId, channelName, - branchId, + branchId: branch.id, }); if (!newChannel) { @@ -52,7 +52,7 @@ export async function getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync( ); } - branchInfo = { branchId, branchName: channelName }; + branchInfo = { branchId: branch.id, branchName: channelName }; } return branchInfo;