eas-cli 12.5.1 → 12.5.3
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 +66 -62
- package/build/build/build.js +4 -4
- package/build/commandUtils/flags.d.ts +10 -0
- package/build/commandUtils/flags.js +15 -8
- package/build/commands/env/create.d.ts +4 -1
- package/build/commands/env/create.js +133 -74
- package/build/commands/env/delete.d.ts +2 -2
- package/build/commands/env/delete.js +37 -26
- package/build/commands/env/exec.js +2 -1
- package/build/commands/env/get.d.ts +2 -2
- package/build/commands/env/get.js +44 -28
- package/build/commands/env/link.d.ts +4 -2
- package/build/commands/env/link.js +53 -14
- package/build/commands/env/list.d.ts +2 -2
- package/build/commands/env/list.js +59 -42
- package/build/commands/env/pull.js +1 -1
- package/build/commands/env/unlink.d.ts +3 -2
- package/build/commands/env/unlink.js +48 -21
- package/build/commands/env/update.d.ts +6 -2
- package/build/commands/env/update.js +134 -70
- package/build/commands/update/index.js +0 -1
- package/build/commands/worker/deploy.js +31 -11
- package/build/graphql/generated.d.ts +103 -15
- package/build/graphql/mutations/EnvironmentVariableMutation.d.ts +13 -22
- package/build/graphql/mutations/EnvironmentVariableMutation.js +18 -2
- package/build/graphql/queries/EnvironmentVariablesQuery.d.ts +24 -11
- package/build/graphql/queries/EnvironmentVariablesQuery.js +40 -17
- package/build/graphql/types/EnvironmentVariable.js +3 -1
- package/build/graphql/types/EnvironmentVariableWithSecret.d.ts +1 -0
- package/build/graphql/types/EnvironmentVariableWithSecret.js +18 -0
- package/build/prompts.d.ts +1 -0
- package/build/prompts.js +2 -0
- package/build/update/republish.js +1 -0
- package/build/utils/prompts.d.ts +16 -3
- package/build/utils/prompts.js +52 -8
- package/build/utils/variableUtils.d.ts +6 -0
- package/build/utils/variableUtils.js +62 -0
- package/build/worker/assets.d.ts +6 -1
- package/build/worker/assets.js +1 -2
- package/build/worker/upload.d.ts +1 -0
- package/build/worker/upload.js +25 -1
- package/oclif.manifest.json +98 -41
- package/package.json +3 -3
- package/build/utils/formatVariable.d.ts +0 -2
- package/build/utils/formatVariable.js +0 -16
|
@@ -6,50 +6,89 @@ const core_1 = require("@oclif/core");
|
|
|
6
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
7
|
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
8
8
|
const flags_1 = require("../../commandUtils/flags");
|
|
9
|
+
const generated_1 = require("../../graphql/generated");
|
|
9
10
|
const EnvironmentVariableMutation_1 = require("../../graphql/mutations/EnvironmentVariableMutation");
|
|
10
11
|
const EnvironmentVariablesQuery_1 = require("../../graphql/queries/EnvironmentVariablesQuery");
|
|
11
12
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
12
13
|
const projectUtils_1 = require("../../project/projectUtils");
|
|
13
14
|
const prompts_1 = require("../../prompts");
|
|
14
15
|
const prompts_2 = require("../../utils/prompts");
|
|
16
|
+
const variableUtils_1 = require("../../utils/variableUtils");
|
|
15
17
|
class EnvironmentVariableLink extends EasCommand_1.default {
|
|
16
18
|
async runAsync() {
|
|
17
|
-
let { flags: { name, 'non-interactive': nonInteractive, environment }, } = await this.parse(_a);
|
|
19
|
+
let { flags: { 'variable-name': name, 'variable-environment': currentEnvironment, 'non-interactive': nonInteractive, environment: environments, }, } = await this.parse(_a);
|
|
18
20
|
const { privateProjectConfig: { projectId }, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
|
|
19
21
|
nonInteractive,
|
|
20
22
|
});
|
|
21
23
|
const projectDisplayName = await (0, projectUtils_1.getDisplayNameForProjectIdAsync)(graphqlClient, projectId);
|
|
22
24
|
const variables = await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.sharedAsync(graphqlClient, {
|
|
23
25
|
appId: projectId,
|
|
26
|
+
environment: currentEnvironment,
|
|
27
|
+
filterNames: name ? [name] : undefined,
|
|
24
28
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
let selectedVariable = variables[0];
|
|
30
|
+
if (variables.length > 1) {
|
|
31
|
+
selectedVariable = await (0, prompts_1.selectAsync)('Select shared variable', variables.map(variable => ({
|
|
32
|
+
title: (0, variableUtils_1.formatVariableName)(variable),
|
|
33
|
+
value: variable,
|
|
29
34
|
})));
|
|
30
35
|
}
|
|
31
|
-
const selectedVariable = variables.find(variable => variable.name === name);
|
|
32
36
|
if (!selectedVariable) {
|
|
33
37
|
throw new Error(`Shared variable ${name} doesn't exist`);
|
|
34
38
|
}
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
let explicitSelect = false;
|
|
40
|
+
if (!nonInteractive && !environments) {
|
|
41
|
+
const selectedEnvironments = (selectedVariable.linkedEnvironments ?? []).length > 0
|
|
42
|
+
? selectedVariable.linkedEnvironments
|
|
43
|
+
: selectedVariable.environments;
|
|
44
|
+
environments = await (0, prompts_2.promptVariableEnvironmentAsync)({
|
|
45
|
+
nonInteractive,
|
|
46
|
+
multiple: true,
|
|
47
|
+
selectedEnvironments: selectedEnvironments ?? [],
|
|
48
|
+
});
|
|
49
|
+
explicitSelect = true;
|
|
37
50
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
51
|
+
if (!environments) {
|
|
52
|
+
await EnvironmentVariableMutation_1.EnvironmentVariableMutation.linkSharedEnvironmentVariableAsync(graphqlClient, selectedVariable.id, projectId);
|
|
53
|
+
log_1.default.withTick(`Linked variable ${chalk_1.default.bold(selectedVariable.name)} to project ${chalk_1.default.bold(projectDisplayName)} in ${selectedVariable.environments?.join(', ').toLocaleLowerCase()}.`);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
for (const environment of Object.values(generated_1.EnvironmentVariableEnvironment)) {
|
|
57
|
+
try {
|
|
58
|
+
if (selectedVariable.linkedEnvironments?.includes(environment) ===
|
|
59
|
+
environments.includes(environment)) {
|
|
60
|
+
if (!explicitSelect && environments.includes(environment)) {
|
|
61
|
+
log_1.default.withTick(`Variable ${chalk_1.default.bold(selectedVariable.name)} is already linked to ${environment.toLocaleLowerCase()}.`);
|
|
62
|
+
}
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (environments.includes(environment)) {
|
|
66
|
+
await EnvironmentVariableMutation_1.EnvironmentVariableMutation.linkSharedEnvironmentVariableAsync(graphqlClient, selectedVariable.id, projectId, environment);
|
|
67
|
+
log_1.default.withTick(`Linked variable ${chalk_1.default.bold(selectedVariable.name)} to project ${chalk_1.default.bold(projectDisplayName)} in ${environment.toLocaleLowerCase()}.`);
|
|
68
|
+
}
|
|
69
|
+
else if (explicitSelect) {
|
|
70
|
+
await EnvironmentVariableMutation_1.EnvironmentVariableMutation.unlinkSharedEnvironmentVariableAsync(graphqlClient, selectedVariable.id, projectId, environment);
|
|
71
|
+
log_1.default.withTick(`Unlinked variable ${chalk_1.default.bold(selectedVariable.name)} from project ${chalk_1.default.bold(projectDisplayName)} in ${environment.toLocaleLowerCase()}.`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
log_1.default.warn(err.message);
|
|
76
|
+
}
|
|
41
77
|
}
|
|
42
|
-
log_1.default.withTick(`Linked variable ${chalk_1.default.bold(linkedVariable.name)} to project ${chalk_1.default.bold(projectDisplayName)}.`);
|
|
43
78
|
}
|
|
44
79
|
}
|
|
45
80
|
_a = EnvironmentVariableLink;
|
|
46
81
|
EnvironmentVariableLink.description = 'link a shared environment variable to the current project';
|
|
47
82
|
EnvironmentVariableLink.hidden = true;
|
|
48
83
|
EnvironmentVariableLink.flags = {
|
|
49
|
-
name: core_1.Flags.string({
|
|
84
|
+
'variable-name': core_1.Flags.string({
|
|
50
85
|
description: 'Name of the variable',
|
|
51
86
|
}),
|
|
52
|
-
|
|
87
|
+
'variable-environment': core_1.Flags.enum({
|
|
88
|
+
...flags_1.EasEnvironmentFlagParameters,
|
|
89
|
+
description: 'Current environment of the variable to link',
|
|
90
|
+
}),
|
|
91
|
+
...flags_1.EASMultiEnvironmentFlag,
|
|
53
92
|
...flags_1.EASNonInteractiveFlag,
|
|
54
93
|
};
|
|
55
94
|
EnvironmentVariableLink.contextDefinition = {
|
|
@@ -8,11 +8,11 @@ export default class EnvironmentValueList extends EasCommand {
|
|
|
8
8
|
privateProjectConfig: import("../../commandUtils/context/PrivateProjectConfigContextField").PrivateProjectConfigContextField;
|
|
9
9
|
};
|
|
10
10
|
static flags: {
|
|
11
|
-
environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment | undefined>;
|
|
11
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment[] | undefined>;
|
|
12
12
|
scope: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableScope>;
|
|
13
13
|
format: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
14
14
|
'include-sensitive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
'include-file-content': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
16
|
};
|
|
16
17
|
runAsync(): Promise<void>;
|
|
17
|
-
private getVariablesForScopeAsync;
|
|
18
18
|
}
|
|
@@ -9,58 +9,71 @@ const flags_1 = require("../../commandUtils/flags");
|
|
|
9
9
|
const generated_1 = require("../../graphql/generated");
|
|
10
10
|
const EnvironmentVariablesQuery_1 = require("../../graphql/queries/EnvironmentVariablesQuery");
|
|
11
11
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
12
|
-
const formatVariable_1 = require("../../utils/formatVariable");
|
|
13
12
|
const prompts_1 = require("../../utils/prompts");
|
|
13
|
+
const variableUtils_1 = require("../../utils/variableUtils");
|
|
14
|
+
async function getVariablesForScopeAsync(graphqlClient, { scope, includingSensitive, includeFileContent, environment, projectId, }) {
|
|
15
|
+
if (scope === generated_1.EnvironmentVariableScope.Project) {
|
|
16
|
+
if (includingSensitive) {
|
|
17
|
+
return await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.byAppIdWithSensitiveAsync(graphqlClient, {
|
|
18
|
+
appId: projectId,
|
|
19
|
+
environment,
|
|
20
|
+
includeFileContent,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.byAppIdAsync(graphqlClient, {
|
|
24
|
+
appId: projectId,
|
|
25
|
+
environment,
|
|
26
|
+
includeFileContent,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return includingSensitive
|
|
30
|
+
? await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.sharedWithSensitiveAsync(graphqlClient, {
|
|
31
|
+
appId: projectId,
|
|
32
|
+
environment,
|
|
33
|
+
includeFileContent,
|
|
34
|
+
})
|
|
35
|
+
: await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.sharedAsync(graphqlClient, {
|
|
36
|
+
appId: projectId,
|
|
37
|
+
environment,
|
|
38
|
+
includeFileContent,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
14
41
|
class EnvironmentValueList extends EasCommand_1.default {
|
|
15
42
|
async runAsync() {
|
|
16
|
-
let { flags: { environment, format, scope, 'include-sensitive': includeSensitive }, } = await this.parse(_a);
|
|
43
|
+
let { flags: { environment: environments, format, scope, 'include-sensitive': includeSensitive, 'include-file-content': includeFileContent, 'non-interactive': nonInteractive, }, } = await this.parse(_a);
|
|
17
44
|
const { privateProjectConfig: { projectId }, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
|
|
18
45
|
nonInteractive: true,
|
|
19
46
|
});
|
|
20
|
-
if (
|
|
21
|
-
|
|
47
|
+
if (!environments) {
|
|
48
|
+
environments = await (0, prompts_1.promptVariableEnvironmentAsync)({ nonInteractive, multiple: true });
|
|
22
49
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
50
|
+
await (0, variableUtils_1.performForEnvironmentsAsync)(environments, async (environment) => {
|
|
51
|
+
const variables = await getVariablesForScopeAsync(graphqlClient, {
|
|
52
|
+
scope,
|
|
53
|
+
includingSensitive: includeSensitive,
|
|
54
|
+
includeFileContent,
|
|
55
|
+
environment,
|
|
56
|
+
projectId,
|
|
57
|
+
});
|
|
58
|
+
log_1.default.addNewLineIfNone();
|
|
59
|
+
if (environment) {
|
|
60
|
+
log_1.default.log(chalk_1.default.bold(`Environment: ${environment}`));
|
|
34
61
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
62
|
+
if (format === 'short') {
|
|
63
|
+
for (const variable of variables) {
|
|
64
|
+
log_1.default.log(`${chalk_1.default.bold(variable.name)}=${(0, variableUtils_1.formatVariableValue)(variable)}`);
|
|
65
|
+
}
|
|
39
66
|
}
|
|
40
67
|
else {
|
|
41
|
-
|
|
68
|
+
if (scope === generated_1.EnvironmentVariableScope.Shared) {
|
|
69
|
+
log_1.default.log(chalk_1.default.bold('Shared variables for this account:'));
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
log_1.default.log(chalk_1.default.bold(`Variables for this project:`));
|
|
73
|
+
}
|
|
74
|
+
log_1.default.log(variables.map(variable => (0, variableUtils_1.formatVariable)(variable)).join(`\n\n${chalk_1.default.dim('———')}\n\n`));
|
|
42
75
|
}
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
async getVariablesForScopeAsync(graphqlClient, { scope, includingSensitive, environment, projectId, }) {
|
|
47
|
-
if (scope === generated_1.EnvironmentVariableScope.Project && environment) {
|
|
48
|
-
if (includingSensitive) {
|
|
49
|
-
return await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.byAppIdWithSensitiveAsync(graphqlClient, {
|
|
50
|
-
appId: projectId,
|
|
51
|
-
environment,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
return await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.byAppIdAsync(graphqlClient, {
|
|
55
|
-
appId: projectId,
|
|
56
|
-
environment,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return includingSensitive
|
|
60
|
-
? await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.sharedWithSensitiveAsync(graphqlClient, {
|
|
61
|
-
appId: projectId,
|
|
62
|
-
})
|
|
63
|
-
: await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.sharedAsync(graphqlClient, { appId: projectId });
|
|
76
|
+
});
|
|
64
77
|
}
|
|
65
78
|
}
|
|
66
79
|
_a = EnvironmentValueList;
|
|
@@ -75,8 +88,12 @@ EnvironmentValueList.flags = {
|
|
|
75
88
|
description: 'Display sensitive values in the output',
|
|
76
89
|
default: false,
|
|
77
90
|
}),
|
|
91
|
+
'include-file-content': core_1.Flags.boolean({
|
|
92
|
+
description: 'Display files content in the output',
|
|
93
|
+
default: false,
|
|
94
|
+
}),
|
|
78
95
|
...flags_1.EASVariableFormatFlag,
|
|
79
96
|
...flags_1.EASVariableScopeFlag,
|
|
80
|
-
...flags_1.
|
|
97
|
+
...flags_1.EASMultiEnvironmentFlag,
|
|
81
98
|
};
|
|
82
99
|
exports.default = EnvironmentValueList;
|
|
@@ -14,7 +14,7 @@ class EnvironmentVariablePull extends EasCommand_1.default {
|
|
|
14
14
|
async runAsync() {
|
|
15
15
|
let { flags: { environment, path: targetPath, 'non-interactive': nonInteractive }, } = await this.parse(_a);
|
|
16
16
|
if (!environment) {
|
|
17
|
-
environment = await (0, prompts_2.promptVariableEnvironmentAsync)(nonInteractive);
|
|
17
|
+
environment = await (0, prompts_2.promptVariableEnvironmentAsync)({ nonInteractive });
|
|
18
18
|
}
|
|
19
19
|
const { privateProjectConfig: { projectId }, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
|
|
20
20
|
nonInteractive,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
+
import { EnvironmentVariableEnvironment } from '../../graphql/generated';
|
|
2
3
|
export default class EnvironmentVariableUnlink extends EasCommand {
|
|
3
4
|
static description: string;
|
|
4
5
|
static hidden: boolean;
|
|
5
6
|
static flags: {
|
|
6
7
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
-
environment: import("@oclif/core/lib/interfaces").OptionFlag<
|
|
8
|
-
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
8
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment[] | undefined>;
|
|
9
|
+
'variable-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
9
10
|
};
|
|
10
11
|
static contextDefinition: {
|
|
11
12
|
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
@@ -13,49 +13,76 @@ const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
|
13
13
|
const projectUtils_1 = require("../../project/projectUtils");
|
|
14
14
|
const prompts_1 = require("../../prompts");
|
|
15
15
|
const prompts_2 = require("../../utils/prompts");
|
|
16
|
+
const variableUtils_1 = require("../../utils/variableUtils");
|
|
16
17
|
class EnvironmentVariableUnlink extends EasCommand_1.default {
|
|
17
18
|
async runAsync() {
|
|
18
|
-
let { flags: { name, 'non-interactive': nonInteractive, environment }, } = await this.parse(_a);
|
|
19
|
+
let { flags: { 'variable-name': name, 'non-interactive': nonInteractive, environment: unlinkEnvironments, }, } = await this.parse(_a);
|
|
19
20
|
const { privateProjectConfig: { projectId }, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
|
|
20
21
|
nonInteractive,
|
|
21
22
|
});
|
|
22
|
-
if (!environment) {
|
|
23
|
-
environment = await (0, prompts_2.promptVariableEnvironmentAsync)(nonInteractive);
|
|
24
|
-
}
|
|
25
23
|
const projectDisplayName = await (0, projectUtils_1.getDisplayNameForProjectIdAsync)(graphqlClient, projectId);
|
|
26
|
-
const
|
|
24
|
+
const variables = await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.sharedAsync(graphqlClient, {
|
|
27
25
|
appId: projectId,
|
|
28
|
-
|
|
26
|
+
filterNames: name ? [name] : undefined,
|
|
29
27
|
});
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
title: variable
|
|
37
|
-
value: variable
|
|
28
|
+
let selectedVariable = variables[0];
|
|
29
|
+
if (variables.length > 1) {
|
|
30
|
+
if (nonInteractive) {
|
|
31
|
+
throw new Error("Multiple variables found, please select one using '--variable-name'");
|
|
32
|
+
}
|
|
33
|
+
selectedVariable = await (0, prompts_1.selectAsync)('Select shared variable', variables.map(variable => ({
|
|
34
|
+
title: (0, variableUtils_1.formatVariableName)(variable),
|
|
35
|
+
value: variable,
|
|
38
36
|
})));
|
|
39
37
|
}
|
|
40
|
-
const selectedVariable = linkedVariables.find(variable => variable.name === name);
|
|
41
38
|
if (!selectedVariable) {
|
|
42
39
|
throw new Error(`Shared variable ${name} doesn't exist`);
|
|
43
40
|
}
|
|
44
|
-
|
|
45
|
-
if (!
|
|
46
|
-
|
|
41
|
+
let explicitSelect = false;
|
|
42
|
+
if (!nonInteractive && !unlinkEnvironments) {
|
|
43
|
+
const selectedEnvironments = (selectedVariable.linkedEnvironments ?? []).length > 0
|
|
44
|
+
? selectedVariable.linkedEnvironments
|
|
45
|
+
: selectedVariable.environments;
|
|
46
|
+
const environments = await (0, prompts_2.promptVariableEnvironmentAsync)({
|
|
47
|
+
nonInteractive,
|
|
48
|
+
multiple: true,
|
|
49
|
+
selectedEnvironments: selectedEnvironments ?? [],
|
|
50
|
+
});
|
|
51
|
+
explicitSelect = true;
|
|
52
|
+
unlinkEnvironments = Object.values(generated_1.EnvironmentVariableEnvironment).filter(env => !environments.includes(env));
|
|
53
|
+
}
|
|
54
|
+
if (!unlinkEnvironments) {
|
|
55
|
+
await EnvironmentVariableMutation_1.EnvironmentVariableMutation.unlinkSharedEnvironmentVariableAsync(graphqlClient, selectedVariable.id, projectId);
|
|
56
|
+
log_1.default.withTick(`Unlinked variable ${chalk_1.default.bold(selectedVariable.name)} from project ${chalk_1.default.bold(projectDisplayName)} in ${selectedVariable.environments?.join(', ').toLocaleLowerCase()}.`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
for (const environment of Object.values(generated_1.EnvironmentVariableEnvironment)) {
|
|
60
|
+
if (selectedVariable.linkedEnvironments?.includes(environment) !==
|
|
61
|
+
unlinkEnvironments.includes(environment)) {
|
|
62
|
+
if (!explicitSelect && unlinkEnvironments.includes(environment)) {
|
|
63
|
+
log_1.default.withTick(`Variable ${chalk_1.default.bold(selectedVariable.name)} is already unlinked from ${environment.toLocaleLowerCase()}.`);
|
|
64
|
+
}
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (unlinkEnvironments.includes(environment)) {
|
|
68
|
+
await EnvironmentVariableMutation_1.EnvironmentVariableMutation.unlinkSharedEnvironmentVariableAsync(graphqlClient, selectedVariable.id, projectId, environment);
|
|
69
|
+
log_1.default.withTick(`Unlinked variable ${chalk_1.default.bold(selectedVariable.name)} from project ${chalk_1.default.bold(projectDisplayName)} in ${environment.toLocaleLowerCase()}.`);
|
|
70
|
+
}
|
|
71
|
+
else if (explicitSelect) {
|
|
72
|
+
await EnvironmentVariableMutation_1.EnvironmentVariableMutation.linkSharedEnvironmentVariableAsync(graphqlClient, selectedVariable.id, projectId, environment);
|
|
73
|
+
log_1.default.withTick(`Linked variable ${chalk_1.default.bold(selectedVariable.name)} to project ${chalk_1.default.bold(projectDisplayName)} in ${environment.toLocaleLowerCase()}.`);
|
|
74
|
+
}
|
|
47
75
|
}
|
|
48
|
-
log_1.default.withTick(`Unlinked variable ${chalk_1.default.bold(unlinkedVariable.name)} from the project ${chalk_1.default.bold(projectDisplayName)}.`);
|
|
49
76
|
}
|
|
50
77
|
}
|
|
51
78
|
_a = EnvironmentVariableUnlink;
|
|
52
79
|
EnvironmentVariableUnlink.description = 'unlink a shared environment variable to the current project';
|
|
53
80
|
EnvironmentVariableUnlink.hidden = true;
|
|
54
81
|
EnvironmentVariableUnlink.flags = {
|
|
55
|
-
name: core_1.Flags.string({
|
|
82
|
+
'variable-name': core_1.Flags.string({
|
|
56
83
|
description: 'Name of the variable',
|
|
57
84
|
}),
|
|
58
|
-
...flags_1.
|
|
85
|
+
...flags_1.EASMultiEnvironmentFlag,
|
|
59
86
|
...flags_1.EASNonInteractiveFlag,
|
|
60
87
|
};
|
|
61
88
|
EnvironmentVariableUnlink.contextDefinition = {
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
-
import { EnvironmentVariableScope, EnvironmentVariableVisibility } from '../../graphql/generated';
|
|
2
|
+
import { EnvironmentVariableEnvironment, EnvironmentVariableScope, EnvironmentVariableVisibility } from '../../graphql/generated';
|
|
3
3
|
export default class EnvironmentVariableUpdate extends EasCommand {
|
|
4
4
|
static description: string;
|
|
5
5
|
static hidden: boolean;
|
|
6
6
|
static flags: {
|
|
7
7
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
|
-
environment: import("@oclif/core/lib/interfaces").OptionFlag<
|
|
8
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment[] | undefined>;
|
|
9
9
|
scope: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableScope>;
|
|
10
10
|
visibility: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableVisibility | undefined>;
|
|
11
|
+
'variable-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
12
|
+
'variable-environment': import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment | undefined>;
|
|
11
13
|
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
12
14
|
value: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
15
|
+
type: import("@oclif/core/lib/interfaces").OptionFlag<"string" | "file" | undefined>;
|
|
13
16
|
};
|
|
14
17
|
static contextDefinition: {
|
|
15
18
|
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
@@ -18,4 +21,5 @@ export default class EnvironmentVariableUpdate extends EasCommand {
|
|
|
18
21
|
};
|
|
19
22
|
runAsync(): Promise<void>;
|
|
20
23
|
private validateFlags;
|
|
24
|
+
private promptForMissingFlagsAsync;
|
|
21
25
|
}
|