eas-cli 16.13.3 → 16.14.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 +128 -78
- package/build/commands/env/create.d.ts +0 -1
- package/build/commands/env/create.js +1 -28
- package/build/commands/update/delete.js +2 -20
- package/build/commands/update/republish.js +2 -139
- package/build/commands/update/revert-update-rollout.d.ts +24 -0
- package/build/commands/update/revert-update-rollout.js +264 -0
- package/build/commands/update/roll-back-to-embedded.d.ts +0 -2
- package/build/commands/update/roll-back-to-embedded.js +13 -133
- package/build/commands/upload.d.ts +0 -1
- package/build/commands/upload.js +0 -1
- package/build/graphql/generated.d.ts +91 -109
- package/build/graphql/generated.js +15 -3
- package/build/graphql/mutations/EnvironmentVariableMutation.d.ts +0 -2
- package/build/graphql/mutations/EnvironmentVariableMutation.js +0 -48
- package/build/graphql/types/Update.js +1 -0
- package/build/project/publish.js +1 -0
- package/build/update/delete.d.ts +5 -0
- package/build/update/delete.js +24 -0
- package/build/update/queries.d.ts +13 -1
- package/build/update/queries.js +62 -1
- package/build/update/republish.d.ts +27 -0
- package/build/update/republish.js +242 -1
- package/build/update/roll-back-to-embedded.d.ts +18 -0
- package/build/update/roll-back-to-embedded.js +119 -0
- package/build/user/fetchUser.js +15 -13
- package/build/utils/statuspageService.js +1 -0
- package/oclif.manifest.json +78 -115
- package/package.json +3 -2
- package/build/commands/env/link.d.ts +0 -23
- package/build/commands/env/link.js +0 -128
- package/build/commands/env/unlink.d.ts +0 -22
- package/build/commands/env/unlink.js +0 -117
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const core_1 = require("@oclif/core");
|
|
5
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
-
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
7
|
-
const flags_1 = require("../../commandUtils/flags");
|
|
8
|
-
const generated_1 = require("../../graphql/generated");
|
|
9
|
-
const EnvironmentVariableMutation_1 = require("../../graphql/mutations/EnvironmentVariableMutation");
|
|
10
|
-
const EnvironmentVariablesQuery_1 = require("../../graphql/queries/EnvironmentVariablesQuery");
|
|
11
|
-
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
12
|
-
const projectUtils_1 = require("../../project/projectUtils");
|
|
13
|
-
const prompts_1 = require("../../prompts");
|
|
14
|
-
const prompts_2 = require("../../utils/prompts");
|
|
15
|
-
const variableUtils_1 = require("../../utils/variableUtils");
|
|
16
|
-
class EnvUnlink extends EasCommand_1.default {
|
|
17
|
-
static description = 'unlink an account-wide environment variable from the current project';
|
|
18
|
-
// for now we only roll out global account-wide env variables so this should stay hidden
|
|
19
|
-
static hidden = true;
|
|
20
|
-
static flags = {
|
|
21
|
-
'variable-name': core_1.Flags.string({
|
|
22
|
-
description: 'Name of the variable',
|
|
23
|
-
}),
|
|
24
|
-
...flags_1.EASMultiEnvironmentFlag,
|
|
25
|
-
...flags_1.EASNonInteractiveFlag,
|
|
26
|
-
};
|
|
27
|
-
static contextDefinition = {
|
|
28
|
-
...this.ContextOptions.ProjectId,
|
|
29
|
-
...this.ContextOptions.LoggedIn,
|
|
30
|
-
};
|
|
31
|
-
static args = [
|
|
32
|
-
{
|
|
33
|
-
name: 'environment',
|
|
34
|
-
description: "Environment to unlink the variable from. One of 'production', 'preview', or 'development'.",
|
|
35
|
-
required: false,
|
|
36
|
-
},
|
|
37
|
-
];
|
|
38
|
-
async runAsync() {
|
|
39
|
-
const { args, flags } = await this.parse(EnvUnlink);
|
|
40
|
-
let { 'variable-name': name, 'non-interactive': nonInteractive, environment: unlinkEnvironments, } = this.validateInputs(flags, args);
|
|
41
|
-
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(EnvUnlink, {
|
|
42
|
-
nonInteractive,
|
|
43
|
-
});
|
|
44
|
-
const projectDisplayName = await (0, projectUtils_1.getDisplayNameForProjectIdAsync)(graphqlClient, projectId);
|
|
45
|
-
const variables = await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.sharedAsync(graphqlClient, {
|
|
46
|
-
appId: projectId,
|
|
47
|
-
filterNames: name ? [name] : undefined,
|
|
48
|
-
});
|
|
49
|
-
let selectedVariable = variables[0];
|
|
50
|
-
if (variables.length > 1) {
|
|
51
|
-
if (nonInteractive) {
|
|
52
|
-
throw new Error("Multiple variables found, please select one using '--variable-name'");
|
|
53
|
-
}
|
|
54
|
-
selectedVariable = await (0, prompts_1.selectAsync)('Select account-wide variable', variables.map(variable => ({
|
|
55
|
-
title: (0, variableUtils_1.formatVariableName)(variable),
|
|
56
|
-
value: variable,
|
|
57
|
-
})));
|
|
58
|
-
}
|
|
59
|
-
if (!selectedVariable) {
|
|
60
|
-
throw new Error(`Account-wide variable ${name} doesn't exist`);
|
|
61
|
-
}
|
|
62
|
-
let explicitSelect = false;
|
|
63
|
-
if (!nonInteractive && !unlinkEnvironments) {
|
|
64
|
-
const selectedEnvironments = (selectedVariable.linkedEnvironments ?? []).length > 0
|
|
65
|
-
? selectedVariable.linkedEnvironments
|
|
66
|
-
: selectedVariable.environments;
|
|
67
|
-
const environments = await (0, prompts_2.promptVariableEnvironmentAsync)({
|
|
68
|
-
nonInteractive,
|
|
69
|
-
multiple: true,
|
|
70
|
-
selectedEnvironments: selectedEnvironments ?? [],
|
|
71
|
-
});
|
|
72
|
-
explicitSelect = true;
|
|
73
|
-
unlinkEnvironments = Object.values(generated_1.EnvironmentVariableEnvironment).filter(env => !environments.includes(env));
|
|
74
|
-
}
|
|
75
|
-
if (!unlinkEnvironments) {
|
|
76
|
-
await EnvironmentVariableMutation_1.EnvironmentVariableMutation.unlinkSharedEnvironmentVariableAsync(graphqlClient, selectedVariable.id, projectId);
|
|
77
|
-
log_1.default.withTick(`Unlinked variable ${chalk_1.default.bold(selectedVariable.name)} from project ${chalk_1.default.bold(projectDisplayName)} in ${selectedVariable.environments?.join(', ').toLocaleLowerCase()}.`);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
for (const environment of Object.values(generated_1.EnvironmentVariableEnvironment)) {
|
|
81
|
-
if (selectedVariable.linkedEnvironments?.includes(environment) !==
|
|
82
|
-
unlinkEnvironments.includes(environment)) {
|
|
83
|
-
if (!explicitSelect && unlinkEnvironments.includes(environment)) {
|
|
84
|
-
log_1.default.withTick(`Variable ${chalk_1.default.bold(selectedVariable.name)} is already unlinked from ${environment.toLocaleLowerCase()}.`);
|
|
85
|
-
}
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
if (unlinkEnvironments.includes(environment)) {
|
|
89
|
-
await EnvironmentVariableMutation_1.EnvironmentVariableMutation.unlinkSharedEnvironmentVariableAsync(graphqlClient, selectedVariable.id, projectId, environment);
|
|
90
|
-
log_1.default.withTick(`Unlinked variable ${chalk_1.default.bold(selectedVariable.name)} from project ${chalk_1.default.bold(projectDisplayName)} in ${environment.toLocaleLowerCase()}.`);
|
|
91
|
-
}
|
|
92
|
-
else if (explicitSelect) {
|
|
93
|
-
await EnvironmentVariableMutation_1.EnvironmentVariableMutation.linkSharedEnvironmentVariableAsync(graphqlClient, selectedVariable.id, projectId, environment);
|
|
94
|
-
log_1.default.withTick(`Linked variable ${chalk_1.default.bold(selectedVariable.name)} to project ${chalk_1.default.bold(projectDisplayName)} in ${environment.toLocaleLowerCase()}.`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
validateInputs(flags, { environment }) {
|
|
99
|
-
if (flags['non-interactive']) {
|
|
100
|
-
if (!flags['variable-name']) {
|
|
101
|
-
throw new Error('Current name is required in non-interactive mode. Run the command with --variable-name flag.');
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
if (environment) {
|
|
105
|
-
environment = environment.toUpperCase();
|
|
106
|
-
if (!(0, variableUtils_1.isEnvironment)(environment)) {
|
|
107
|
-
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
108
|
-
}
|
|
109
|
-
return {
|
|
110
|
-
environment: [environment],
|
|
111
|
-
...flags,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
return flags;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
exports.default = EnvUnlink;
|