eas-cli 12.5.3 → 12.5.4

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.
@@ -137,11 +137,12 @@ class EnvironmentVariableCreate extends EasCommand_1.default {
137
137
  throw new Error(`${message} Use --force to overwrite it.`);
138
138
  }
139
139
  }
140
- async promptForMissingFlagsAsync({ name, value, environment, visibility = generated_1.EnvironmentVariableVisibility.Public, 'non-interactive': nonInteractive, type, ...rest }) {
140
+ async promptForMissingFlagsAsync({ name, value, environment, visibility, 'non-interactive': nonInteractive, type, ...rest }) {
141
141
  if (!name) {
142
142
  name = await (0, prompts_2.promptVariableNameAsync)(nonInteractive);
143
143
  }
144
144
  let newType;
145
+ let newVisibility = visibility ? (0, prompts_2.parseVisibility)(visibility) : undefined;
145
146
  if (type === 'file') {
146
147
  newType = generated_1.EnvironmentSecretType.FileBase64;
147
148
  }
@@ -151,10 +152,14 @@ class EnvironmentVariableCreate extends EasCommand_1.default {
151
152
  if (!type && !value && !nonInteractive) {
152
153
  newType = await (0, prompts_2.promptVariableTypeAsync)(nonInteractive);
153
154
  }
155
+ if (!newVisibility) {
156
+ newVisibility = await (0, prompts_2.promptVariableVisibilityAsync)(nonInteractive);
157
+ }
154
158
  if (!value) {
155
159
  value = await (0, prompts_2.promptVariableValueAsync)({
156
160
  nonInteractive,
157
- hidden: visibility !== generated_1.EnvironmentVariableVisibility.Public,
161
+ hidden: newVisibility !== generated_1.EnvironmentVariableVisibility.Public,
162
+ filePath: newType === generated_1.EnvironmentSecretType.FileBase64,
158
163
  });
159
164
  }
160
165
  let environmentFilePath;
@@ -167,12 +172,16 @@ class EnvironmentVariableCreate extends EasCommand_1.default {
167
172
  value = environmentFilePath ? await fs_extra_1.default.readFile(environmentFilePath, 'base64') : value;
168
173
  if (!environment) {
169
174
  environment = await (0, prompts_2.promptVariableEnvironmentAsync)({ nonInteractive, multiple: true });
175
+ if (!environment || environment.length === 0) {
176
+ throw new Error('No environments selected');
177
+ }
170
178
  }
179
+ newVisibility = newVisibility ?? generated_1.EnvironmentVariableVisibility.Public;
171
180
  return {
172
181
  name,
173
182
  value,
174
183
  environment,
175
- visibility,
184
+ visibility: newVisibility,
176
185
  link: rest.link ?? false,
177
186
  force: rest.force ?? false,
178
187
  scope: rest.scope ?? generated_1.EnvironmentVariableScope.Project,
@@ -183,7 +192,7 @@ class EnvironmentVariableCreate extends EasCommand_1.default {
183
192
  }
184
193
  validateFlags(flags) {
185
194
  if (flags.scope !== generated_1.EnvironmentVariableScope.Shared && flags.link) {
186
- throw new Error(`Unexpected argument: --link can only be used when creating shared variables`);
195
+ throw new Error(`Unexpected argument: --link can only be used when creating shared variables`);
187
196
  }
188
197
  if (flags.scope === generated_1.EnvironmentVariableScope.Shared &&
189
198
  flags.environment &&
@@ -3,7 +3,6 @@ var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const tslib_1 = require("tslib");
5
5
  const core_1 = require("@oclif/core");
6
- const assert_1 = tslib_1.__importDefault(require("assert"));
7
6
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
8
7
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
9
8
  const flags_1 = require("../../commandUtils/flags");
@@ -22,6 +21,12 @@ class EnvironmentVariableGet extends EasCommand_1.default {
22
21
  if (!name) {
23
22
  name = await (0, prompts_1.promptVariableNameAsync)(nonInteractive);
24
23
  }
24
+ if (!environment) {
25
+ environment = await (0, prompts_1.promptVariableEnvironmentAsync)({
26
+ nonInteractive,
27
+ multiple: false,
28
+ });
29
+ }
25
30
  const variables = await getVariablesAsync(graphqlClient, scope, projectId, name, environment);
26
31
  if (variables.length === 0) {
27
32
  log_1.default.error(`Variable with name "${name}" not found`);
@@ -29,18 +34,9 @@ class EnvironmentVariableGet extends EasCommand_1.default {
29
34
  }
30
35
  let variable;
31
36
  if (variables.length > 1) {
32
- if (!environment) {
33
- const availableEnvironments = variables.reduce((acc, v) => [...acc, ...(v.environments ?? [])], []);
34
- environment = await (0, prompts_1.promptVariableEnvironmentAsync)({
35
- nonInteractive,
36
- multiple: false,
37
- availableEnvironments,
38
- });
39
- }
40
- (0, assert_1.default)(environment, 'Environment is required.');
41
37
  const variableInEnvironment = variables.find(v => v.environments?.includes(environment));
42
38
  if (!variableInEnvironment) {
43
- throw new Error(`Variable with name "${name}" not found in environment "${environment}"`);
39
+ throw new Error(`Variable with name "${name}" not found in environment "${environment.toLocaleLowerCase()}"`);
44
40
  }
45
41
  variable = variableInEnvironment;
46
42
  }
@@ -28,6 +28,9 @@ class EnvironmentVariableLink extends EasCommand_1.default {
28
28
  });
29
29
  let selectedVariable = variables[0];
30
30
  if (variables.length > 1) {
31
+ if (nonInteractive) {
32
+ throw new Error('Multiple variables found, run command with --variable-name and --variable-environment arguments.');
33
+ }
31
34
  selectedVariable = await (0, prompts_1.selectAsync)('Select shared variable', variables.map(variable => ({
32
35
  title: (0, variableUtils_1.formatVariableName)(variable),
33
36
  value: variable,
@@ -57,7 +57,11 @@ class EnvironmentValueList extends EasCommand_1.default {
57
57
  });
58
58
  log_1.default.addNewLineIfNone();
59
59
  if (environment) {
60
- log_1.default.log(chalk_1.default.bold(`Environment: ${environment}`));
60
+ log_1.default.log(chalk_1.default.bold(`Environment: ${environment.toLocaleLowerCase()}`));
61
+ }
62
+ if (variables.length === 0) {
63
+ log_1.default.log('No variables found for this environment.');
64
+ return;
61
65
  }
62
66
  if (format === 'short') {
63
67
  for (const variable of variables) {
@@ -33,7 +33,7 @@ class EnvironmentVariablePull extends EasCommand_1.default {
33
33
  throw new Error(`File ${targetPath} already exists.`);
34
34
  }
35
35
  }
36
- const filePrefix = `# Environment: ${environment}\n\n`;
36
+ const filePrefix = `# Environment: ${environment.toLocaleLowerCase()}\n\n`;
37
37
  const envFileContent = environmentVariables
38
38
  .map((variable) => {
39
39
  if (variable.value === null) {
@@ -9,7 +9,7 @@ export default class EnvironmentVariablePush extends EasCommand {
9
9
  };
10
10
  static flags: {
11
11
  path: import("@oclif/core/lib/interfaces").OptionFlag<string>;
12
- environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment | undefined>;
12
+ environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment[] | undefined>;
13
13
  };
14
14
  runAsync(): Promise<void>;
15
15
  private parseEnvFileAsync;
@@ -15,87 +15,93 @@ const prompts_1 = require("../../prompts");
15
15
  class EnvironmentVariablePush extends EasCommand_1.default {
16
16
  async runAsync() {
17
17
  const { flags } = await this.parse(_a);
18
- const { environment, path: envPath } = this.validateFlags(flags);
18
+ const { environment: environments, path: envPath } = this.validateFlags(flags);
19
19
  const { privateProjectConfig: { projectId }, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
20
20
  nonInteractive: false,
21
21
  });
22
- const updateVariables = await this.parseEnvFileAsync(envPath, environment);
22
+ const updateVariables = await this.parseEnvFileAsync(envPath, environments);
23
23
  const variableNames = Object.keys(updateVariables);
24
- const existingVariables = await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.byAppIdAsync(graphqlClient, {
25
- appId: projectId,
26
- environment,
27
- filterNames: variableNames,
28
- });
29
- const existingDifferentVariables = [];
30
- // Remove variables that are the same as the ones in the environment
31
- existingVariables.forEach(variable => {
32
- const existingVariableUpdate = updateVariables[variable.name];
33
- if (existingVariableUpdate && existingVariableUpdate.value !== variable.value) {
34
- existingDifferentVariables.push(variable);
35
- }
36
- else {
37
- delete updateVariables[variable.name];
38
- }
39
- });
40
- const existingDifferentSharedVariables = existingDifferentVariables.filter(variable => variable.scope === generated_1.EnvironmentVariableScope.Shared);
41
- if (existingDifferentSharedVariables.length > 0) {
42
- const existingDifferentSharedVariablesNames = existingDifferentSharedVariables.map(variable => variable.name);
43
- log_1.default.error('Shared variables cannot be overwritten by eas env:push command.');
44
- log_1.default.error('Remove them from the env file or unlink them from the project to continue:');
45
- existingDifferentSharedVariablesNames.forEach(name => {
46
- log_1.default.error(`- ${name}`);
24
+ for (const environment of environments) {
25
+ const displayedEnvironment = environment.toLocaleLowerCase();
26
+ const existingVariables = await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.byAppIdAsync(graphqlClient, {
27
+ appId: projectId,
28
+ environment,
29
+ filterNames: variableNames,
47
30
  });
48
- throw new Error('Shared variables cannot be overwritten by eas env:push command');
49
- }
50
- if (existingDifferentVariables.length > 0) {
51
- log_1.default.warn('Some variables already exist in the environment.');
52
- const variableNames = existingDifferentVariables.map(variable => variable.name);
53
- const confirmationMessage = variableNames.length > 1
54
- ? `The ${variableNames.join(', ')} environment variables already exist in ${environment} environment. Do you want to override them all?`
55
- : `The ${variableNames[0]} environment variable already exists in ${environment} environment. Do you want to override it?`;
56
- const confirm = await (0, prompts_1.confirmAsync)({
57
- message: confirmationMessage,
31
+ const existingDifferentVariables = [];
32
+ // Remove variables that are the same as the ones in the environment
33
+ existingVariables.forEach(existingVariable => {
34
+ const existingVariableUpdate = updateVariables[existingVariable.name];
35
+ if (existingVariableUpdate) {
36
+ const hasMoreEnvironments = existingVariableUpdate.environments.some(newEnv => !existingVariable.environments?.includes(newEnv));
37
+ if (existingVariableUpdate.value !== existingVariable.value || hasMoreEnvironments) {
38
+ existingDifferentVariables.push(existingVariable);
39
+ }
40
+ else {
41
+ delete updateVariables[existingVariable.name];
42
+ }
43
+ }
58
44
  });
59
- let variablesToOverwrite = [];
60
- if (!confirm && existingDifferentVariables.length === 1) {
61
- throw new Error('No new variables to push.');
62
- }
63
- if (confirm) {
64
- variablesToOverwrite = existingDifferentVariables.map(variable => variable.name);
65
- }
66
- else {
67
- const promptResult = await (0, prompts_1.promptAsync)({
68
- type: 'multiselect',
69
- name: 'variablesToOverwrite',
70
- message: 'Select variables to overwrite:',
71
- // @ts-expect-error property missing from `@types/prompts`
72
- optionsPerPage: 20,
73
- choices: existingDifferentVariables.map(variable => ({
74
- title: `${variable.name}: ${updateVariables[variable.name].value} (was ${variable.value ?? '(secret)'})`,
75
- value: variable.name,
76
- })),
45
+ const existingDifferentSharedVariables = existingDifferentVariables.filter(variable => variable.scope === generated_1.EnvironmentVariableScope.Shared);
46
+ if (existingDifferentSharedVariables.length > 0) {
47
+ const existingDifferentSharedVariablesNames = existingDifferentSharedVariables.map(variable => variable.name);
48
+ log_1.default.error('Shared variables cannot be overwritten by eas env:push command.');
49
+ log_1.default.error('Remove them from the env file or unlink them from the project to continue:');
50
+ existingDifferentSharedVariablesNames.forEach(name => {
51
+ log_1.default.error(`- ${name}`);
77
52
  });
78
- variablesToOverwrite = promptResult.variablesToOverwrite;
53
+ throw new Error('Shared variables cannot be overwritten by eas env:push command');
79
54
  }
80
- for (const existingVariable of existingVariables) {
81
- const name = existingVariable.name;
82
- if (variablesToOverwrite.includes(name)) {
83
- updateVariables[name]['overwrite'] = true;
55
+ if (existingDifferentVariables.length > 0) {
56
+ log_1.default.warn(`Some variables already exist in the ${displayedEnvironment} environment.`);
57
+ const variableNames = existingDifferentVariables.map(variable => variable.name);
58
+ const confirmationMessage = variableNames.length > 1
59
+ ? `The ${variableNames.join(', ')} environment variables already exist in ${displayedEnvironment} environment. Do you want to override them all?`
60
+ : `The ${variableNames[0]} environment variable already exists in ${displayedEnvironment} environment. Do you want to override it?`;
61
+ const confirm = await (0, prompts_1.confirmAsync)({
62
+ message: confirmationMessage,
63
+ });
64
+ let variablesToOverwrite = [];
65
+ if (!confirm && existingDifferentVariables.length === 0) {
66
+ throw new Error('No new variables to push.');
67
+ }
68
+ if (confirm) {
69
+ variablesToOverwrite = existingDifferentVariables.map(variable => variable.name);
84
70
  }
85
71
  else {
86
- delete updateVariables[name];
72
+ const promptResult = await (0, prompts_1.promptAsync)({
73
+ type: 'multiselect',
74
+ name: 'variablesToOverwrite',
75
+ message: 'Select variables to overwrite:',
76
+ // @ts-expect-error property missing from `@types/prompts`
77
+ optionsPerPage: 20,
78
+ choices: existingDifferentVariables.map(variable => ({
79
+ title: `${variable.name}: ${updateVariables[variable.name].value} (was ${variable.value ?? '(secret)'})`,
80
+ value: variable.name,
81
+ })),
82
+ });
83
+ variablesToOverwrite = promptResult.variablesToOverwrite;
84
+ }
85
+ for (const existingVariable of existingVariables) {
86
+ const name = existingVariable.name;
87
+ if (variablesToOverwrite.includes(name)) {
88
+ updateVariables[name]['overwrite'] = true;
89
+ }
90
+ else {
91
+ delete updateVariables[name];
92
+ }
87
93
  }
88
94
  }
89
- }
90
- // Check if any of the sensitive variables already exist in the environment. Prompt the user to overwrite them.
91
- const existingSensitiveVariables = existingVariables.filter(variable => variable.value === null);
92
- if (existingSensitiveVariables.length > 0) {
93
- const existingSensitiveVariablesNames = existingSensitiveVariables.map(variable => `- ${variable.name}`);
94
- const confirm = await (0, prompts_1.confirmAsync)({
95
- message: `You are about to overwrite sensitive variables.\n${existingSensitiveVariablesNames.join('\n')}\n Do you want to continue?`,
96
- });
97
- if (!confirm) {
98
- throw new Error('Aborting...');
95
+ // Check if any of the sensitive variables already exist in the environment. Prompt the user to overwrite them.
96
+ const existingSensitiveVariables = existingVariables.filter(variable => variable.visibility !== generated_1.EnvironmentVariableVisibility.Public);
97
+ if (existingSensitiveVariables.length > 0) {
98
+ const existingSensitiveVariablesNames = existingSensitiveVariables.map(variable => `- ${variable.name}`);
99
+ const confirm = await (0, prompts_1.confirmAsync)({
100
+ message: `You are about to overwrite sensitive variables.\n${existingSensitiveVariablesNames.join('\n')}\n Do you want to continue?`,
101
+ });
102
+ if (!confirm) {
103
+ throw new Error('Aborting...');
104
+ }
99
105
  }
100
106
  }
101
107
  const variablesToPush = Object.values(updateVariables);
@@ -104,9 +110,9 @@ class EnvironmentVariablePush extends EasCommand_1.default {
104
110
  return;
105
111
  }
106
112
  await EnvironmentVariableMutation_1.EnvironmentVariableMutation.createBulkEnvironmentVariablesForAppAsync(graphqlClient, variablesToPush, projectId);
107
- log_1.default.log(`Uploaded env file to ${environment} environment.`);
113
+ log_1.default.log(`Uploaded env file to ${environments.join(', ').toLocaleLowerCase()}.`);
108
114
  }
109
- async parseEnvFileAsync(envPath, environment) {
115
+ async parseEnvFileAsync(envPath, environments) {
110
116
  if (!(await fs_extra_1.default.exists(envPath))) {
111
117
  throw new Error(`File ${envPath} does not exist.`);
112
118
  }
@@ -116,7 +122,7 @@ class EnvironmentVariablePush extends EasCommand_1.default {
116
122
  pushInput[name] = {
117
123
  name,
118
124
  value,
119
- environment,
125
+ environments,
120
126
  visibility: name.startsWith('EXPO_SENSITIVE')
121
127
  ? generated_1.EnvironmentVariableVisibility.Sensitive
122
128
  : generated_1.EnvironmentVariableVisibility.Public,
@@ -125,7 +131,7 @@ class EnvironmentVariablePush extends EasCommand_1.default {
125
131
  return pushInput;
126
132
  }
127
133
  validateFlags(flags) {
128
- if (!flags.environment) {
134
+ if (!flags.environment || flags.environment.length === 0) {
129
135
  throw new Error('Please provide an environment to push the env file to.');
130
136
  }
131
137
  return { ...flags, environment: flags.environment };
@@ -139,7 +145,7 @@ EnvironmentVariablePush.contextDefinition = {
139
145
  ..._a.ContextOptions.LoggedIn,
140
146
  };
141
147
  EnvironmentVariablePush.flags = {
142
- ...flags_1.EASEnvironmentFlag,
148
+ ...flags_1.EASMultiEnvironmentFlag,
143
149
  path: core_1.Flags.string({
144
150
  description: 'Path to the input `.env` file',
145
151
  default: '.env.local',
@@ -1,5 +1,5 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
- import { EnvironmentVariableEnvironment, EnvironmentVariableScope, EnvironmentVariableVisibility } from '../../graphql/generated';
2
+ import { EnvironmentVariableEnvironment, EnvironmentVariableScope } from '../../graphql/generated';
3
3
  export default class EnvironmentVariableUpdate extends EasCommand {
4
4
  static description: string;
5
5
  static hidden: boolean;
@@ -7,7 +7,7 @@ export default class EnvironmentVariableUpdate extends EasCommand {
7
7
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
8
  environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment[] | undefined>;
9
9
  scope: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableScope>;
10
- visibility: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableVisibility | undefined>;
10
+ visibility: import("@oclif/core/lib/interfaces").OptionFlag<"plaintext" | "encrypted" | "sensitive" | undefined>;
11
11
  'variable-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
12
12
  'variable-environment': import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment | undefined>;
13
13
  name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
@@ -48,7 +48,7 @@ class EnvironmentVariableUpdate extends EasCommand_1.default {
48
48
  });
49
49
  }
50
50
  if (existingVariables.length === 0) {
51
- throw new Error(`Variable with name ${currentName} ${currentEnvironment ? `in environment ${currentEnvironment}` : ''} does not exist ${suffix}.`);
51
+ throw new Error(`Variable with name ${currentName} ${currentEnvironment ? `in environment ${currentEnvironment.toLocaleLowerCase()}` : ''} does not exist ${suffix}.`);
52
52
  }
53
53
  else if (existingVariables.length > 1) {
54
54
  selectedVariable = await (0, prompts_1.selectAsync)('Select variable', existingVariables.map(variable => ({
@@ -94,6 +94,7 @@ class EnvironmentVariableUpdate extends EasCommand_1.default {
94
94
  }
95
95
  async promptForMissingFlagsAsync(selectedVariable, { name, value, environment: environments, visibility, 'non-interactive': nonInteractive, type, ...rest }) {
96
96
  let newType;
97
+ let newVisibility;
97
98
  if (type === 'file') {
98
99
  newType = generated_1.EnvironmentSecretType.FileBase64;
99
100
  }
@@ -107,7 +108,6 @@ class EnvironmentVariableUpdate extends EasCommand_1.default {
107
108
  name = undefined;
108
109
  }
109
110
  }
110
- log_1.default.log(selectedVariable.type, generated_1.EnvironmentSecretType.String === selectedVariable.type, generated_1.EnvironmentSecretType.FileBase64 === selectedVariable.type);
111
111
  if (!type && !value && !nonInteractive) {
112
112
  newType = await (0, prompts_2.promptVariableTypeAsync)(nonInteractive, selectedVariable.type);
113
113
  if (!newType || newType === selectedVariable.type) {
@@ -118,6 +118,7 @@ class EnvironmentVariableUpdate extends EasCommand_1.default {
118
118
  value = await (0, prompts_2.promptVariableValueAsync)({
119
119
  nonInteractive,
120
120
  required: false,
121
+ filePath: (newType ?? selectedVariable.type) === generated_1.EnvironmentSecretType.FileBase64,
121
122
  initial: (newType ?? selectedVariable.type) === generated_1.EnvironmentSecretType.FileBase64
122
123
  ? undefined
123
124
  : selectedVariable.value,
@@ -127,7 +128,7 @@ class EnvironmentVariableUpdate extends EasCommand_1.default {
127
128
  }
128
129
  }
129
130
  let environmentFilePath;
130
- if (newType === generated_1.EnvironmentSecretType.FileBase64 && value) {
131
+ if ((newType ?? selectedVariable.type) === generated_1.EnvironmentSecretType.FileBase64 && value) {
131
132
  environmentFilePath = path_1.default.resolve(value);
132
133
  if (!(await fs_extra_1.default.pathExists(environmentFilePath))) {
133
134
  throw new Error(`File "${value}" does not exist`);
@@ -147,17 +148,20 @@ class EnvironmentVariableUpdate extends EasCommand_1.default {
147
148
  }
148
149
  }
149
150
  if (!visibility) {
150
- visibility = await (0, prompts_2.promptVariableVisibilityAsync)(nonInteractive, selectedVariable.visibility);
151
- if (!visibility || visibility === selectedVariable.visibility) {
152
- visibility = undefined;
151
+ newVisibility = await (0, prompts_2.promptVariableVisibilityAsync)(nonInteractive, selectedVariable.visibility);
152
+ if (!newVisibility || newVisibility === selectedVariable.visibility) {
153
+ newVisibility = undefined;
153
154
  }
154
155
  }
155
156
  }
157
+ if (visibility) {
158
+ newVisibility = (0, prompts_2.parseVisibility)(visibility);
159
+ }
156
160
  return {
157
161
  name,
158
162
  value,
159
163
  environment: environments,
160
- visibility,
164
+ visibility: newVisibility,
161
165
  scope: rest.scope ?? generated_1.EnvironmentVariableScope.Project,
162
166
  'non-interactive': nonInteractive,
163
167
  type: newType,
@@ -1,4 +1,4 @@
1
- import { ExpoConfig } from '@expo/config-types';
1
+ import { ExpoConfig } from '@expo/config';
2
2
  import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
3
3
  import { Client } from '../vcs/vcs';
4
4
  export type EASUpdateContext = {
@@ -10,7 +10,7 @@ type CreateVariableArgs = {
10
10
  export type EnvironmentVariablePushInput = {
11
11
  name: string;
12
12
  value: string;
13
- environment: string;
13
+ environments: EnvironmentVariableEnvironment[];
14
14
  visibility: EnvironmentVariableVisibility;
15
15
  overwrite?: boolean;
16
16
  };
@@ -1,4 +1,4 @@
1
- import { ExpoConfig } from '@expo/config-types';
1
+ import { ExpoConfig } from '@expo/config';
2
2
  import { SubmitProfile } from '@expo/eas-json';
3
3
  import { Analytics } from '../analytics/AnalyticsManager';
4
4
  import { CredentialsContext } from '../credentials/context';
@@ -1,4 +1,4 @@
1
- import { ExpoConfig } from '@expo/config-types';
1
+ import { ExpoConfig } from '@expo/config';
2
2
  import { SubmitProfile } from '@expo/eas-json';
3
3
  import { Analytics } from '../analytics/AnalyticsManager';
4
4
  import { CredentialsContext } from '../credentials/context';
@@ -1,4 +1,4 @@
1
- import { ExpoConfig } from '@expo/config-types';
1
+ import { ExpoConfig } from '@expo/config';
2
2
  import { Env, Workflow } from '@expo/eas-build-job';
3
3
  import { RequestedPlatform } from '../platform';
4
4
  import { Client } from '../vcs/vcs';
@@ -1,4 +1,4 @@
1
- import { ExpoConfig } from '@expo/config-types';
1
+ import { ExpoConfig } from '@expo/config';
2
2
  /**
3
3
  * @returns `true` if the project is SDK +46, has `@expo/cli`, and `EXPO_USE_LOCAL_CLI` is not set to a _false_ value.
4
4
  */
@@ -1,5 +1,6 @@
1
1
  import { EnvironmentSecretType, EnvironmentVariableEnvironment, EnvironmentVariableVisibility } from '../graphql/generated';
2
2
  export declare function promptVariableTypeAsync(nonInteractive: boolean, initialType?: EnvironmentSecretType): Promise<EnvironmentSecretType>;
3
+ export declare function parseVisibility(stringVisibility: 'plaintext' | 'sensitive' | 'encrypted'): EnvironmentVariableVisibility;
3
4
  export declare function promptVariableVisibilityAsync(nonInteractive: boolean, selectedVisibility?: EnvironmentVariableVisibility | null): Promise<EnvironmentVariableVisibility>;
4
5
  type EnvironmentPromptArgs = {
5
6
  nonInteractive: boolean;
@@ -12,10 +13,11 @@ export declare function promptVariableEnvironmentAsync(input: EnvironmentPromptA
12
13
  export declare function promptVariableEnvironmentAsync(input: EnvironmentPromptArgs & {
13
14
  multiple?: false;
14
15
  }): Promise<EnvironmentVariableEnvironment>;
15
- export declare function promptVariableValueAsync({ nonInteractive, required, hidden, initial, }: {
16
+ export declare function promptVariableValueAsync({ nonInteractive, required, hidden, filePath, initial, }: {
16
17
  nonInteractive: boolean;
17
18
  required?: boolean;
18
19
  initial?: string | null;
20
+ filePath?: boolean;
19
21
  hidden?: boolean;
20
22
  }): Promise<string>;
21
23
  export declare function promptVariableNameAsync(nonInteractive: boolean, initialValue?: string): Promise<string>;
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.promptVariableNameAsync = exports.promptVariableValueAsync = exports.promptVariableEnvironmentAsync = exports.promptVariableVisibilityAsync = exports.promptVariableTypeAsync = void 0;
3
+ exports.promptVariableNameAsync = exports.promptVariableValueAsync = exports.promptVariableEnvironmentAsync = exports.promptVariableVisibilityAsync = exports.parseVisibility = exports.promptVariableTypeAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
- const capitalize_1 = tslib_1.__importDefault(require("./expodash/capitalize"));
7
6
  const generated_1 = require("../graphql/generated");
8
7
  const prompts_1 = require("../prompts");
9
8
  async function promptVariableTypeAsync(nonInteractive, initialType) {
@@ -25,15 +24,40 @@ async function promptVariableTypeAsync(nonInteractive, initialType) {
25
24
  });
26
25
  }
27
26
  exports.promptVariableTypeAsync = promptVariableTypeAsync;
27
+ function parseVisibility(stringVisibility) {
28
+ switch (stringVisibility) {
29
+ case 'plaintext':
30
+ return generated_1.EnvironmentVariableVisibility.Public;
31
+ case 'sensitive':
32
+ return generated_1.EnvironmentVariableVisibility.Sensitive;
33
+ case 'encrypted':
34
+ return generated_1.EnvironmentVariableVisibility.Secret;
35
+ default:
36
+ throw new Error(`Invalid visibility: ${stringVisibility}`);
37
+ }
38
+ }
39
+ exports.parseVisibility = parseVisibility;
28
40
  async function promptVariableVisibilityAsync(nonInteractive, selectedVisibility) {
29
41
  if (nonInteractive) {
30
42
  throw new Error('The `--visibility` flag must be set when running in `--non-interactive` mode.');
31
43
  }
32
- return await (0, prompts_1.selectAsync)('Select visibility:', Object.values(generated_1.EnvironmentVariableVisibility).map(visibility => ({
33
- title: (0, capitalize_1.default)(visibility),
34
- value: visibility,
35
- selected: visibility === selectedVisibility,
36
- })));
44
+ return await (0, prompts_1.selectAsync)('Select visibility:', [
45
+ {
46
+ title: 'Plain text',
47
+ value: generated_1.EnvironmentVariableVisibility.Public,
48
+ selected: selectedVisibility === generated_1.EnvironmentVariableVisibility.Public,
49
+ },
50
+ {
51
+ title: 'Sensitive',
52
+ value: generated_1.EnvironmentVariableVisibility.Sensitive,
53
+ selected: selectedVisibility === generated_1.EnvironmentVariableVisibility.Sensitive,
54
+ },
55
+ {
56
+ title: 'Encrypted',
57
+ value: generated_1.EnvironmentVariableVisibility.Secret,
58
+ selected: selectedVisibility === generated_1.EnvironmentVariableVisibility.Secret,
59
+ },
60
+ ]);
37
61
  }
38
62
  exports.promptVariableVisibilityAsync = promptVariableVisibilityAsync;
39
63
  async function promptVariableEnvironmentAsync({ nonInteractive, selectedEnvironments, multiple = false, availableEnvironments, }) {
@@ -42,7 +66,7 @@ async function promptVariableEnvironmentAsync({ nonInteractive, selectedEnvironm
42
66
  }
43
67
  if (!multiple) {
44
68
  return await (0, prompts_1.selectAsync)('Select environment:', (availableEnvironments ?? Object.values(generated_1.EnvironmentVariableEnvironment)).map(environment => ({
45
- title: environment,
69
+ title: environment.toLocaleLowerCase(),
46
70
  value: environment,
47
71
  })));
48
72
  }
@@ -51,7 +75,7 @@ async function promptVariableEnvironmentAsync({ nonInteractive, selectedEnvironm
51
75
  name: 'environments',
52
76
  type: 'multiselect',
53
77
  choices: Object.values(generated_1.EnvironmentVariableEnvironment).map(environment => ({
54
- title: environment,
78
+ title: environment.toLocaleLowerCase(),
55
79
  value: environment,
56
80
  selected: selectedEnvironments?.includes(environment),
57
81
  })),
@@ -59,14 +83,14 @@ async function promptVariableEnvironmentAsync({ nonInteractive, selectedEnvironm
59
83
  return environments;
60
84
  }
61
85
  exports.promptVariableEnvironmentAsync = promptVariableEnvironmentAsync;
62
- async function promptVariableValueAsync({ nonInteractive, required = true, hidden = false, initial, }) {
86
+ async function promptVariableValueAsync({ nonInteractive, required = true, hidden = false, filePath = false, initial, }) {
63
87
  if (nonInteractive && required) {
64
88
  throw new Error(`Environment variable needs 'value' to be specified when running in non-interactive mode. Run the command with ${chalk_1.default.bold('--value VARIABLE_VALUE')} flag to fix the issue`);
65
89
  }
66
90
  const { variableValue } = await (0, prompts_1.promptAsync)({
67
- type: hidden ? 'password' : 'text',
91
+ type: hidden && !filePath ? 'password' : 'text',
68
92
  name: 'variableValue',
69
- message: 'Variable value:',
93
+ message: filePath ? 'File path:' : 'Variable value:',
70
94
  initial: initial ?? '',
71
95
  validate: variableValue => {
72
96
  if (!required) {
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "12.5.3",
2
+ "version": "12.5.4",
3
3
  "commands": {
4
4
  "analytics": {
5
5
  "id": "analytics",
@@ -1899,12 +1899,12 @@
1899
1899
  "name": "visibility",
1900
1900
  "type": "option",
1901
1901
  "description": "Visibility of the variable",
1902
- "helpValue": "(secret|sensitive|public)",
1902
+ "helpValue": "(plaintext|sensitive|encrypted)",
1903
1903
  "multiple": false,
1904
1904
  "options": [
1905
- "secret",
1905
+ "plaintext",
1906
1906
  "sensitive",
1907
- "public"
1907
+ "encrypted"
1908
1908
  ]
1909
1909
  },
1910
1910
  "scope": {
@@ -2279,7 +2279,7 @@
2279
2279
  "type": "option",
2280
2280
  "description": "Environment variable's environment",
2281
2281
  "helpValue": "(development|preview|production)",
2282
- "multiple": false,
2282
+ "multiple": true,
2283
2283
  "options": [
2284
2284
  "development",
2285
2285
  "preview",
@@ -2396,12 +2396,12 @@
2396
2396
  "name": "visibility",
2397
2397
  "type": "option",
2398
2398
  "description": "Visibility of the variable",
2399
- "helpValue": "(secret|sensitive|public)",
2399
+ "helpValue": "(plaintext|sensitive|encrypted)",
2400
2400
  "multiple": false,
2401
2401
  "options": [
2402
- "secret",
2402
+ "plaintext",
2403
2403
  "sensitive",
2404
- "public"
2404
+ "encrypted"
2405
2405
  ]
2406
2406
  },
2407
2407
  "scope": {