Skip to content

Commit

Permalink
Simplify (imo)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjchmiela committed Nov 28, 2023
1 parent e34f030 commit aae9bab
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions packages/eas-cli/src/build/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Metadata,
Workflow,
} from '@expo/eas-build-job';
import assert from 'assert';

import {
BuildCredentialsSource,
Expand Down Expand Up @@ -91,16 +92,16 @@ export function transformIosEnterpriseProvisioning(
}
}

const buildModeToGraphQLBuildMode: Record<BuildMode, GraphQLBuildMode> = {
[BuildMode.BUILD]: GraphQLBuildMode.Build,
[BuildMode.CUSTOM]: GraphQLBuildMode.Custom,
[BuildMode.RESIGN]: GraphQLBuildMode.Resign,
};

export function transformBuildMode(buildMode: BuildMode): GraphQLBuildMode {
if (buildMode === 'build') {
return GraphQLBuildMode.Build;
} else if (buildMode === 'resign') {
return GraphQLBuildMode.Resign;
} else if (buildMode === 'custom') {
return GraphQLBuildMode.Custom;
} else {
throw new Error(`Unsupported build mode: ${buildMode}`);
}
const graphQLBuildMode = buildModeToGraphQLBuildMode[buildMode];
assert(graphQLBuildMode, `Unsupported build mode: ${buildMode}`);
return graphQLBuildMode;
}

export function transformBuildTrigger(buildTrigger: BuildTrigger): GraphQLBuildTrigger {
Expand Down

0 comments on commit aae9bab

Please sign in to comment.