eas-cli 13.2.3 → 13.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +359 -162
  2. package/build/build/build.js +3 -3
  3. package/build/build/evaluateConfigWithEnvVarsAsync.js +18 -2
  4. package/build/build/utils/url.d.ts +1 -0
  5. package/build/build/utils/url.js +5 -1
  6. package/build/commandUtils/flags.d.ts +5 -4
  7. package/build/commandUtils/flags.js +6 -8
  8. package/build/commands/env/create.d.ts +6 -6
  9. package/build/commands/env/create.js +27 -28
  10. package/build/commands/env/delete.d.ts +5 -5
  11. package/build/commands/env/delete.js +15 -13
  12. package/build/commands/env/exec.d.ts +0 -1
  13. package/build/commands/env/exec.js +1 -2
  14. package/build/commands/env/get.d.ts +5 -5
  15. package/build/commands/env/get.js +16 -13
  16. package/build/commands/env/link.d.ts +1 -1
  17. package/build/commands/env/link.js +12 -13
  18. package/build/commands/env/list.d.ts +5 -5
  19. package/build/commands/env/list.js +14 -12
  20. package/build/commands/env/pull.d.ts +1 -2
  21. package/build/commands/env/pull.js +8 -9
  22. package/build/commands/env/push.d.ts +1 -2
  23. package/build/commands/env/push.js +9 -10
  24. package/build/commands/env/unlink.d.ts +1 -1
  25. package/build/commands/env/unlink.js +11 -10
  26. package/build/commands/env/update.d.ts +6 -6
  27. package/build/commands/env/update.js +18 -15
  28. package/build/commands/secret/create.d.ts +1 -0
  29. package/build/commands/secret/create.js +3 -0
  30. package/build/commands/secret/delete.d.ts +1 -0
  31. package/build/commands/secret/delete.js +3 -0
  32. package/build/commands/secret/list.d.ts +1 -0
  33. package/build/commands/secret/list.js +3 -0
  34. package/build/commands/secret/push.d.ts +1 -0
  35. package/build/commands/secret/push.js +3 -0
  36. package/build/commands/update/index.js +19 -2
  37. package/build/commands/workflow/create.d.ts +18 -0
  38. package/build/commands/workflow/create.js +100 -0
  39. package/build/commands/workflow/run.d.ts +0 -2
  40. package/build/commands/workflow/run.js +25 -6
  41. package/build/commands/workflow/validate.d.ts +9 -1
  42. package/build/commands/workflow/validate.js +47 -50
  43. package/build/graphql/generated.d.ts +199 -28
  44. package/build/graphql/generated.js +10 -1
  45. package/build/graphql/mutations/EnvironmentVariableMutation.d.ts +1 -0
  46. package/build/graphql/mutations/WorkflowRevisionMutation.d.ts +33 -0
  47. package/build/graphql/mutations/WorkflowRevisionMutation.js +32 -0
  48. package/build/graphql/types/Update.js +9 -0
  49. package/build/project/publish.d.ts +23 -1
  50. package/build/project/publish.js +71 -11
  51. package/build/project/resolveRuntimeVersionAsync.d.ts +2 -0
  52. package/build/project/resolveRuntimeVersionAsync.js +4 -0
  53. package/build/update/republish.js +19 -0
  54. package/build/utils/expodash/mapMapAsync.d.ts +1 -0
  55. package/build/utils/expodash/mapMapAsync.js +12 -0
  56. package/build/utils/fingerprintCli.d.ts +21 -3
  57. package/build/utils/fingerprintCli.js +62 -13
  58. package/build/utils/prompts.d.ts +1 -1
  59. package/build/utils/prompts.js +1 -1
  60. package/build/utils/workflowFile.d.ts +16 -0
  61. package/build/utils/workflowFile.js +64 -0
  62. package/oclif.manifest.json +84 -52
  63. package/package.json +10 -4
@@ -434,7 +434,7 @@ function formatAccountBillingUrl(accountName) {
434
434
  }
