Skip to content

Commit

Permalink
[ENG-14180][eas-cli] rename with-as-environment-variables-set eas upd…
Browse files Browse the repository at this point in the history
…ate flag to environment (#2692)

<!-- If this PR requires a changelog entry, add it by commenting the PR with the command `/changelog-entry [breaking-change|new-feature|bug-fix|chore] [message]`. -->
<!-- You can skip the changelog check by labeling the PR with "no changelog". -->

# Why

During dogfooding it came out that this flag is too long and confusing

# How

Just use `environment`

# Test Plan

Tests, types
  • Loading branch information
szdziedzic authored Nov 15, 2024
1 parent df13e04 commit 26fd7a7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 20 deletions.
4 changes: 2 additions & 2 deletions packages/eas-cli/src/commandUtils/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ export const EasJsonOnlyFlag = {
}),
};

export const WithEasEnvironmentVariablesSetFlag = {
'with-eas-environment-variables-set': Flags.enum<EnvironmentVariableEnvironment | null>({
export const EasUpdateEnvironmentFlag = {
environment: Flags.enum<EnvironmentVariableEnvironment | null>({
description:
'Environment to use the server-side defined EAS environment variables for during command execution.',
options: mapToLowercase(Object.values(EnvironmentVariableEnvironment)),
Expand Down
9 changes: 3 additions & 6 deletions packages/eas-cli/src/commands/update/configure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import chalk from 'chalk';

import { easJsonExistsAsync } from '../../build/configure';
import EasCommand from '../../commandUtils/EasCommand';
import {
EASNonInteractiveFlag,
WithEasEnvironmentVariablesSetFlag,
} from '../../commandUtils/flags';
import { EASNonInteractiveFlag, EasUpdateEnvironmentFlag } from '../../commandUtils/flags';
import Log, { learnMore } from '../../log';
import { RequestedPlatform } from '../../platform';
import {
Expand All @@ -24,7 +21,7 @@ export default class UpdateConfigure extends EasCommand {
options: Object.values(RequestedPlatform),
default: RequestedPlatform.All,
}),
...WithEasEnvironmentVariablesSetFlag,
...EasUpdateEnvironmentFlag,
...EASNonInteractiveFlag,
};

Expand All @@ -41,7 +38,7 @@ export default class UpdateConfigure extends EasCommand {
vcsClient,
} = await this.getContextAsync(UpdateConfigure, {
nonInteractive: flags['non-interactive'],
withServerSideEnvironment: flags['with-eas-environment-variables-set'],
withServerSideEnvironment: flags['environment'],
});

Log.log(
Expand Down
21 changes: 9 additions & 12 deletions packages/eas-cli/src/commands/update/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import { transformFingerprintSource } from '../../build/graphql';
import { ensureRepoIsCleanAsync } from '../../build/utils/repository';
import { getUpdateGroupUrl } from '../../build/utils/url';
import EasCommand from '../../commandUtils/EasCommand';
import {
EasNonInteractiveAndJsonFlags,
WithEasEnvironmentVariablesSetFlag,
} from '../../commandUtils/flags';
import { EasNonInteractiveAndJsonFlags, EasUpdateEnvironmentFlag } from '../../commandUtils/flags';
import { getPaginatedQueryOptions } from '../../commandUtils/pagination';
import fetch from '../../fetch';
import {
Expand Down Expand Up @@ -75,7 +72,7 @@ type RawUpdateFlags = {
'rollout-percentage'?: number;
'non-interactive': boolean;
json: boolean;
'with-eas-environment-variables-set': EnvironmentVariableEnvironment | null;
environment: EnvironmentVariableEnvironment | null;
};

type UpdateFlags = {
Expand All @@ -92,7 +89,7 @@ type UpdateFlags = {
rolloutPercentage?: number;
json: boolean;
nonInteractive: boolean;
withEasEnvironmentVariablesSet: EnvironmentVariableEnvironment | null;
environment: EnvironmentVariableEnvironment | null;
};

export default class UpdatePublish extends EasCommand {
Expand Down Expand Up @@ -150,7 +147,7 @@ export default class UpdatePublish extends EasCommand {
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,
}),
...WithEasEnvironmentVariablesSetFlag,
...EasUpdateEnvironmentFlag,
...EasNonInteractiveAndJsonFlags,
};

Expand Down Expand Up @@ -178,7 +175,7 @@ export default class UpdatePublish extends EasCommand {
branchName: branchNameArg,
emitMetadata,
rolloutPercentage,
withEasEnvironmentVariablesSet,
environment,
} = this.sanitizeFlags(rawFlags);

const {
Expand All @@ -189,7 +186,7 @@ export default class UpdatePublish extends EasCommand {
getServerSideEnvironmentVariablesAsync,
} = await this.getContextAsync(UpdatePublish, {
nonInteractive,
withServerSideEnvironment: withEasEnvironmentVariablesSet,
withServerSideEnvironment: environment,
});

if (jsonFlag) {
Expand Down Expand Up @@ -249,7 +246,7 @@ export default class UpdatePublish extends EasCommand {
platformFlag: requestedPlatform,
clearCache,
extraEnv: {
...(withEasEnvironmentVariablesSet
...(environment
? { ...(await getServerSideEnvironmentVariablesAsync()), EXPO_NO_DOTENV: '1' }
: {}),
},
Expand Down Expand Up @@ -655,14 +652,14 @@ export default class UpdatePublish extends EasCommand {
updateMessage,
inputDir: flags['input-dir'],
skipBundler,
clearCache: flags['clear-cache'] ? true : !!flags['with-eas-environment-variables-set'],
clearCache: flags['clear-cache'] ? true : !!flags['environment'],
platform: flags.platform,
privateKeyPath: flags['private-key-path'],
rolloutPercentage: flags['rollout-percentage'],
nonInteractive,
emitMetadata,
json: flags.json ?? false,
withEasEnvironmentVariablesSet: flags['with-eas-environment-variables-set'],
environment: flags['environment'],
};
}
}

0 comments on commit 26fd7a7

Please sign in to comment.