eas-cli 12.6.1 → 13.0.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.
- package/README.md +63 -63
- package/build/build/android/prepareJob.js +4 -0
- package/build/build/ios/prepareJob.js +4 -0
- package/build/build/local.js +1 -1
- package/build/commandUtils/context/DynamicProjectConfigContextField.js +4 -4
- package/build/commandUtils/context/OptionalPrivateProjectConfigContextField.js +2 -2
- package/build/commandUtils/context/PrivateProjectConfigContextField.js +2 -2
- package/build/commandUtils/context/ProjectIdContextField.js +1 -1
- package/build/commandUtils/context/ServerSideEnvironmentVariablesContextField.js +1 -1
- package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +1 -1
- package/build/commandUtils/context/contextUtils/loadServerSideEnvironmentVariablesAsync.js +1 -1
- package/build/commandUtils/flags.d.ts +3 -0
- package/build/commandUtils/flags.js +11 -1
- package/build/commands/env/create.d.ts +5 -0
- package/build/commands/env/create.js +22 -7
- package/build/commands/env/delete.d.ts +6 -1
- package/build/commands/env/delete.js +17 -3
- package/build/commands/env/exec.d.ts +1 -3
- package/build/commands/env/exec.js +23 -17
- package/build/commands/env/get.d.ts +6 -1
- package/build/commands/env/get.js +24 -4
- package/build/commands/env/link.d.ts +6 -0
- package/build/commands/env/link.js +31 -1
- package/build/commands/env/list.d.ts +7 -1
- package/build/commands/env/list.js +25 -2
- package/build/commands/env/pull.d.ts +6 -1
- package/build/commands/env/pull.js +34 -9
- package/build/commands/env/push.d.ts +12 -0
- package/build/commands/env/push.js +21 -1
- package/build/commands/env/unlink.d.ts +6 -0
- package/build/commands/env/unlink.js +27 -1
- package/build/commands/env/update.d.ts +5 -0
- package/build/commands/env/update.js +20 -3
- package/build/commands/project/init.js +3 -3
- package/build/commands/project/onboarding.js +2 -2
- package/build/commands/update/configure.d.ts +3 -1
- package/build/commands/update/configure.js +6 -5
- package/build/commands/update/index.d.ts +4 -2
- package/build/commands/update/index.js +5 -25
- package/build/credentials/android/actions/BuildCredentialsUtils.js +4 -4
- package/build/credentials/android/actions/CreateKeystore.js +1 -1
- package/build/credentials/context.d.ts +3 -3
- package/build/credentials/context.js +6 -6
- package/build/credentials/ios/actions/BuildCredentialsUtils.js +3 -3
- package/build/credentials/manager/ManageIos.js +5 -4
- package/build/credentials/manager/SetUpIosBuildCredentials.js +1 -1
- package/build/project/expoConfig.d.ts +2 -2
- package/build/project/expoConfig.js +45 -13
- package/build/project/ios/entitlements.js +30 -7
- package/build/project/projectUtils.d.ts +1 -0
- package/build/project/projectUtils.js +6 -1
- package/build/utils/variableUtils.d.ts +1 -0
- package/build/utils/variableUtils.js +5 -1
- package/oclif.manifest.json +105 -42
- package/package.json +15 -15
|
@@ -11,7 +11,7 @@ const expoConfig_1 = require("../../project/expoConfig");
|
|
|
11
11
|
class PrivateProjectConfigContextField extends ContextField_1.default {
|
|
12
12
|
async getValueAsync({ nonInteractive, sessionManager, withServerSideEnvironment, }) {
|
|
13
13
|
const projectDir = await (0, findProjectDirAndVerifyProjectSetupAsync_1.findProjectDirAndVerifyProjectSetupAsync)();
|
|
14
|
-
const expBefore = (0, expoConfig_1.
|
|
14
|
+
const expBefore = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir);
|
|
15
15
|
const projectId = await (0, getProjectIdAsync_1.getProjectIdAsync)(sessionManager, expBefore, {
|
|
16
16
|
nonInteractive,
|
|
17
17
|
});
|
|
@@ -28,7 +28,7 @@ class PrivateProjectConfigContextField extends ContextField_1.default {
|
|
|
28
28
|
});
|
|
29
29
|
serverSideEnvVars = serverSideEnvironmentVariables;
|
|
30
30
|
}
|
|
31
|
-
const exp = (0, expoConfig_1.
|
|
31
|
+
const exp = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir, { env: serverSideEnvVars });
|
|
32
32
|
return {
|
|
33
33
|
projectId,
|
|
34
34
|
exp,
|
|
@@ -9,7 +9,7 @@ const expoConfig_1 = require("../../project/expoConfig");
|
|
|
9
9
|
class ProjectIdContextField extends ContextField_1.default {
|
|
10
10
|
async getValueAsync({ nonInteractive, sessionManager }) {
|
|
11
11
|
const projectDir = await (0, findProjectDirAndVerifyProjectSetupAsync_1.findProjectDirAndVerifyProjectSetupAsync)();
|
|
12
|
-
const expBefore = (0, expoConfig_1.
|
|
12
|
+
const expBefore = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir);
|
|
13
13
|
const projectId = await (0, getProjectIdAsync_1.getProjectIdAsync)(sessionManager, expBefore, {
|
|
14
14
|
nonInteractive,
|
|
15
15
|
});
|
|
@@ -15,7 +15,7 @@ class ServerSideEnvironmentVariablesContextField extends ContextField_1.default
|
|
|
15
15
|
if (!withServerSideEnvironment) {
|
|
16
16
|
throw new Error('withServerSideEnvironment parameter is required to evaluate ServerSideEnvironmentVariablesContextField');
|
|
17
17
|
}
|
|
18
|
-
const exp = (0, expoConfig_1.
|
|
18
|
+
const exp = await (0, expoConfig_1.getPublicExpoConfigAsync)(projectDir, { env: maybeEnv });
|
|
19
19
|
const projectId = await (0, getProjectIdAsync_1.getProjectIdAsync)(sessionManager, exp, {
|
|
20
20
|
nonInteractive,
|
|
21
21
|
env: maybeEnv,
|
|
@@ -21,7 +21,7 @@ const User_1 = require("../../../user/User");
|
|
|
21
21
|
*/
|
|
22
22
|
async function saveProjectIdToAppConfigAsync(projectDir, projectId, options = {}) {
|
|
23
23
|
// NOTE(cedric): we disable plugins to avoid writing plugin-generated content to `expo.extra`
|
|
24
|
-
const exp = (0, expoConfig_1.
|
|
24
|
+
const exp = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir, { skipPlugins: true, ...options });
|
|
25
25
|
const result = await (0, expoConfig_1.createOrModifyExpoConfigAsync)(projectDir, {
|
|
26
26
|
extra: { ...exp.extra, eas: { ...exp.extra?.eas, projectId } },
|
|
27
27
|
}, { skipSDKVersionRequirement: true });
|
|
@@ -27,7 +27,7 @@ async function loadServerSideEnvironmentVariablesAsync({ environment, projectId,
|
|
|
27
27
|
log_1.default.log(`Environment variables loaded from the "${environment.toLowerCase()}" environment on EAS servers: ${Object.keys(serverEnvVars).join(', ')}.`);
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
|
-
log_1.default.log(`No environment variables found for the "${environment.toLowerCase()}" environment on EAS servers.`);
|
|
30
|
+
log_1.default.log(`No readable environment variables found for the "${environment.toLowerCase()}" environment on EAS servers.`);
|
|
31
31
|
}
|
|
32
32
|
const encryptedEnvVars = environmentVariables.filter(({ name, value }) => name && !value);
|
|
33
33
|
if (encryptedEnvVars.length > 0) {
|
|
@@ -30,4 +30,7 @@ export declare const EASNonInteractiveFlag: {
|
|
|
30
30
|
export declare const EasJsonOnlyFlag: {
|
|
31
31
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
32
32
|
};
|
|
33
|
+
export declare const WithEasEnvironmentVariablesSetFlag: {
|
|
34
|
+
'with-eas-environment-variables-set': import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment | null>;
|
|
35
|
+
};
|
|
33
36
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EasJsonOnlyFlag = exports.EASNonInteractiveFlag = exports.EASVariableScopeFlag = exports.EASVariableVisibilityFlag = exports.EASVariableFormatFlag = exports.EASMultiEnvironmentFlag = exports.EASEnvironmentFlag = exports.EasEnvironmentFlagParameters = exports.EasNonInteractiveAndJsonFlags = void 0;
|
|
3
|
+
exports.WithEasEnvironmentVariablesSetFlag = exports.EasJsonOnlyFlag = exports.EASNonInteractiveFlag = exports.EASVariableScopeFlag = 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
|
|
@@ -69,3 +69,13 @@ exports.EasJsonOnlyFlag = {
|
|
|
69
69
|
description: 'Enable JSON output, non-JSON messages will be printed to stderr.',
|
|
70
70
|
}),
|
|
71
71
|
};
|
|
72
|
+
exports.WithEasEnvironmentVariablesSetFlag = {
|
|
73
|
+
'with-eas-environment-variables-set': core_1.Flags.enum({
|
|
74
|
+
description: 'Environment to use the server-side defined EAS environment variables for during command execution.',
|
|
75
|
+
options: mapToLowercase(Object.values(generated_1.EnvironmentVariableEnvironment)),
|
|
76
|
+
parse: upperCaseAsync,
|
|
77
|
+
required: false,
|
|
78
|
+
hidden: true,
|
|
79
|
+
default: null,
|
|
80
|
+
}),
|
|
81
|
+
};
|
|
@@ -3,6 +3,11 @@ import { EnvironmentVariableEnvironment, EnvironmentVariableScope } from '../../
|
|
|
3
3
|
export default class EnvironmentVariableCreate extends EasCommand {
|
|
4
4
|
static description: string;
|
|
5
5
|
static hidden: boolean;
|
|
6
|
+
static args: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
required: boolean;
|
|
10
|
+
}[];
|
|
6
11
|
static flags: {
|
|
7
12
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
13
|
environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment[] | undefined>;
|
|
@@ -18,9 +18,9 @@ const prompts_2 = require("../../utils/prompts");
|
|
|
18
18
|
const variableUtils_1 = require("../../utils/variableUtils");
|
|
19
19
|
class EnvironmentVariableCreate extends EasCommand_1.default {
|
|
20
20
|
async runAsync() {
|
|
21
|
-
const { flags } = await this.parse(_a);
|
|
21
|
+
const { args, flags } = await this.parse(_a);
|
|
22
22
|
const validatedFlags = this.validateFlags(flags);
|
|
23
|
-
const { name, value, scope, 'non-interactive': nonInteractive, environment: environments, visibility, link, force, type, fileName, } = await this.promptForMissingFlagsAsync(validatedFlags);
|
|
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,
|
|
26
26
|
});
|
|
@@ -139,7 +139,7 @@ class EnvironmentVariableCreate extends EasCommand_1.default {
|
|
|
139
139
|
throw new Error(`${message} Use --force to overwrite it.`);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
async promptForMissingFlagsAsync({ name, value, environment, visibility, 'non-interactive': nonInteractive, type, ...rest }) {
|
|
142
|
+
async promptForMissingFlagsAsync({ name, value, environment: environments, visibility, 'non-interactive': nonInteractive, type, ...rest }, { environment }) {
|
|
143
143
|
if (!name) {
|
|
144
144
|
name = await (0, prompts_2.promptVariableNameAsync)(nonInteractive);
|
|
145
145
|
}
|
|
@@ -174,9 +174,17 @@ class EnvironmentVariableCreate extends EasCommand_1.default {
|
|
|
174
174
|
fileName = path_1.default.basename(environmentFilePath);
|
|
175
175
|
}
|
|
176
176
|
value = environmentFilePath ? await fs_extra_1.default.readFile(environmentFilePath, 'base64') : value;
|
|
177
|
-
if (!environment) {
|
|
178
|
-
|
|
179
|
-
|
|
177
|
+
if (environment && !(0, variableUtils_1.isEnvironment)(environment.toUpperCase())) {
|
|
178
|
+
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
179
|
+
}
|
|
180
|
+
let newEnvironments = environments
|
|
181
|
+
? environments
|
|
182
|
+
: environment
|
|
183
|
+
? [environment.toUpperCase()]
|
|
184
|
+
: undefined;
|
|
185
|
+
if (!newEnvironments) {
|
|
186
|
+
newEnvironments = await (0, prompts_2.promptVariableEnvironmentAsync)({ nonInteractive, multiple: true });
|
|
187
|
+
if (!newEnvironments || newEnvironments.length === 0) {
|
|
180
188
|
throw new Error('No environments selected');
|
|
181
189
|
}
|
|
182
190
|
}
|
|
@@ -184,7 +192,7 @@ class EnvironmentVariableCreate extends EasCommand_1.default {
|
|
|
184
192
|
return {
|
|
185
193
|
name,
|
|
186
194
|
value,
|
|
187
|
-
environment,
|
|
195
|
+
environment: newEnvironments,
|
|
188
196
|
visibility: newVisibility,
|
|
189
197
|
link: rest.link ?? false,
|
|
190
198
|
force: rest.force ?? false,
|
|
@@ -211,6 +219,13 @@ class EnvironmentVariableCreate extends EasCommand_1.default {
|
|
|
211
219
|
_a = EnvironmentVariableCreate;
|
|
212
220
|
EnvironmentVariableCreate.description = 'create an environment variable on the current project or owner account';
|
|
213
221
|
EnvironmentVariableCreate.hidden = true;
|
|
222
|
+
EnvironmentVariableCreate.args = [
|
|
223
|
+
{
|
|
224
|
+
name: 'environment',
|
|
225
|
+
description: "Environment to create the variable in. One of 'production', 'preview', or 'development'.",
|
|
226
|
+
required: false,
|
|
227
|
+
},
|
|
228
|
+
];
|
|
214
229
|
EnvironmentVariableCreate.flags = {
|
|
215
230
|
name: core_1.Flags.string({
|
|
216
231
|
description: 'Name of the variable',
|
|
@@ -9,10 +9,15 @@ export default class EnvironmentVariableDelete extends EasCommand {
|
|
|
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
|
};
|
|
12
|
+
static args: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
}[];
|
|
12
17
|
static contextDefinition: {
|
|
13
18
|
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
14
19
|
projectId: import("../../commandUtils/context/ProjectIdContextField").ProjectIdContextField;
|
|
15
20
|
};
|
|
16
21
|
runAsync(): Promise<void>;
|
|
17
|
-
private
|
|
22
|
+
private validateInputs;
|
|
18
23
|
}
|
|
@@ -15,8 +15,8 @@ const prompts_1 = require("../../prompts");
|
|
|
15
15
|
const variableUtils_1 = require("../../utils/variableUtils");
|
|
16
16
|
class EnvironmentVariableDelete extends EasCommand_1.default {
|
|
17
17
|
async runAsync() {
|
|
18
|
-
const { flags } = await this.parse(_a);
|
|
19
|
-
const { 'variable-name': name, 'variable-environment': environment, 'non-interactive': nonInteractive, scope, } = this.
|
|
18
|
+
const { args, flags } = await this.parse(_a);
|
|
19
|
+
const { 'variable-name': name, 'variable-environment': environment, 'non-interactive': nonInteractive, scope, } = this.validateInputs(flags, args);
|
|
20
20
|
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
|
|
21
21
|
nonInteractive,
|
|
22
22
|
});
|
|
@@ -76,12 +76,19 @@ 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
|
-
|
|
79
|
+
validateInputs(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
|
+
if (environment) {
|
|
86
|
+
environment = environment.toUpperCase();
|
|
87
|
+
if (!(0, variableUtils_1.isEnvironment)(environment)) {
|
|
88
|
+
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
89
|
+
}
|
|
90
|
+
return { ...flags, 'variable-environment': environment };
|
|
91
|
+
}
|
|
85
92
|
return flags;
|
|
86
93
|
}
|
|
87
94
|
}
|
|
@@ -99,6 +106,13 @@ EnvironmentVariableDelete.flags = {
|
|
|
99
106
|
...flags_1.EASVariableScopeFlag,
|
|
100
107
|
...flags_1.EASNonInteractiveFlag,
|
|
101
108
|
};
|
|
109
|
+
EnvironmentVariableDelete.args = [
|
|
110
|
+
{
|
|
111
|
+
name: 'environment',
|
|
112
|
+
description: "Current environment of the variable to delete. One of 'production', 'preview', or 'development'.",
|
|
113
|
+
required: false,
|
|
114
|
+
},
|
|
115
|
+
];
|
|
102
116
|
EnvironmentVariableDelete.contextDefinition = {
|
|
103
117
|
..._a.ContextOptions.ProjectId,
|
|
104
118
|
..._a.ContextOptions.LoggedIn,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
-
import { EnvironmentVariableEnvironment } from '../../graphql/generated';
|
|
3
2
|
export default class EnvExec extends EasCommand {
|
|
4
3
|
static description: string;
|
|
5
4
|
static hidden: boolean;
|
|
@@ -9,7 +8,6 @@ export default class EnvExec extends EasCommand {
|
|
|
9
8
|
};
|
|
10
9
|
static flags: {
|
|
11
10
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
-
environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment | undefined>;
|
|
13
11
|
};
|
|
14
12
|
static args: {
|
|
15
13
|
name: string;
|
|
@@ -17,7 +15,7 @@ export default class EnvExec extends EasCommand {
|
|
|
17
15
|
description: string;
|
|
18
16
|
}[];
|
|
19
17
|
runAsync(): Promise<void>;
|
|
20
|
-
private
|
|
18
|
+
private sanitizeFlagsAndArgs;
|
|
21
19
|
private runCommandWithEnvVarsAsync;
|
|
22
20
|
private loadEnvironmentVariablesAsync;
|
|
23
21
|
}
|
|
@@ -9,10 +9,11 @@ const flags_1 = require("../../commandUtils/flags");
|
|
|
9
9
|
const EnvironmentVariablesQuery_1 = require("../../graphql/queries/EnvironmentVariablesQuery");
|
|
10
10
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
11
11
|
const prompts_1 = require("../../utils/prompts");
|
|
12
|
+
const variableUtils_1 = require("../../utils/variableUtils");
|
|
12
13
|
class EnvExec extends EasCommand_1.default {
|
|
13
14
|
async runAsync() {
|
|
14
|
-
const { flags, args
|
|
15
|
-
const parsedFlags = this.
|
|
15
|
+
const { flags, args } = await this.parse(_a);
|
|
16
|
+
const parsedFlags = this.sanitizeFlagsAndArgs(flags, args);
|
|
16
17
|
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
|
|
17
18
|
nonInteractive: parsedFlags.nonInteractive,
|
|
18
19
|
});
|
|
@@ -23,22 +24,23 @@ class EnvExec extends EasCommand_1.default {
|
|
|
23
24
|
projectId,
|
|
24
25
|
environment,
|
|
25
26
|
});
|
|
26
|
-
await this.runCommandWithEnvVarsAsync({
|
|
27
|
+
await this.runCommandWithEnvVarsAsync({
|
|
28
|
+
command: parsedFlags.command,
|
|
29
|
+
environmentVariables,
|
|
30
|
+
});
|
|
27
31
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
nonInteractive: true,
|
|
36
|
-
environment,
|
|
37
|
-
};
|
|
32
|
+
sanitizeFlagsAndArgs(rawFlags, { bash_command, environment }) {
|
|
33
|
+
if (rawFlags['non-interactive'] && (!bash_command || !environment)) {
|
|
34
|
+
throw new Error("You must specify both environment and bash command when running in non-interactive mode. Run command as `eas env:exec ENVIRONMENT 'bash command'`.");
|
|
35
|
+
}
|
|
36
|
+
environment = environment?.toUpperCase();
|
|
37
|
+
if (!(0, variableUtils_1.isEnvironment)(environment)) {
|
|
38
|
+
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
38
39
|
}
|
|
39
40
|
return {
|
|
40
|
-
nonInteractive:
|
|
41
|
-
environment
|
|
41
|
+
nonInteractive: rawFlags['non-interactive'],
|
|
42
|
+
environment,
|
|
43
|
+
command: bash_command,
|
|
42
44
|
};
|
|
43
45
|
}
|
|
44
46
|
async runCommandWithEnvVarsAsync({ command, environmentVariables, }) {
|
|
@@ -112,12 +114,16 @@ EnvExec.contextDefinition = {
|
|
|
112
114
|
..._a.ContextOptions.LoggedIn,
|
|
113
115
|
};
|
|
114
116
|
EnvExec.flags = {
|
|
115
|
-
...flags_1.EASEnvironmentFlag,
|
|
116
117
|
...flags_1.EASNonInteractiveFlag,
|
|
117
118
|
};
|
|
118
119
|
EnvExec.args = [
|
|
119
120
|
{
|
|
120
|
-
name: '
|
|
121
|
+
name: 'environment',
|
|
122
|
+
required: true,
|
|
123
|
+
description: "Environment to execute the command in. One of 'production', 'preview', or 'development'.",
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: 'bash_command',
|
|
121
127
|
required: true,
|
|
122
128
|
description: 'bash command to execute with the environment variables from the environment',
|
|
123
129
|
},
|
|
@@ -7,6 +7,11 @@ export default class EnvironmentVariableGet extends EasCommand {
|
|
|
7
7
|
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
8
8
|
projectId: import("../../commandUtils/context/ProjectIdContextField").ProjectIdContextField;
|
|
9
9
|
};
|
|
10
|
+
static args: {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
required: boolean;
|
|
14
|
+
}[];
|
|
10
15
|
static flags: {
|
|
11
16
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
17
|
scope: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableScope>;
|
|
@@ -15,5 +20,5 @@ export default class EnvironmentVariableGet extends EasCommand {
|
|
|
15
20
|
'variable-environment': import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment | undefined>;
|
|
16
21
|
};
|
|
17
22
|
runAsync(): Promise<void>;
|
|
18
|
-
private
|
|
23
|
+
private validateInputs;
|
|
19
24
|
}
|
|
@@ -13,8 +13,8 @@ const prompts_1 = require("../../utils/prompts");
|
|
|
13
13
|
const variableUtils_1 = require("../../utils/variableUtils");
|
|
14
14
|
class EnvironmentVariableGet extends EasCommand_1.default {
|
|
15
15
|
async runAsync() {
|
|
16
|
-
const { flags } = await this.parse(_a);
|
|
17
|
-
let { 'variable-environment': environment, 'variable-name': name, 'non-interactive': nonInteractive, format, scope, } = this.
|
|
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);
|
|
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
|
-
|
|
56
|
+
validateInputs(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.');
|
|
@@ -61,10 +61,23 @@ class EnvironmentVariableGet extends EasCommand_1.default {
|
|
|
61
61
|
if (!flags.scope) {
|
|
62
62
|
throw new Error('Scope is required. Run the command with --scope flag.');
|
|
63
63
|
}
|
|
64
|
-
if (!flags['variable-environment']) {
|
|
64
|
+
if (!(flags['variable-environment'] ?? environment)) {
|
|
65
65
|
throw new Error('Environment is required.');
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
+
if (environment && flags['variable-environment']) {
|
|
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
|
+
}
|
|
71
|
+
if (environment) {
|
|
72
|
+
environment = environment.toUpperCase();
|
|
73
|
+
if (!(0, variableUtils_1.isEnvironment)(environment)) {
|
|
74
|
+
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
'variable-environment': environment,
|
|
78
|
+
...flags,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
68
81
|
return flags;
|
|
69
82
|
}
|
|
70
83
|
}
|
|
@@ -75,6 +88,13 @@ EnvironmentVariableGet.contextDefinition = {
|
|
|
75
88
|
..._a.ContextOptions.ProjectId,
|
|
76
89
|
..._a.ContextOptions.LoggedIn,
|
|
77
90
|
};
|
|
91
|
+
EnvironmentVariableGet.args = [
|
|
92
|
+
{
|
|
93
|
+
name: 'environment',
|
|
94
|
+
description: "Current environment of the variable. One of 'production', 'preview', or 'development'.",
|
|
95
|
+
required: false,
|
|
96
|
+
},
|
|
97
|
+
];
|
|
78
98
|
EnvironmentVariableGet.flags = {
|
|
79
99
|
'variable-name': core_1.Flags.string({
|
|
80
100
|
description: 'Name of the variable',
|
|
@@ -9,9 +9,15 @@ export default class EnvironmentVariableLink extends EasCommand {
|
|
|
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
|
};
|
|
12
|
+
static args: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
}[];
|
|
12
17
|
static contextDefinition: {
|
|
13
18
|
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
14
19
|
projectId: import("../../commandUtils/context/ProjectIdContextField").ProjectIdContextField;
|
|
15
20
|
};
|
|
16
21
|
runAsync(): Promise<void>;
|
|
22
|
+
private validateInputs;
|
|
17
23
|
}
|
|
@@ -16,7 +16,8 @@ const prompts_2 = require("../../utils/prompts");
|
|
|
16
16
|
const variableUtils_1 = require("../../utils/variableUtils");
|
|
17
17
|
class EnvironmentVariableLink extends EasCommand_1.default {
|
|
18
18
|
async runAsync() {
|
|
19
|
-
|
|
19
|
+
const { args, flags } = await this.parse(_a);
|
|
20
|
+
let { 'variable-name': name, 'variable-environment': currentEnvironment, 'non-interactive': nonInteractive, environment: environments, } = this.validateInputs(flags, args);
|
|
20
21
|
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
|
|
21
22
|
nonInteractive,
|
|
22
23
|
});
|
|
@@ -79,6 +80,28 @@ class EnvironmentVariableLink extends EasCommand_1.default {
|
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
}
|
|
83
|
+
validateInputs(flags, { environment }) {
|
|
84
|
+
environment = environment?.toUpperCase();
|
|
85
|
+
if (environment && !(0, variableUtils_1.isEnvironment)(environment)) {
|
|
86
|
+
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
87
|
+
}
|
|
88
|
+
const environments = flags.environment
|
|
89
|
+
? flags.environment
|
|
90
|
+
: environment
|
|
91
|
+
? [environment]
|
|
92
|
+
: undefined;
|
|
93
|
+
if (flags['non-interactive']) {
|
|
94
|
+
if (!flags['variable-name']) {
|
|
95
|
+
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`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
'variable-name': flags['variable-name'],
|
|
100
|
+
'variable-environment': flags['variable-environment'],
|
|
101
|
+
'non-interactive': flags['non-interactive'],
|
|
102
|
+
environment: environments,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
82
105
|
}
|
|
83
106
|
_a = EnvironmentVariableLink;
|
|
84
107
|
EnvironmentVariableLink.description = 'link a shared environment variable to the current project';
|
|
@@ -94,6 +117,13 @@ EnvironmentVariableLink.flags = {
|
|
|
94
117
|
...flags_1.EASMultiEnvironmentFlag,
|
|
95
118
|
...flags_1.EASNonInteractiveFlag,
|
|
96
119
|
};
|
|
120
|
+
EnvironmentVariableLink.args = [
|
|
121
|
+
{
|
|
122
|
+
name: 'environment',
|
|
123
|
+
description: "Environment to pull variables from. One of 'production', 'preview', or 'development'.",
|
|
124
|
+
required: false,
|
|
125
|
+
},
|
|
126
|
+
];
|
|
97
127
|
EnvironmentVariableLink.contextDefinition = {
|
|
98
128
|
..._a.ContextOptions.ProjectId,
|
|
99
129
|
..._a.ContextOptions.LoggedIn,
|
|
@@ -8,11 +8,17 @@ export default class EnvironmentValueList extends EasCommand {
|
|
|
8
8
|
projectId: import("../../commandUtils/context/ProjectIdContextField").ProjectIdContextField;
|
|
9
9
|
};
|
|
10
10
|
static flags: {
|
|
11
|
-
environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment[] | undefined>;
|
|
12
11
|
scope: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableScope>;
|
|
13
12
|
format: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
13
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment[] | undefined>;
|
|
14
14
|
'include-sensitive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
15
|
'include-file-content': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
16
|
};
|
|
17
|
+
static args: {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
required: boolean;
|
|
21
|
+
}[];
|
|
17
22
|
runAsync(): Promise<void>;
|
|
23
|
+
private validateInputs;
|
|
18
24
|
}
|
|
@@ -40,7 +40,8 @@ async function getVariablesForScopeAsync(graphqlClient, { scope, includingSensit
|
|
|
40
40
|
}
|
|
41
41
|
class EnvironmentValueList extends EasCommand_1.default {
|
|
42
42
|
async runAsync() {
|
|
43
|
-
|
|
43
|
+
const { args, flags } = await this.parse(_a);
|
|
44
|
+
let { format, environment: environments, scope, 'include-sensitive': includeSensitive, 'include-file-content': includeFileContent, 'non-interactive': nonInteractive, } = this.validateInputs(flags, args);
|
|
44
45
|
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
|
|
45
46
|
nonInteractive: true,
|
|
46
47
|
});
|
|
@@ -79,6 +80,21 @@ class EnvironmentValueList extends EasCommand_1.default {
|
|
|
79
80
|
}
|
|
80
81
|
});
|
|
81
82
|
}
|
|
83
|
+
validateInputs(flags, { environment }) {
|
|
84
|
+
if (environment && !(0, variableUtils_1.isEnvironment)(environment.toUpperCase())) {
|
|
85
|
+
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
86
|
+
}
|
|
87
|
+
const environments = flags.environment
|
|
88
|
+
? flags.environment
|
|
89
|
+
: environment
|
|
90
|
+
? [environment.toUpperCase()]
|
|
91
|
+
: undefined;
|
|
92
|
+
return {
|
|
93
|
+
...flags,
|
|
94
|
+
'non-interactive': flags['non-interactive'] ?? false,
|
|
95
|
+
environment: environments,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
82
98
|
}
|
|
83
99
|
_a = EnvironmentValueList;
|
|
84
100
|
EnvironmentValueList.description = 'list environment variables for the current project';
|
|
@@ -96,8 +112,15 @@ EnvironmentValueList.flags = {
|
|
|
96
112
|
description: 'Display files content in the output',
|
|
97
113
|
default: false,
|
|
98
114
|
}),
|
|
115
|
+
...flags_1.EASMultiEnvironmentFlag,
|
|
99
116
|
...flags_1.EASVariableFormatFlag,
|
|
100
117
|
...flags_1.EASVariableScopeFlag,
|
|
101
|
-
...flags_1.EASMultiEnvironmentFlag,
|
|
102
118
|
};
|
|
119
|
+
EnvironmentValueList.args = [
|
|
120
|
+
{
|
|
121
|
+
name: 'environment',
|
|
122
|
+
description: "Environment to list the variables from. One of 'production', 'preview', or 'development'.",
|
|
123
|
+
required: false,
|
|
124
|
+
},
|
|
125
|
+
];
|
|
103
126
|
exports.default = EnvironmentValueList;
|
|
@@ -7,10 +7,15 @@ export default class EnvironmentVariablePull extends EasCommand {
|
|
|
7
7
|
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
8
8
|
projectId: import("../../commandUtils/context/ProjectIdContextField").ProjectIdContextField;
|
|
9
9
|
};
|
|
10
|
+
static args: {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
required: boolean;
|
|
14
|
+
}[];
|
|
10
15
|
static flags: {
|
|
11
16
|
path: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
12
|
-
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
17
|
environment: import("@oclif/core/lib/interfaces").OptionFlag<import("../../graphql/generated").EnvironmentVariableEnvironment | undefined>;
|
|
18
|
+
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
19
|
};
|
|
15
20
|
runAsync(): Promise<void>;
|
|
16
21
|
}
|