435
435
  async function computeAndMaybeUploadRuntimeAndFingerprintMetadataAsync(ctx) {
436
436
  const runtimeAndFingerprintMetadata = await computeAndMaybeUploadFingerprintFromExpoUpdatesAsync(ctx);
437
- if (!runtimeAndFingerprintMetadata?.fingerprint) {
437
+ if (!runtimeAndFingerprintMetadata?.fingerprintHash) {
438
438
  const fingerprint = await computeAndMaybeUploadFingerprintWithoutExpoUpdatesAsync(ctx);
439
439
  return {
440
440
  ...runtimeAndFingerprintMetadata,
@@ -478,13 +478,13 @@ async function computeAndMaybeUploadFingerprintFromExpoUpdatesAsync(ctx) {
478
478
  return {
479
479
  runtimeVersion: uploadedFingerprint.hash,
480
480
  fingerprintSource: uploadedFingerprint.fingerprintSource,
481
- fingerprint: resolvedRuntimeVersion.fingerprint,
481
+ fingerprintHash: resolvedRuntimeVersion.fingerprintHash ?? undefined,
482
482
  };
483
483
  }
484
484
  async function computeAndMaybeUploadFingerprintWithoutExpoUpdatesAsync(ctx, { debug } = {}) {
485
485
  const fingerprint = await (0, fingerprintCli_1.createFingerprintAsync)(ctx.projectDir, {
486
486
  workflow: ctx.workflow,
487
- platform: ctx.platform,
487
+ platforms: [ctx.platform],
488
488
  env: ctx.env,
489
489
  });
490
490
  if (!fingerprint) {
@@ -26,8 +26,9 @@ async function evaluateConfigWithEnvVarsAsync({ buildProfile, buildProfileName,
26
26
  }
27
27
  exports.evaluateConfigWithEnvVarsAsync = evaluateConfigWithEnvVarsAsync;
28
28
  async function resolveEnvVarsAsync({ buildProfile, buildProfileName, graphqlClient, projectId, }) {
29
- const environment = buildProfile.environment?.toUpperCase() ?? process.env.EAS_CURRENT_ENVIRONMENT;
30
- if (!environment || !isEnvironment(environment)) {
29
+ const environment = buildProfile.environment?.toUpperCase() ??
30
+ resolveSuggestedEnvironmentForBuildProfileConfiguration(buildProfile);
31
+ if (!isEnvironment(environment)) {
31
32
  log_1.default.log(`Loaded "env" configuration for the "${buildProfileName}" profile: ${buildProfile.env && Object.keys(buildProfile.env).length > 0
32
33
  ? Object.keys(buildProfile.env).join(', ')
33
34
  : 'no environment variables specified'}. ${(0, log_1.learnMore)('https://docs.expo.dev/build-reference/variables/')}`);
@@ -68,3 +69,18 @@ async function resolveEnvVarsAsync({ buildProfile, buildProfileName, graphqlClie
68
69
  return { ...buildProfile.env };
69
70
  }
70
71
  }
72
+ function resolveSuggestedEnvironmentForBuildProfileConfiguration(buildProfile) {
73
+ const setEnvironmentMessage = 'Set the "environment" field in the build profile if you want to specify the environment manually.';
74
+ if (buildProfile.distribution === 'store') {
75
+ log_1.default.log(`We detected that you are building for the "store" distribution. Resolving the environment for environment variables used during the build to "production". ${setEnvironmentMessage}`);
76
+ return generated_1.EnvironmentVariableEnvironment.Production;
77
+ }
78
+ else {
79
+ if (buildProfile.developmentClient) {
80
+ log_1.default.log(`We detected that you are building the development client. Resolving the environment for environment variables used during the build to "development". ${setEnvironmentMessage}`);
81
+ return generated_1.EnvironmentVariableEnvironment.Development;
82
+ }
83
+ log_1.default.log(`We detected that you are building for the "internal" distribution. Resolving the environment for environment variables used during the build to "preview". ${setEnvironmentMessage}`);
84
+ return generated_1.EnvironmentVariableEnvironment.Preview;
85
+ }
86
+ }
@@ -5,3 +5,4 @@ export declare function getArtifactUrl(artifactId: string): string;
5
5
  export declare function getInternalDistributionInstallUrl(build: BuildFragment): string;
6
6
  export declare function getUpdateGroupUrl(accountName: string, projectName: string, updateGroupId: string): string;
7
7
  export declare function getWorkflowRunUrl(accountName: string, projectName: string, workflowRunId: string): string;
8
+ export declare function getProjectGitHubSettingsUrl(accountName: string, projectName: string): string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getWorkflowRunUrl = exports.getUpdateGroupUrl = exports.getInternalDistributionInstallUrl = exports.getArtifactUrl = exports.getBuildLogsUrl = exports.getProjectDashboardUrl = void 0;
3
+ exports.getProjectGitHubSettingsUrl = exports.getWorkflowRunUrl = exports.getUpdateGroupUrl = exports.getInternalDistributionInstallUrl = exports.getArtifactUrl = exports.getBuildLogsUrl = exports.getProjectDashboardUrl = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const assert_1 = tslib_1.__importDefault(require("assert"));
6
6
  const api_1 = require("../../api");
@@ -37,3 +37,7 @@ function getWorkflowRunUrl(accountName, projectName, workflowRunId) {
37
37
  return new URL(`/accounts/${encodeURIComponent(accountName)}/projects/${encodeURIComponent(projectName)}/workflows/${workflowRunId}`, (0, api_1.getExpoWebsiteBaseUrl)()).toString();
38
38
  }
39
39
  exports.getWorkflowRunUrl = getWorkflowRunUrl;
40
+ function getProjectGitHubSettingsUrl(accountName, projectName) {
41
+ return new URL(`/accounts/${encodeURIComponent(accountName)}/projects/${encodeURIComponent(projectName)}/github`, (0, api_1.getExpoWebsiteBaseUrl)()).toString();
42
+ }
43
+ exports.getProjectGitHubSettingsUrl = getProjectGitHubSettingsUrl;
@@ -1,4 +1,4 @@
1
- import { EnvironmentVariableEnvironment, EnvironmentVariableScope } from '../graphql/generated';
1
+ import { EnvironmentVariableEnvironment } from '../graphql/generated';
2
2
  declare function upperCaseAsync<T>(input: string): Promise<T>;
3
3
  export declare const EasNonInteractiveAndJsonFlags: {
4
4
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
@@ -19,10 +19,11 @@ export declare const EASVariableFormatFlag: {
19
19
  format: import("@oclif/core/lib/interfaces").OptionFlag<string>;
20
20
  };
21
21
  export declare const EASVariableVisibilityFlag: {
22
- visibility: import("@oclif/core/lib/interfaces").OptionFlag<"plaintext" | "encrypted" | "sensitive" | undefined>;
22
+ visibility: import("@oclif/core/lib/interfaces").OptionFlag<"secret" | "plaintext" | "sensitive" | undefined>;
23
23
  };
24
- export declare const EASVariableScopeFlag: {
25
- scope: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableScope>;
24
+ export type EASEnvironmentVariableScopeFlagValue = 'project' | 'account';
25
+ export declare const EASEnvironmentVariableScopeFlag: {
26
+ scope: import("@oclif/core/lib/interfaces").OptionFlag<EASEnvironmentVariableScopeFlagValue>;
26
27
  };
27
28
  export declare const EASNonInteractiveFlag: {
28
29
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EasUpdateEnvironmentFlag = exports.EasJsonOnlyFlag = exports.EASNonInteractiveFlag = exports.EASVariableScopeFlag = exports.EASVariableVisibilityFlag = exports.EASVariableFormatFlag = exports.EASMultiEnvironmentFlag = exports.EASEnvironmentFlag = exports.EasEnvironmentFlagParameters = exports.EasNonInteractiveAndJsonFlags = void 0;
3
+ exports.EasUpdateEnvironmentFlag = exports.EasJsonOnlyFlag = exports.EASNonInteractiveFlag = exports.EASEnvironmentVariableScopeFlag = exports.EASVariableVisibilityFlag = exports.EASVariableFormatFlag = exports.EASMultiEnvironmentFlag = exports.EASEnvironmentFlag = exports.EasEnvironmentFlagParameters = exports.EasNonInteractiveAndJsonFlags = void 0;
4
4
  const core_1 = require("@oclif/core");
5
5
  const generated_1 = require("../graphql/generated");
6
6
  // NOTE: not exactly true, but, provided mapToLowercase and upperCaseAsync
@@ -48,15 +48,14 @@ exports.EASVariableFormatFlag = {
48
48
  exports.EASVariableVisibilityFlag = {
49
49
  visibility: core_1.Flags.enum({
50
50
  description: 'Visibility of the variable',
51
- options: ['plaintext', 'sensitive', 'encrypted'],
51
+ options: ['plaintext', 'sensitive', 'secret'],
52
52
  }),
53
53
  };
54
- exports.EASVariableScopeFlag = {
54
+ exports.EASEnvironmentVariableScopeFlag = {
55
55
  scope: core_1.Flags.enum({
56
56
  description: 'Scope for the variable',
57
- options: mapToLowercase([generated_1.EnvironmentVariableScope.Shared, generated_1.EnvironmentVariableScope.Project]),
58
- parse: upperCaseAsync,
59
- default: generated_1.EnvironmentVariableScope.Project,
57
+ options: ['project', 'account'],
58
+ default: 'project',
60
59
  }),
61
60
  };
62
61
  exports.EASNonInteractiveFlag = {
@@ -71,11 +70,10 @@ exports.EasJsonOnlyFlag = {
71
70
  };
72
71
  exports.EasUpdateEnvironmentFlag = {
73
72
  environment: core_1.Flags.enum({
74
- description: 'Environment to use the server-side defined EAS environment variables for during command execution.',
73
+ description: 'Environment to use for the server-side defined EAS environment variables during command execution.',
75
74
  options: mapToLowercase(Object.values(generated_1.EnvironmentVariableEnvironment)),
76
75
  parse: upperCaseAsync,
77
76
  required: false,
78
- hidden: true,
79
77
  default: null,
80
78
  }),
81
79
  };
@@ -1,8 +1,8 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
- import { EnvironmentVariableEnvironment, EnvironmentVariableScope } from '../../graphql/generated';
3
- export default class EnvironmentVariableCreate extends EasCommand {
2
+ import { EASEnvironmentVariableScopeFlagValue } from '../../commandUtils/flags';
3
+ import { EnvironmentVariableEnvironment } from '../../graphql/generated';
4
+ export default class EnvCreate extends EasCommand {
4
5
  static description: string;
5
- static hidden: boolean;
6
6
  static args: {
7
7
  name: string;
8
8
  description: string;
@@ -11,8 +11,8 @@ export default class EnvironmentVariableCreate extends EasCommand {
11
11
  static flags: {
12
12
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
13
  environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment[] | undefined>;
14
- scope: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableScope>;
15
- visibility: import("@oclif/core/lib/interfaces").OptionFlag<"plaintext" | "encrypted" | "sensitive" | undefined>;
14
+ scope: import("@oclif/core/lib/interfaces").OptionFlag<EASEnvironmentVariableScopeFlagValue>;
15
+ visibility: import("@oclif/core/lib/interfaces").OptionFlag<"secret" | "plaintext" | "sensitive" | undefined>;
16
16
  name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
17
17
  value: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
18
18
  link: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
@@ -27,5 +27,5 @@ export default class EnvironmentVariableCreate extends EasCommand {
27
27
  runAsync(): Promise<void>;
28
28
  private promptForOverwriteAsync;
29
29
  private promptForMissingFlagsAsync;
30
- private validateFlags;
30
+ private sanitizeFlags;
31
31
  }
@@ -16,10 +16,10 @@ const projectUtils_1 = require("../../project/projectUtils");
16
16
  const prompts_1 = require("../../prompts");
17
17
  const prompts_2 = require("../../utils/prompts");
18
18
  const variableUtils_1 = require("../../utils/variableUtils");
19
- class EnvironmentVariableCreate extends EasCommand_1.default {
19
+ class EnvCreate extends EasCommand_1.default {
20
20
  async runAsync() {
21
21
  const { args, flags } = await this.parse(_a);
22
- const validatedFlags = this.validateFlags(flags);
22
+ const validatedFlags = this.sanitizeFlags(flags);
23
23
  const { name, value, scope, 'non-interactive': nonInteractive, environment: environments, visibility, link, force, type, fileName, } = await this.promptForMissingFlagsAsync(validatedFlags, args);
24
24
  const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
25
25
  nonInteractive,
@@ -49,10 +49,10 @@ class EnvironmentVariableCreate extends EasCommand_1.default {
49
49
  await this.promptForOverwriteAsync({
50
50
  nonInteractive,
51
51
  force,
52
- message: `Shared variable with ${name} name already exists on this account.`,
52
+ message: `Account-wide variable with ${name} name already exists on this account.`,
53
53
  suggestion: 'Do you want to unlink it first?',
54
54
  });
55
- log_1.default.withTick(`Unlinking shared variable ${chalk_1.default.bold(name)} on project ${chalk_1.default.bold(projectDisplayName)}.`);
55
+ log_1.default.withTick(`Unlinking account-wide variable ${chalk_1.default.bold(name)} on project ${chalk_1.default.bold(projectDisplayName)}.`);
56
56
  await (0, variableUtils_1.performForEnvironmentsAsync)(environments, async (environment) => {
57
57
  await EnvironmentVariableMutation_1.EnvironmentVariableMutation.unlinkSharedEnvironmentVariableAsync(graphqlClient, existingVariable.id, projectId, environment);
58
58
  });
@@ -92,8 +92,8 @@ class EnvironmentVariableCreate extends EasCommand_1.default {
92
92
  overwrite = true;
93
93
  }
94
94
  else {
95
- throw new Error(`Shared variable with ${name} name already exists on this account.\n` +
96
- `Use a different name or delete the existing variable on website or by using eas env:delete --name ${name} --scope shared command.`);
95
+ throw new Error(`Account-wide variable with ${name} name already exists on this account.\n` +
96
+ `Use a different name or delete the existing variable on website or by using the "eas env:delete --name ${name} --scope account" command.`);
97
97
  }
98
98
  }
99
99
  const variable = overwrite && existingVariable
@@ -110,6 +110,7 @@ class EnvironmentVariableCreate extends EasCommand_1.default {
110
110
  value,
111
111
  visibility,
112
112
  environments,
113
+ isGlobal: true, // TODO: every account-wide variable is global for now so it's not user facing
113
114
  type: type ?? generated_1.EnvironmentSecretType.String,
114
115
  }, ownerAccount.id);
115
116
  if (!variable) {
@@ -117,11 +118,11 @@ class EnvironmentVariableCreate extends EasCommand_1.default {
117
118
  }
118
119
  log_1.default.withTick(`Created a new variable ${chalk_1.default.bold(name)} on account ${chalk_1.default.bold(ownerAccount.name)}.`);
119
120
  if (link) {
120
- log_1.default.withTick(`Linking shared variable ${chalk_1.default.bold(name)} to project ${chalk_1.default.bold(projectDisplayName)}.`);
121
+ log_1.default.withTick(`Linking account-wide variable ${chalk_1.default.bold(name)} to project ${chalk_1.default.bold(projectDisplayName)}.`);
121
122
  await (0, variableUtils_1.performForEnvironmentsAsync)(environments, async (environment) => {
122
123
  await EnvironmentVariableMutation_1.EnvironmentVariableMutation.linkSharedEnvironmentVariableAsync(graphqlClient, variable.id, projectId, environment);
123
124
  });
124
- log_1.default.withTick(`Linked shared variable ${chalk_1.default.bold(name)} to project ${chalk_1.default.bold(projectDisplayName)}.`);
125
+ log_1.default.withTick(`Linked account-wide variable ${chalk_1.default.bold(name)} to project ${chalk_1.default.bold(projectDisplayName)}.`);
125
126
  }
126
127
  }
127
128
  }
@@ -196,37 +197,34 @@ class EnvironmentVariableCreate extends EasCommand_1.default {
196
197
  visibility: newVisibility,
197
198
  link: rest.link ?? false,
198
199
  force: rest.force ?? false,
199
- scope: rest.scope ?? generated_1.EnvironmentVariableScope.Project,
200
200
  'non-interactive': nonInteractive,
201
201
  type: newType,
202
202
  fileName,
203
203
  ...rest,
204
204
  };
205
205
  }
206
- validateFlags(flags) {
207
- if (flags.scope !== generated_1.EnvironmentVariableScope.Shared && flags.link) {
208
- throw new Error(`Unexpected argument: --link can only be used when creating shared variables`);
206
+ sanitizeFlags(flags) {
207
+ if (flags.scope !== 'account' && flags.link) {
208
+ throw new Error(`Unexpected argument: --link can only be used when creating account-wide variables`);
209
209
  }
210
- if (flags.scope === generated_1.EnvironmentVariableScope.Shared &&
211
- flags.environment &&
212
- !flags.link &&
213
- flags['non-interactive']) {
214
- throw new Error('Unexpected argument: --environment in non-interactive mode can only be used with --link flag.');
215
- }
216
- return flags;
210
+ return {
211
+ ...flags,
212
+ scope: flags.scope === 'account'
213
+ ? generated_1.EnvironmentVariableScope.Shared
214
+ : generated_1.EnvironmentVariableScope.Project,
215
+ };
217
216
  }
218
217
  }
219
- _a = EnvironmentVariableCreate;
220
- EnvironmentVariableCreate.description = 'create an environment variable on the current project or owner account';
221
- EnvironmentVariableCreate.hidden = true;
222
- EnvironmentVariableCreate.args = [
218
+ _a = EnvCreate;
219
+ EnvCreate.description = 'create an environment variable for the current project or account';
220
+ EnvCreate.args = [
223
221
  {
224
222
  name: 'environment',
225
223
  description: "Environment to create the variable in. One of 'production', 'preview', or 'development'.",
226
224
  required: false,
227
225
  },
228
226
  ];
229
- EnvironmentVariableCreate.flags = {
227
+ EnvCreate.flags = {
230
228
  name: core_1.Flags.string({
231
229
  description: 'Name of the variable',
232
230
  }),
@@ -234,7 +232,8 @@ EnvironmentVariableCreate.flags = {
234
232
  description: 'Text value or the variable',
235
233
  }),
236
234
  link: core_1.Flags.boolean({
237
- description: 'Link shared variable to the current project',
235
+ description: 'Link account-wide variable to the current project',
236
+ hidden: true, // every account-wide variable is global for now so it's not user facing
238
237
  }),
239
238
  force: core_1.Flags.boolean({
240
239
  description: 'Overwrite existing variable',
@@ -245,13 +244,13 @@ EnvironmentVariableCreate.flags = {
245
244
  options: ['string', 'file'],
246
245
  }),
247
246
  ...flags_1.EASVariableVisibilityFlag,
248
- ...flags_1.EASVariableScopeFlag,
247
+ ...flags_1.EASEnvironmentVariableScopeFlag,
249
248
  ...flags_1.EASMultiEnvironmentFlag,
250
249
  ...flags_1.EASNonInteractiveFlag,
251
250
  };
252
- EnvironmentVariableCreate.contextDefinition = {
251
+ EnvCreate.contextDefinition = {
253
252
  ..._a.ContextOptions.ProjectId,
254
253
  ..._a.ContextOptions.Analytics,
255
254
  ..._a.ContextOptions.LoggedIn,
256
255
  };
257
- exports.default = EnvironmentVariableCreate;
256
+ exports.default = EnvCreate;
@@ -1,11 +1,11 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
- import { EnvironmentVariableEnvironment, EnvironmentVariableScope } from '../../graphql/generated';
3
- export default class EnvironmentVariableDelete extends EasCommand {
2
+ import { EASEnvironmentVariableScopeFlagValue } from '../../commandUtils/flags';
3
+ import { EnvironmentVariableEnvironment } from '../../graphql/generated';
4
+ export default class EnvDelete extends EasCommand {
4
5
  static description: string;
5
- static hidden: boolean;
6
6
  static flags: {
7
7
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
- scope: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableScope>;
8
+ scope: import("@oclif/core/lib/interfaces").OptionFlag<EASEnvironmentVariableScopeFlagValue>;
9
9
  'variable-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
10
10
  'variable-environment': import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment | undefined>;
11
11
  };
@@ -19,5 +19,5 @@ export default class EnvironmentVariableDelete extends EasCommand {
19
19
  projectId: import("../../commandUtils/context/ProjectIdContextField").ProjectIdContextField;
20
20
  };
21
21
  runAsync(): Promise<void>;
22
- private validateInputs;
22
+ private sanitizeInputs;
23
23
  }
@@ -13,10 +13,10 @@ const EnvironmentVariablesQuery_1 = require("../../graphql/queries/EnvironmentVa
13
13
  const log_1 = tslib_1.__importDefault(require("../../log"));
14
14
  const prompts_1 = require("../../prompts");
15
15
  const variableUtils_1 = require("../../utils/variableUtils");
16
- class EnvironmentVariableDelete extends EasCommand_1.default {
16
+ class EnvDelete extends EasCommand_1.default {
17
17
  async runAsync() {
18
18
  const { args, flags } = await this.parse(_a);
19
- const { 'variable-name': name, 'variable-environment': environment, 'non-interactive': nonInteractive, scope, } = this.validateInputs(flags, args);
19
+ const { 'variable-name': name, 'variable-environment': environment, 'non-interactive': nonInteractive, scope, } = this.sanitizeInputs(flags, args);
20
20
  const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
21
21
  nonInteractive,
22
22
  });
@@ -76,26 +76,28 @@ class EnvironmentVariableDelete extends EasCommand_1.default {
76
76
  await EnvironmentVariableMutation_1.EnvironmentVariableMutation.deleteAsync(graphqlClient, selectedVariable.id);
77
77
  log_1.default.withTick(`️Deleted variable ${selectedVariable.name}".`);
78
78
  }
79
- validateInputs(flags, { environment }) {
79
+ sanitizeInputs(flags, { environment }) {
80
80
  if (flags['non-interactive']) {
81
81
  if (!flags['variable-name']) {
82
82
  throw new Error(`Environment variable needs 'name' to be specified when running in non-interactive mode. Run the command with ${chalk_1.default.bold('--variable-name VARIABLE_NAME')} flag to fix the issue`);
83
83
  }
84
84
  }
85
+ const scope = flags.scope === 'account'
86
+ ? generated_1.EnvironmentVariableScope.Shared
87
+ : generated_1.EnvironmentVariableScope.Project;
85
88
  if (environment) {
86
89
  environment = environment.toUpperCase();
87
90
  if (!(0, variableUtils_1.isEnvironment)(environment)) {
88
91
  throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
89
92
  }
90
- return { ...flags, 'variable-environment': environment };
93
+ return { ...flags, 'variable-environment': environment, scope };
91
94
  }
92
- return flags;
95
+ return { ...flags, scope };
93
96
  }
94
97
  }
95
- _a = EnvironmentVariableDelete;
96
- EnvironmentVariableDelete.description = 'delete an environment variable by name';
97
- EnvironmentVariableDelete.hidden = true;
98
- EnvironmentVariableDelete.flags = {
98
+ _a = EnvDelete;
99
+ EnvDelete.description = 'delete an environment variable for the current project or account';
100
+ EnvDelete.flags = {
99
101
  'variable-name': core_1.Flags.string({
100
102
  description: 'Name of the variable to delete',
101
103
  }),
@@ -103,18 +105,18 @@ EnvironmentVariableDelete.flags = {
103
105
  ...flags_1.EasEnvironmentFlagParameters,
104
106
  description: 'Current environment of the variable to delete',
105
107
  }),
106
- ...flags_1.EASVariableScopeFlag,
108
+ ...flags_1.EASEnvironmentVariableScopeFlag,
107
109
  ...flags_1.EASNonInteractiveFlag,
108
110
  };
109
- EnvironmentVariableDelete.args = [
111
+ EnvDelete.args = [
110
112
  {
111
113
  name: 'environment',
112
114
  description: "Current environment of the variable to delete. One of 'production', 'preview', or 'development'.",
113
115
  required: false,
114
116
  },
115
117
  ];
116
- EnvironmentVariableDelete.contextDefinition = {
118
+ EnvDelete.contextDefinition = {
117
119
  ..._a.ContextOptions.ProjectId,
118
120
  ..._a.ContextOptions.LoggedIn,
119
121
  };
120
- exports.default = EnvironmentVariableDelete;
122
+ exports.default = EnvDelete;
@@ -1,7 +1,6 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class EnvExec extends EasCommand {
3
3
  static description: string;
4
- static hidden: boolean;
5
4
  static contextDefinition: {
6
5
  loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
7
6
  projectId: import("../../commandUtils/context/ProjectIdContextField").ProjectIdContextField;
@@ -107,8 +107,7 @@ class EnvExec extends EasCommand_1.default {
107
107
  }
108
108
  }
109
109
  _a = EnvExec;
110
- EnvExec.description = 'execute a bash command with environment variables from the selected environment';
111
- EnvExec.hidden = true;
110
+ EnvExec.description = 'execute a command with environment variables from the selected environment';
112
111
  EnvExec.contextDefinition = {
113
112
  ..._a.ContextOptions.ProjectId,
114
113
  ..._a.ContextOptions.LoggedIn,
@@ -1,8 +1,8 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
- import { EnvironmentVariableEnvironment, EnvironmentVariableScope } from '../../graphql/generated';
3
- export default class EnvironmentVariableGet extends EasCommand {
2
+ import { EASEnvironmentVariableScopeFlagValue } from '../../commandUtils/flags';
3
+ import { EnvironmentVariableEnvironment } from '../../graphql/generated';
4
+ export default class EnvGet extends EasCommand {
4
5
  static description: string;
5
- static hidden: boolean;
6
6
  static contextDefinition: {
7
7
  loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
8
8
  projectId: import("../../commandUtils/context/ProjectIdContextField").ProjectIdContextField;
@@ -14,11 +14,11 @@ export default class EnvironmentVariableGet extends EasCommand {
14
14
  }[];
15
15
  static flags: {
16
16
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
- scope: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableScope>;
17
+ scope: import("@oclif/core/lib/interfaces").OptionFlag<EASEnvironmentVariableScopeFlagValue>;
18
18
  format: import("@oclif/core/lib/interfaces").OptionFlag<string>;
19
19
  'variable-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
20
20
  'variable-environment': import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment | undefined>;
21
21
  };
22
22
  runAsync(): Promise<void>;
23
- private validateInputs;
23
+ private sanitizeInputs;
24
24
  }
@@ -11,10 +11,10 @@ const EnvironmentVariablesQuery_1 = require("../../graphql/queries/EnvironmentVa
11
11
  const log_1 = tslib_1.__importDefault(require("../../log"));
12
12
  const prompts_1 = require("../../utils/prompts");
13
13
  const variableUtils_1 = require("../../utils/variableUtils");
14
- class EnvironmentVariableGet extends EasCommand_1.default {
14
+ class EnvGet extends EasCommand_1.default {
15
15
  async runAsync() {
16
16
  const { args, flags } = await this.parse(_a);
17
- let { 'variable-environment': environment, 'variable-name': name, 'non-interactive': nonInteractive, format, scope, } = this.validateInputs(flags, args);
17
+ let { 'variable-environment': environment, 'variable-name': name, 'non-interactive': nonInteractive, format, scope, } = this.sanitizeInputs(flags, args);
18
18
  const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
19
19
  nonInteractive,
20
20
  });
@@ -53,7 +53,7 @@ class EnvironmentVariableGet extends EasCommand_1.default {
53
53
  log_1.default.log((0, variableUtils_1.formatVariable)(variable));
54
54
  }
55
55
  }
56
- validateInputs(flags, { environment }) {
56
+ sanitizeInputs(flags, { environment }) {
57
57
  if (flags['non-interactive']) {
58
58
  if (!flags['variable-name']) {
59
59
  throw new Error('Variable name is required. Run the command with --variable-name flag.');
@@ -68,34 +68,37 @@ class EnvironmentVariableGet extends EasCommand_1.default {
68
68
  if (environment && flags['variable-environment']) {
69
69
  throw new Error("You can't use both --variable-environment flag when environment is passed as an argument. Run `eas env:get --help` for more information.");
70
70
  }
71
+ const scope = flags.scope === 'account'
72
+ ? generated_1.EnvironmentVariableScope.Shared
73
+ : generated_1.EnvironmentVariableScope.Project;
71
74
  if (environment) {
72
75
  environment = environment.toUpperCase();
73
76
  if (!(0, variableUtils_1.isEnvironment)(environment)) {
74
77
  throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
75
78
  }
76
79
  return {
77
- 'variable-environment': environment,
78
80
  ...flags,
81
+ 'variable-environment': environment,
82
+ scope,
79
83
  };
80
84
  }
81
- return flags;
85
+ return { ...flags, scope };
82
86
  }
83
87
  }
84
- _a = EnvironmentVariableGet;
85
- EnvironmentVariableGet.description = 'get environment variable';
86
- EnvironmentVariableGet.hidden = true;
87
- EnvironmentVariableGet.contextDefinition = {
88
+ _a = EnvGet;
89
+ EnvGet.description = 'view an environment variable for the current project or account';
90
+ EnvGet.contextDefinition = {
88
91
  ..._a.ContextOptions.ProjectId,
89
92
  ..._a.ContextOptions.LoggedIn,
90
93
  };
91
- EnvironmentVariableGet.args = [
94
+ EnvGet.args = [
92
95
  {
93
96
  name: 'environment',
94
97
  description: "Current environment of the variable. One of 'production', 'preview', or 'development'.",
95
98
  required: false,
96
99
  },
97
100
  ];
98
- EnvironmentVariableGet.flags = {
101
+ EnvGet.flags = {
99
102
  'variable-name': core_1.Flags.string({
100
103
  description: 'Name of the variable',
101
104
  }),
@@ -104,10 +107,10 @@ EnvironmentVariableGet.flags = {
104
107
  description: 'Current environment of the variable',
105
108
  }),
106
109
  ...flags_1.EASVariableFormatFlag,
107
- ...flags_1.EASVariableScopeFlag,
110
+ ...flags_1.EASEnvironmentVariableScopeFlag,
108
111
  ...flags_1.EASNonInteractiveFlag,
109
112
  };
110
- exports.default = EnvironmentVariableGet;
113
+ exports.default = EnvGet;
111
114
  async function getVariablesAsync(graphqlClient, scope, projectId, name, environment) {
112
115
  if (!name) {
113
116
  throw new Error("Variable name is required. Run the command with '--variable-name VARIABLE_NAME' flag.");
@@ -1,6 +1,6 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
2
  import { EnvironmentVariableEnvironment } from '../../graphql/generated';
3
- export default class EnvironmentVariableLink extends EasCommand {
3
+ export default class EnvLink extends EasCommand {
4
4
  static description: string;
5
5
  static hidden: boolean;
6
6
  static flags: {
@@ -14,7 +14,7 @@ const projectUtils_1 = require("../../project/projectUtils");
14
14
  const prompts_1 = require("../../prompts");
15
15
  const prompts_2 = require("../../utils/prompts");
16
16
  const variableUtils_1 = require("../../utils/variableUtils");
17
- class EnvironmentVariableLink extends EasCommand_1.default {
17
+ class EnvLink extends EasCommand_1.default {
18
18
  async runAsync() {
19
19
  const { args, flags } = await this.parse(_a);
20
20
  let { 'variable-name': name, 'variable-environment': currentEnvironment, 'non-interactive': nonInteractive, environment: environments, } = this.validateInputs(flags, args);
@@ -32,13 +32,13 @@ class EnvironmentVariableLink extends EasCommand_1.default {
32
32
  if (nonInteractive) {
33
33
  throw new Error('Multiple variables found, run command with --variable-name and --variable-environment arguments.');
34
34
  }
35
- selectedVariable = await (0, prompts_1.selectAsync)('Select shared variable', variables.map(variable => ({
35
+ selectedVariable = await (0, prompts_1.selectAsync)('Select account-wide variable', variables.map(variable => ({
36
36
  title: (0, variableUtils_1.formatVariableName)(variable),
37
37
  value: variable,
38
38
  })));
39
39
  }
40
40
  if (!selectedVariable) {
41
- throw new Error(`Shared variable ${name} doesn't exist`);
41
+ throw new Error(`Account-wide variable ${name} doesn't exist`);
42
42
  }
43
43
  let explicitSelect = false;
44
44
  if (!nonInteractive && !environments) {
@@ -96,17 +96,16 @@ class EnvironmentVariableLink extends EasCommand_1.default {
96
96
  }
97
97
  }
98
98
  return {
99
- 'variable-name': flags['variable-name'],
100
- 'variable-environment': flags['variable-environment'],
101
- 'non-interactive': flags['non-interactive'],
99
+ ...flags,
102
100
  environment: environments,
103
101
  };
104
102
  }
105
103
  }
106
- _a = EnvironmentVariableLink;
107
- EnvironmentVariableLink.description = 'link a shared environment variable to the current project';
108
- EnvironmentVariableLink.hidden = true;
109
- EnvironmentVariableLink.flags = {
104
+ _a = EnvLink;
105
+ EnvLink.description = 'link an account-wide environment variable to the current project';
106
+ // for now we only roll out global account-wide env variables so this should stay hidden
107
+ EnvLink.hidden = true;
108
+ EnvLink.flags = {
110
109
  'variable-name': core_1.Flags.string({
111
110
  description: 'Name of the variable',
112
111
  }),
@@ -117,15 +116,15 @@ EnvironmentVariableLink.flags = {
117
116
  ...flags_1.EASMultiEnvironmentFlag,
118
117
  ...flags_1.EASNonInteractiveFlag,
119
118
  };
120
- EnvironmentVariableLink.args = [
119
+ EnvLink.args = [
121
120
  {
122
121
  name: 'environment',
123
122
  description: "Environment to pull variables from. One of 'production', 'preview', or 'development'.",
124
123
  required: false,
125
124
  },
126
125
  ];
127
- EnvironmentVariableLink.contextDefinition = {
126
+ EnvLink.contextDefinition = {
128
127
  ..._a.ContextOptions.ProjectId,
129
128
  ..._a.ContextOptions.LoggedIn,
130
129
  };
131
- exports.default = EnvironmentVariableLink;
130
+ exports.default = EnvLink;