eas-cli 12.5.3 → 12.6.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 +131 -60
- package/build/channel/queries.js +12 -3
- package/build/commandUtils/context/DynamicProjectConfigContextField.d.ts +1 -1
- package/build/commandUtils/context/OptionalPrivateProjectConfigContextField.d.ts +1 -1
- package/build/commandUtils/context/PrivateProjectConfigContextField.d.ts +1 -1
- package/build/commandUtils/context/contextUtils/getProjectIdAsync.d.ts +1 -1
- package/build/commandUtils/flags.d.ts +2 -2
- package/build/commandUtils/flags.js +1 -6
- package/build/commands/channel/pause.d.ts +22 -0
- package/build/commands/channel/pause.js +90 -0
- package/build/commands/channel/resume.d.ts +22 -0
- package/build/commands/channel/resume.js +90 -0
- package/build/commands/env/create.d.ts +2 -2
- package/build/commands/env/create.js +13 -4
- package/build/commands/env/get.js +7 -11
- package/build/commands/env/link.js +3 -0
- package/build/commands/env/list.js +5 -1
- package/build/commands/env/pull.js +1 -1
- package/build/commands/env/push.d.ts +1 -2
- package/build/commands/env/push.js +86 -80
- package/build/commands/env/update.d.ts +2 -2
- package/build/commands/env/update.js +11 -7
- package/build/commands/update/edit.d.ts +2 -2
- package/build/commands/update/edit.js +41 -4
- package/build/eas-update/utils.d.ts +1 -1
- package/build/graphql/generated.d.ts +147 -19
- package/build/graphql/generated.js +19 -2
- package/build/graphql/mutations/EnvironmentVariableMutation.d.ts +1 -1
- package/build/graphql/queries/ChannelQuery.js +2 -0
- package/build/metadata/download.d.ts +1 -1
- package/build/metadata/upload.d.ts +1 -1
- package/build/update/configure.d.ts +1 -1
- package/build/utils/expoCli.d.ts +1 -1
- package/build/utils/prompts.d.ts +3 -1
- package/build/utils/prompts.js +36 -12
- package/oclif.manifest.json +103 -12
- package/package.json +3 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EnvironmentVariableEnvironment, EnvironmentVariableScope
|
|
1
|
+
import { EnvironmentVariableEnvironment, EnvironmentVariableScope } 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,7 +19,7 @@ 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<
|
|
22
|
+
visibility: import("@oclif/core/lib/interfaces").OptionFlag<"plaintext" | "encrypted" | "sensitive" | undefined>;
|
|
23
23
|
};
|
|
24
24
|
export declare const EASVariableScopeFlag: {
|
|
25
25
|
scope: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableScope>;
|
|
@@ -48,12 +48,7 @@ exports.EASVariableFormatFlag = {
|
|
|
48
48
|
exports.EASVariableVisibilityFlag = {
|
|
49
49
|
visibility: core_1.Flags.enum({
|
|
50
50
|
description: 'Visibility of the variable',
|
|
51
|
-
options:
|
|
52
|
-
generated_1.EnvironmentVariableVisibility.Secret,
|
|
53
|
-
generated_1.EnvironmentVariableVisibility.Sensitive,
|
|
54
|
-
generated_1.EnvironmentVariableVisibility.Public,
|
|
55
|
-
]),
|
|
56
|
-
parse: upperCaseAsync,
|
|
51
|
+
options: ['plaintext', 'sensitive', 'encrypted'],
|
|
57
52
|
}),
|
|
58
53
|
};
|
|
59
54
|
exports.EASVariableScopeFlag = {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
+
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
3
|
+
import { PauseUpdateChannelMutationVariables, UpdateChannelBasicInfoFragment } from '../../graphql/generated';
|
|
4
|
+
export declare function pauseUpdateChannelAsync(graphqlClient: ExpoGraphqlClient, { channelId }: PauseUpdateChannelMutationVariables): Promise<UpdateChannelBasicInfoFragment>;
|
|
5
|
+
export default class ChannelPause extends EasCommand {
|
|
6
|
+
static description: string;
|
|
7
|
+
static args: {
|
|
8
|
+
name: string;
|
|
9
|
+
required: boolean;
|
|
10
|
+
description: string;
|
|
11
|
+
}[];
|
|
12
|
+
static flags: {
|
|
13
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
branch: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
16
|
+
};
|
|
17
|
+
static contextDefinition: {
|
|
18
|
+
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
19
|
+
privateProjectConfig: import("../../commandUtils/context/PrivateProjectConfigContextField").PrivateProjectConfigContextField;
|
|
20
|
+
};
|
|
21
|
+
runAsync(): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.pauseUpdateChannelAsync = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
7
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
+
const graphql_1 = require("graphql");
|
|
9
|
+
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
10
|
+
const queries_1 = require("../../channel/queries");
|
|
11
|
+
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
12
|
+
const flags_1 = require("../../commandUtils/flags");
|
|
13
|
+
const client_1 = require("../../graphql/client");
|
|
14
|
+
const ChannelQuery_1 = require("../../graphql/queries/ChannelQuery");
|
|
15
|
+
const UpdateChannelBasicInfo_1 = require("../../graphql/types/UpdateChannelBasicInfo");
|
|
16
|
+
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
17
|
+
const json_1 = require("../../utils/json");
|
|
18
|
+
async function pauseUpdateChannelAsync(graphqlClient, { channelId }) {
|
|
19
|
+
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
20
|
+
.mutation((0, graphql_tag_1.default) `
|
|
21
|
+
mutation PauseUpdateChannel($channelId: ID!) {
|
|
22
|
+
updateChannel {
|
|
23
|
+
pauseUpdateChannel(channelId: $channelId) {
|
|
24
|
+
id
|
|
25
|
+
...UpdateChannelBasicInfoFragment
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
${(0, graphql_1.print)(UpdateChannelBasicInfo_1.UpdateChannelBasicInfoFragmentNode)}
|
|
30
|
+
`, { channelId })
|
|
31
|
+
.toPromise());
|
|
32
|
+
const channel = data.updateChannel.pauseUpdateChannel;
|
|
33
|
+
if (!channel) {
|
|
34
|
+
throw new Error(`Could not find a channel with id: ${channelId}`);
|
|
35
|
+
}
|
|
36
|
+
return channel;
|
|
37
|
+
}
|
|
38
|
+
exports.pauseUpdateChannelAsync = pauseUpdateChannelAsync;
|
|
39
|
+
class ChannelPause extends EasCommand_1.default {
|
|
40
|
+
async runAsync() {
|
|
41
|
+
const { args, flags: { json, 'non-interactive': nonInteractive }, } = await this.parse(_a);
|
|
42
|
+
const { privateProjectConfig: { projectId }, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
|
|
43
|
+
nonInteractive,
|
|
44
|
+
});
|
|
45
|
+
if (json) {
|
|
46
|
+
(0, json_1.enableJsonOutput)();
|
|
47
|
+
}
|
|
48
|
+
const existingChannel = args.name
|
|
49
|
+
? await ChannelQuery_1.ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
|
|
50
|
+
appId: projectId,
|
|
51
|
+
channelName: args.name,
|
|
52
|
+
})
|
|
53
|
+
: await (0, queries_1.selectChannelOnAppAsync)(graphqlClient, {
|
|
54
|
+
projectId,
|
|
55
|
+
selectionPromptTitle: 'Select a channel to edit',
|
|
56
|
+
paginatedQueryOptions: { json, nonInteractive, offset: 0 },
|
|
57
|
+
});
|
|
58
|
+
const channel = await pauseUpdateChannelAsync(graphqlClient, {
|
|
59
|
+
channelId: existingChannel.id,
|
|
60
|
+
});
|
|
61
|
+
if (json) {
|
|
62
|
+
(0, json_1.printJsonOnlyOutput)(channel);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
log_1.default.withTick((0, chalk_1.default) `Channel {bold ${channel.name}} is now paused.\n`);
|
|
66
|
+
log_1.default.addNewLineIfNone();
|
|
67
|
+
log_1.default.log((0, chalk_1.default) `Users with builds on channel {bold ${channel.name}} will no longer receive updates.`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
_a = ChannelPause;
|
|
72
|
+
ChannelPause.description = 'pause a channel to stop it from sending updates';
|
|
73
|
+
ChannelPause.args = [
|
|
74
|
+
{
|
|
75
|
+
name: 'name',
|
|
76
|
+
required: false,
|
|
77
|
+
description: 'Name of the channel to edit',
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
ChannelPause.flags = {
|
|
81
|
+
branch: core_1.Flags.string({
|
|
82
|
+
description: 'Name of the branch to point to',
|
|
83
|
+
}),
|
|
84
|
+
...flags_1.EasNonInteractiveAndJsonFlags,
|
|
85
|
+
};
|
|
86
|
+
ChannelPause.contextDefinition = {
|
|
87
|
+
..._a.ContextOptions.ProjectConfig,
|
|
88
|
+
..._a.ContextOptions.LoggedIn,
|
|
89
|
+
};
|
|
90
|
+
exports.default = ChannelPause;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
+
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
3
|
+
import { ResumeUpdateChannelMutationVariables, UpdateChannelBasicInfoFragment } from '../../graphql/generated';
|
|
4
|
+
export declare function resumeUpdateChannelAsync(graphqlClient: ExpoGraphqlClient, { channelId }: ResumeUpdateChannelMutationVariables): Promise<UpdateChannelBasicInfoFragment>;
|
|
5
|
+
export default class ChannelResume extends EasCommand {
|
|
6
|
+
static description: string;
|
|
7
|
+
static args: {
|
|
8
|
+
name: string;
|
|
9
|
+
required: boolean;
|
|
10
|
+
description: string;
|
|
11
|
+
}[];
|
|
12
|
+
static flags: {
|
|
13
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
branch: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
16
|
+
};
|
|
17
|
+
static contextDefinition: {
|
|
18
|
+
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
19
|
+
privateProjectConfig: import("../../commandUtils/context/PrivateProjectConfigContextField").PrivateProjectConfigContextField;
|
|
20
|
+
};
|
|
21
|
+
runAsync(): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.resumeUpdateChannelAsync = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
7
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
+
const graphql_1 = require("graphql");
|
|
9
|
+
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
10
|
+
const queries_1 = require("../../channel/queries");
|
|
11
|
+
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
12
|
+
const flags_1 = require("../../commandUtils/flags");
|
|
13
|
+
const client_1 = require("../../graphql/client");
|
|
14
|
+
const ChannelQuery_1 = require("../../graphql/queries/ChannelQuery");
|
|
15
|
+
const UpdateChannelBasicInfo_1 = require("../../graphql/types/UpdateChannelBasicInfo");
|
|
16
|
+
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
17
|
+
const json_1 = require("../../utils/json");
|
|
18
|
+
async function resumeUpdateChannelAsync(graphqlClient, { channelId }) {
|
|
19
|
+
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
20
|
+
.mutation((0, graphql_tag_1.default) `
|
|
21
|
+
mutation ResumeUpdateChannel($channelId: ID!) {
|
|
22
|
+
updateChannel {
|
|
23
|
+
resumeUpdateChannel(channelId: $channelId) {
|
|
24
|
+
id
|
|
25
|
+
...UpdateChannelBasicInfoFragment
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
${(0, graphql_1.print)(UpdateChannelBasicInfo_1.UpdateChannelBasicInfoFragmentNode)}
|
|
30
|
+
`, { channelId })
|
|
31
|
+
.toPromise());
|
|
32
|
+
const channel = data.updateChannel.resumeUpdateChannel;
|
|
33
|
+
if (!channel) {
|
|
34
|
+
throw new Error(`Could not find a channel with id: ${channelId}`);
|
|
35
|
+
}
|
|
36
|
+
return channel;
|
|
37
|
+
}
|
|
38
|
+
exports.resumeUpdateChannelAsync = resumeUpdateChannelAsync;
|
|
39
|
+
class ChannelResume extends EasCommand_1.default {
|
|
40
|
+
async runAsync() {
|
|
41
|
+
const { args, flags: { json, 'non-interactive': nonInteractive }, } = await this.parse(_a);
|
|
42
|
+
const { privateProjectConfig: { projectId }, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
|
|
43
|
+
nonInteractive,
|
|
44
|
+
});
|
|
45
|
+
if (json) {
|
|
46
|
+
(0, json_1.enableJsonOutput)();
|
|
47
|
+
}
|
|
48
|
+
const existingChannel = args.name
|
|
49
|
+
? await ChannelQuery_1.ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
|
|
50
|
+
appId: projectId,
|
|
51
|
+
channelName: args.name,
|
|
52
|
+
})
|
|
53
|
+
: await (0, queries_1.selectChannelOnAppAsync)(graphqlClient, {
|
|
54
|
+
projectId,
|
|
55
|
+
selectionPromptTitle: 'Select a channel to edit',
|
|
56
|
+
paginatedQueryOptions: { json, nonInteractive, offset: 0 },
|
|
57
|
+
});
|
|
58
|
+
const channel = await resumeUpdateChannelAsync(graphqlClient, {
|
|
59
|
+
channelId: existingChannel.id,
|
|
60
|
+
});
|
|
61
|
+
if (json) {
|
|
62
|
+
(0, json_1.printJsonOnlyOutput)(channel);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
log_1.default.withTick((0, chalk_1.default) `Channel {bold ${channel.name}} is now active.\n`);
|
|
66
|
+
log_1.default.addNewLineIfNone();
|
|
67
|
+
log_1.default.log((0, chalk_1.default) `Users with builds on channel {bold ${channel.name}} will now receive updates.`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
_a = ChannelResume;
|
|
72
|
+
ChannelResume.description = 'resume a channel to start sending updates';
|
|
73
|
+
ChannelResume.args = [
|
|
74
|
+
{
|
|
75
|
+
name: 'name',
|
|
76
|
+
required: false,
|
|
77
|
+
description: 'Name of the channel to edit',
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
ChannelResume.flags = {
|
|
81
|
+
branch: core_1.Flags.string({
|
|
82
|
+
description: 'Name of the branch to point to',
|
|
83
|
+
}),
|
|
84
|
+
...flags_1.EasNonInteractiveAndJsonFlags,
|
|
85
|
+
};
|
|
86
|
+
ChannelResume.contextDefinition = {
|
|
87
|
+
..._a.ContextOptions.ProjectConfig,
|
|
88
|
+
..._a.ContextOptions.LoggedIn,
|
|
89
|
+
};
|
|
90
|
+
exports.default = ChannelResume;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
-
import { EnvironmentVariableEnvironment, EnvironmentVariableScope
|
|
2
|
+
import { EnvironmentVariableEnvironment, EnvironmentVariableScope } from '../../graphql/generated';
|
|
3
3
|
export default class EnvironmentVariableCreate extends EasCommand {
|
|
4
4
|
static description: string;
|
|
5
5
|
static hidden: boolean;
|
|
@@ -7,7 +7,7 @@ export default class EnvironmentVariableCreate 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<
|
|
10
|
+
visibility: import("@oclif/core/lib/interfaces").OptionFlag<"plaintext" | "encrypted" | "sensitive" | undefined>;
|
|
11
11
|
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
12
12
|
value: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
13
13
|
link: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
@@ -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
|
|
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:
|
|
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
|
|
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,9 +9,8 @@ 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;
|
|
16
|
-
private validateFlags;
|
|
17
16
|
}
|