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
|
@@ -3,6 +3,7 @@ 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 dotenv_1 = tslib_1.__importDefault(require("dotenv"));
|
|
6
7
|
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
7
8
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
9
|
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
@@ -12,12 +13,17 @@ const EnvironmentVariablesQuery_1 = require("../../graphql/queries/EnvironmentVa
|
|
|
12
13
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
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 EnvironmentVariablePull extends EasCommand_1.default {
|
|
16
18
|
async runAsync() {
|
|
17
|
-
let { flags: { environment, path: targetPath, 'non-interactive': nonInteractive }, } = await this.parse(_a);
|
|
19
|
+
let { args: { environment: argEnvironment }, flags: { environment: flagEnvironment, path: targetPath, 'non-interactive': nonInteractive }, } = await this.parse(_a);
|
|
20
|
+
let environment = flagEnvironment?.toUpperCase() ?? argEnvironment?.toUpperCase();
|
|
18
21
|
if (!environment) {
|
|
19
22
|
environment = await (0, prompts_2.promptVariableEnvironmentAsync)({ nonInteractive });
|
|
20
23
|
}
|
|
24
|
+
if (!(0, variableUtils_1.isEnvironment)(environment)) {
|
|
25
|
+
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
26
|
+
}
|
|
21
27
|
const { projectId, loggedIn: { graphqlClient }, projectDir, } = await this.getContextAsync(_a, {
|
|
22
28
|
nonInteractive,
|
|
23
29
|
});
|
|
@@ -36,6 +42,10 @@ class EnvironmentVariablePull extends EasCommand_1.default {
|
|
|
36
42
|
throw new Error(`File ${targetPath} already exists.`);
|
|
37
43
|
}
|
|
38
44
|
}
|
|
45
|
+
let currentEnvLocal = {};
|
|
46
|
+
if (await fs.exists(targetPath)) {
|
|
47
|
+
currentEnvLocal = dotenv_1.default.parse(await fs.readFile(targetPath, 'utf8'));
|
|
48
|
+
}
|
|
39
49
|
const filePrefix = `# Environment: ${environment.toLocaleLowerCase()}\n\n`;
|
|
40
50
|
const isFileVariablePresent = environmentVariables.some(v => {
|
|
41
51
|
return v.type === generated_1.EnvironmentSecretType.FileBase64 && v.valueWithFileContent;
|
|
@@ -44,8 +54,15 @@ class EnvironmentVariablePull extends EasCommand_1.default {
|
|
|
44
54
|
if (isFileVariablePresent) {
|
|
45
55
|
await fs.mkdir(envDir, { recursive: true });
|
|
46
56
|
}
|
|
57
|
+
const skippedSecretVariables = [];
|
|
58
|
+
const overridenSecretVariables = [];
|
|
47
59
|
const envFileContentLines = await Promise.all(environmentVariables.map(async (variable) => {
|
|
48
60
|
if (variable.visibility === generated_1.EnvironmentVariableVisibility.Secret) {
|
|
61
|
+
if (currentEnvLocal[variable.name]) {
|
|
62
|
+
overridenSecretVariables.push(variable.name);
|
|
63
|
+
return `${variable.name}=${currentEnvLocal[variable.name]}`;
|
|
64
|
+
}
|
|
65
|
+
skippedSecretVariables.push(variable.name);
|
|
49
66
|
return `# ${variable.name}=***** (secret variables are not available for reading)`;
|
|
50
67
|
}
|
|
51
68
|
if (variable.type === generated_1.EnvironmentSecretType.FileBase64 && variable.valueWithFileContent) {
|
|
@@ -56,14 +73,15 @@ class EnvironmentVariablePull extends EasCommand_1.default {
|
|
|
56
73
|
return `${variable.name}=${variable.value}`;
|
|
57
74
|
}));
|
|
58
75
|
await fs.writeFile(targetPath, filePrefix + envFileContentLines.join('\n'));
|
|
59
|
-
const secretEnvVariables = environmentVariables.filter((variable) => variable.value === null);
|
|
60
|
-
if (secretEnvVariables.length > 0) {
|
|
61
|
-
log_1.default.warn(`The eas env:pull command tried to pull environment variables with "secret" visibility. The variables with "secret" visibility are not available for reading, therefore thet were marked as "*****" in the generated .env file. Provide values for these manually in ${targetPath} if needed. Skipped variables: ${secretEnvVariables
|
|
62
|
-
.map(v => v.name)
|
|
63
|
-
.join('\n')}`);
|
|
64
|
-
log_1.default.warn();
|
|
65
|
-
}
|
|
66
76
|
log_1.default.log(`Pulled environment variables from ${environment.toLowerCase()} environment to ${targetPath}.`);
|
|
77
|
+
if (overridenSecretVariables.length > 0) {
|
|
78
|
+
log_1.default.addNewLineIfNone();
|
|
79
|
+
log_1.default.log(`Reused local values for following secrets: ${overridenSecretVariables.join('\n')}`);
|
|
80
|
+
}
|
|
81
|
+
if (skippedSecretVariables.length > 0) {
|
|
82
|
+
log_1.default.addNewLineIfNone();
|
|
83
|
+
log_1.default.warn(`The following variables have the encrypted visibility and can not be read outside of EAS servers. Set their values manually in .env.local: ${skippedSecretVariables.join('\n')}`);
|
|
84
|
+
}
|
|
67
85
|
}
|
|
68
86
|
}
|
|
69
87
|
_a = EnvironmentVariablePull;
|
|
@@ -74,9 +92,16 @@ EnvironmentVariablePull.contextDefinition = {
|
|
|
74
92
|
..._a.ContextOptions.LoggedIn,
|
|
75
93
|
..._a.ContextOptions.ProjectDir,
|
|
76
94
|
};
|
|
95
|
+
EnvironmentVariablePull.args = [
|
|
96
|
+
{
|
|
97
|
+
name: 'environment',
|
|
98
|
+
description: "Environment to pull variables from. One of 'production', 'preview', or 'development'.",
|
|
99
|
+
required: false,
|
|
100
|
+
},
|
|
101
|
+
];
|
|
77
102
|
EnvironmentVariablePull.flags = {
|
|
78
|
-
...flags_1.EASEnvironmentFlag,
|
|
79
103
|
...flags_1.EASNonInteractiveFlag,
|
|
104
|
+
...flags_1.EASEnvironmentFlag,
|
|
80
105
|
path: core_1.Flags.string({
|
|
81
106
|
description: 'Path to the result `.env` file',
|
|
82
107
|
default: '.env.local',
|
|
@@ -11,6 +11,18 @@ export default class EnvironmentVariablePush extends EasCommand {
|
|
|
11
11
|
path: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
12
12
|
environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment[] | undefined>;
|
|
13
13
|
};
|
|
14
|
+
static args: {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
required: boolean;
|
|
18
|
+
}[];
|
|
14
19
|
runAsync(): Promise<void>;
|
|
20
|
+
parseFlagsAndArgs(flags: {
|
|
21
|
+
path: string;
|
|
22
|
+
environment: EnvironmentVariableEnvironment[] | undefined;
|
|
23
|
+
}, { environment }: Record<string, string>): {
|
|
24
|
+
environment?: EnvironmentVariableEnvironment[];
|
|
25
|
+
path: string;
|
|
26
|
+
};
|
|
15
27
|
private parseEnvFileAsync;
|
|
16
28
|
}
|
|
@@ -14,9 +14,11 @@ const EnvironmentVariablesQuery_1 = require("../../graphql/queries/EnvironmentVa
|
|
|
14
14
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
15
15
|
const prompts_1 = require("../../prompts");
|
|
16
16
|
const prompts_2 = require("../../utils/prompts");
|
|
17
|
+
const variableUtils_1 = require("../../utils/variableUtils");
|
|
17
18
|
class EnvironmentVariablePush extends EasCommand_1.default {
|
|
18
19
|
async runAsync() {
|
|
19
|
-
|
|
20
|
+
const { args, flags } = await this.parse(_a);
|
|
21
|
+
let { environment: environments, path: envPath } = this.parseFlagsAndArgs(flags, args);
|
|
20
22
|
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
|
|
21
23
|
nonInteractive: false,
|
|
22
24
|
});
|
|
@@ -119,6 +121,17 @@ class EnvironmentVariablePush extends EasCommand_1.default {
|
|
|
119
121
|
await EnvironmentVariableMutation_1.EnvironmentVariableMutation.createBulkEnvironmentVariablesForAppAsync(graphqlClient, variablesToPush, projectId);
|
|
120
122
|
log_1.default.log(`Uploaded env file to ${environments.join(', ').toLocaleLowerCase()}.`);
|
|
121
123
|
}
|
|
124
|
+
parseFlagsAndArgs(flags, { environment }) {
|
|
125
|
+
if (environment && !(0, variableUtils_1.isEnvironment)(environment.toUpperCase())) {
|
|
126
|
+
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
127
|
+
}
|
|
128
|
+
const environments = flags.environment ??
|
|
129
|
+
(environment ? [environment.toUpperCase()] : undefined);
|
|
130
|
+
return {
|
|
131
|
+
...flags,
|
|
132
|
+
environment: environments,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
122
135
|
async parseEnvFileAsync(envPath, environments) {
|
|
123
136
|
if (!(await fs_extra_1.default.exists(envPath))) {
|
|
124
137
|
throw new Error(`File ${envPath} does not exist.`);
|
|
@@ -162,4 +175,11 @@ EnvironmentVariablePush.flags = {
|
|
|
162
175
|
default: '.env.local',
|
|
163
176
|
}),
|
|
164
177
|
};
|
|
178
|
+
EnvironmentVariablePush.args = [
|
|
179
|
+
{
|
|
180
|
+
name: 'environment',
|
|
181
|
+
description: "Environment to push variables to. One of 'production', 'preview', or 'development'.",
|
|
182
|
+
required: false,
|
|
183
|
+
},
|
|
184
|
+
];
|
|
165
185
|
exports.default = EnvironmentVariablePush;
|
|
@@ -12,5 +12,11 @@ export default class EnvironmentVariableUnlink extends EasCommand {
|
|
|
12
12
|
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
13
13
|
projectId: import("../../commandUtils/context/ProjectIdContextField").ProjectIdContextField;
|
|
14
14
|
};
|
|
15
|
+
static args: {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
required: boolean;
|
|
19
|
+
}[];
|
|
15
20
|
runAsync(): Promise<void>;
|
|
21
|
+
private validateInputs;
|
|
16
22
|
}
|
|
@@ -16,7 +16,8 @@ const prompts_2 = require("../../utils/prompts");
|
|
|
16
16
|
const variableUtils_1 = require("../../utils/variableUtils");
|
|
17
17
|
class EnvironmentVariableUnlink extends EasCommand_1.default {
|
|
18
18
|
async runAsync() {
|
|
19
|
-
|
|
19
|
+
const { args, flags } = await this.parse(_a);
|
|
20
|
+
let { 'variable-name': name, 'non-interactive': nonInteractive, environment: unlinkEnvironments, } = this.validateInputs(flags, args);
|
|
20
21
|
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
|
|
21
22
|
nonInteractive,
|
|
22
23
|
});
|
|
@@ -74,6 +75,24 @@ class EnvironmentVariableUnlink extends EasCommand_1.default {
|
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
}
|
|
78
|
+
validateInputs(flags, { environment }) {
|
|
79
|
+
if (flags['non-interactive']) {
|
|
80
|
+
if (!flags['variable-name']) {
|
|
81
|
+
throw new Error('Current name is required in non-interactive mode. Run the command with --variable-name flag.');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (environment) {
|
|
85
|
+
environment = environment.toUpperCase();
|
|
86
|
+
if (!(0, variableUtils_1.isEnvironment)(environment)) {
|
|
87
|
+
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
environment: [environment],
|
|
91
|
+
...flags,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return flags;
|
|
95
|
+
}
|
|
77
96
|
}
|
|
78
97
|
_a = EnvironmentVariableUnlink;
|
|
79
98
|
EnvironmentVariableUnlink.description = 'unlink a shared environment variable to the current project';
|
|
@@ -89,4 +108,11 @@ EnvironmentVariableUnlink.contextDefinition = {
|
|
|
89
108
|
..._a.ContextOptions.ProjectId,
|
|
90
109
|
..._a.ContextOptions.LoggedIn,
|
|
91
110
|
};
|
|
111
|
+
EnvironmentVariableUnlink.args = [
|
|
112
|
+
{
|
|
113
|
+
name: 'environment',
|
|
114
|
+
description: "Environment to unlink the variable from. One of 'production', 'preview', or 'development'.",
|
|
115
|
+
required: false,
|
|
116
|
+
},
|
|
117
|
+
];
|
|
92
118
|
exports.default = EnvironmentVariableUnlink;
|
|
@@ -14,6 +14,11 @@ export default class EnvironmentVariableUpdate extends EasCommand {
|
|
|
14
14
|
value: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
15
15
|
type: import("@oclif/core/lib/interfaces").OptionFlag<"string" | "file" | undefined>;
|
|
16
16
|
};
|
|
17
|
+
static args: {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
required: boolean;
|
|
21
|
+
}[];
|
|
17
22
|
static contextDefinition: {
|
|
18
23
|
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
19
24
|
analytics: import("../../commandUtils/context/AnalyticsContextField").default;
|
|
@@ -19,8 +19,8 @@ const prompts_2 = require("../../utils/prompts");
|
|
|
19
19
|
const variableUtils_1 = require("../../utils/variableUtils");
|
|
20
20
|
class EnvironmentVariableUpdate extends EasCommand_1.default {
|
|
21
21
|
async runAsync() {
|
|
22
|
-
const { flags } = await this.parse(_a);
|
|
23
|
-
const { name, value: rawValue, scope, 'variable-name': currentName, 'variable-environment': currentEnvironment, 'non-interactive': nonInteractive, environment: environments, type, visibility, } = this.validateFlags(flags);
|
|
22
|
+
const { args, flags } = await this.parse(_a);
|
|
23
|
+
const { name, value: rawValue, scope, 'variable-name': currentName, 'variable-environment': currentEnvironment, 'non-interactive': nonInteractive, environment: environments, type, visibility, } = this.validateFlags(flags, args);
|
|
24
24
|
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
|
|
25
25
|
nonInteractive,
|
|
26
26
|
});
|
|
@@ -82,7 +82,7 @@ class EnvironmentVariableUpdate extends EasCommand_1.default {
|
|
|
82
82
|
}
|
|
83
83
|
log_1.default.withTick(`Updated variable ${chalk_1.default.bold(selectedVariable.name)} ${suffix}.`);
|
|
84
84
|
}
|
|
85
|
-
validateFlags(flags) {
|
|
85
|
+
validateFlags(flags, { environment }) {
|
|
86
86
|
if (flags['non-interactive']) {
|
|
87
87
|
if (!flags['variable-name']) {
|
|
88
88
|
throw new Error('Current name is required in non-interactive mode. Run the command with --variable-name flag.');
|
|
@@ -91,6 +91,16 @@ class EnvironmentVariableUpdate extends EasCommand_1.default {
|
|
|
91
91
|
throw new Error('Value is required when type is set. Run the command with --value flag.');
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
+
if (environment) {
|
|
95
|
+
environment = environment.toUpperCase();
|
|
96
|
+
if (!(0, variableUtils_1.isEnvironment)(environment)) {
|
|
97
|
+
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
'variable-environment': environment,
|
|
101
|
+
...flags,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
94
104
|
return flags;
|
|
95
105
|
}
|
|
96
106
|
async promptForMissingFlagsAsync(selectedVariable, { name, value, environment: environments, visibility, 'non-interactive': nonInteractive, type, ...rest }) {
|
|
@@ -197,6 +207,13 @@ EnvironmentVariableUpdate.flags = {
|
|
|
197
207
|
...flags_1.EASMultiEnvironmentFlag,
|
|
198
208
|
...flags_1.EASNonInteractiveFlag,
|
|
199
209
|
};
|
|
210
|
+
EnvironmentVariableUpdate.args = [
|
|
211
|
+
{
|
|
212
|
+
name: 'environment',
|
|
213
|
+
description: "Current environment of the variable to update. One of 'production', 'preview', or 'development'.",
|
|
214
|
+
required: false,
|
|
215
|
+
},
|
|
216
|
+
];
|
|
200
217
|
EnvironmentVariableUpdate.contextDefinition = {
|
|
201
218
|
..._a.ContextOptions.ProjectId,
|
|
202
219
|
..._a.ContextOptions.Analytics,
|
|
@@ -59,7 +59,7 @@ class ProjectInit extends EasCommand_1.default {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
static async ensureOwnerSlugConsistencyAsync(graphqlClient, projectId, projectDir, { force, nonInteractive }) {
|
|
62
|
-
const exp = (0, expoConfig_1.
|
|
62
|
+
const exp = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir);
|
|
63
63
|
const appForProjectId = await AppQuery_1.AppQuery.byIdAsync(graphqlClient, projectId);
|
|
64
64
|
const correctOwner = appForProjectId.ownerAccount.name;
|
|
65
65
|
const correctSlug = appForProjectId.slug;
|
|
@@ -107,7 +107,7 @@ class ProjectInit extends EasCommand_1.default {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
static async setExplicitIDAsync(projectId, projectDir, { force, nonInteractive }) {
|
|
110
|
-
const exp = (0, expoConfig_1.
|
|
110
|
+
const exp = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir);
|
|
111
111
|
const existingProjectId = exp.extra?.eas?.projectId;
|
|
112
112
|
if (projectId === existingProjectId) {
|
|
113
113
|
log_1.default.succeed(`Project already linked (ID: ${chalk_1.default.bold(existingProjectId)})`);
|
|
@@ -141,7 +141,7 @@ class ProjectInit extends EasCommand_1.default {
|
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
static async initializeWithoutExplicitIDAsync(graphqlClient, actor, projectDir, { force, nonInteractive }) {
|
|
144
|
-
const exp = (0, expoConfig_1.
|
|
144
|
+
const exp = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir);
|
|
145
145
|
const existingProjectId = exp.extra?.eas?.projectId;
|
|
146
146
|
if (existingProjectId) {
|
|
147
147
|
log_1.default.succeed(`Project already linked (ID: ${chalk_1.default.bold(existingProjectId)}). To re-configure, remove the "extra.eas.projectId" field from your app config.`);
|
|
@@ -236,7 +236,7 @@ Onboarding.contextDefinition = {
|
|
|
236
236
|
exports.default = Onboarding;
|
|
237
237
|
// we can't get this automated by using command context because when we run a command the project directory doesn't exist yet
|
|
238
238
|
async function getPrivateExpoConfigWithProjectIdAsync({ projectDir, graphqlClient, actor, options, }) {
|
|
239
|
-
const expBefore = (0, expoConfig_1.
|
|
239
|
+
const expBefore = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir, options);
|
|
240
240
|
const projectId = await (0, getProjectIdAsync_1.validateOrSetProjectIdAsync)({
|
|
241
241
|
exp: expBefore,
|
|
242
242
|
graphqlClient,
|
|
@@ -246,7 +246,7 @@ async function getPrivateExpoConfigWithProjectIdAsync({ projectDir, graphqlClien
|
|
|
246
246
|
},
|
|
247
247
|
cwd: projectDir,
|
|
248
248
|
});
|
|
249
|
-
const exp = (0, expoConfig_1.
|
|
249
|
+
const exp = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir, options);
|
|
250
250
|
return {
|
|
251
251
|
exp,
|
|
252
252
|
projectId,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
+
import { RequestedPlatform } from '../../platform';
|
|
2
3
|
export default class UpdateConfigure extends EasCommand {
|
|
3
4
|
static description: string;
|
|
4
5
|
static flags: {
|
|
5
6
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
6
|
-
|
|
7
|
+
'with-eas-environment-variables-set': import("@oclif/core/lib/interfaces").OptionFlag<import("../../graphql/generated").EnvironmentVariableEnvironment | null>;
|
|
8
|
+
platform: import("@oclif/core/lib/interfaces").OptionFlag<RequestedPlatform>;
|
|
7
9
|
};
|
|
8
10
|
static contextDefinition: {
|
|
9
11
|
vcsClient: import("../../commandUtils/context/VcsClientContextField").default;
|
|
@@ -8,14 +8,14 @@ const configure_1 = require("../../build/configure");
|
|
|
8
8
|
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
9
9
|
const flags_1 = require("../../commandUtils/flags");
|
|
10
10
|
const log_1 = tslib_1.__importStar(require("../../log"));
|
|
11
|
+
const platform_1 = require("../../platform");
|
|
11
12
|
const configure_2 = require("../../update/configure");
|
|
12
13
|
class UpdateConfigure extends EasCommand_1.default {
|
|
13
14
|
async runAsync() {
|
|
14
15
|
const { flags } = await this.parse(_a);
|
|
15
|
-
const platform = flags.platform;
|
|
16
16
|
const { privateProjectConfig: { projectId, exp, projectDir }, vcsClient, } = await this.getContextAsync(_a, {
|
|
17
17
|
nonInteractive: flags['non-interactive'],
|
|
18
|
-
withServerSideEnvironment:
|
|
18
|
+
withServerSideEnvironment: flags['with-eas-environment-variables-set'],
|
|
19
19
|
});
|
|
20
20
|
log_1.default.log('💡 The following process will configure your project to use EAS Update. These changes only apply to your local project files and you can safely revert them at any time.');
|
|
21
21
|
await vcsClient.ensureRepoExistsAsync();
|
|
@@ -23,7 +23,7 @@ class UpdateConfigure extends EasCommand_1.default {
|
|
|
23
23
|
exp,
|
|
24
24
|
projectId,
|
|
25
25
|
projectDir,
|
|
26
|
-
platform,
|
|
26
|
+
platform: flags['platform'],
|
|
27
27
|
vcsClient,
|
|
28
28
|
env: undefined,
|
|
29
29
|
});
|
|
@@ -46,9 +46,10 @@ UpdateConfigure.flags = {
|
|
|
46
46
|
platform: core_1.Flags.enum({
|
|
47
47
|
description: 'Platform to configure',
|
|
48
48
|
char: 'p',
|
|
49
|
-
options:
|
|
50
|
-
default:
|
|
49
|
+
options: Object.values(platform_1.RequestedPlatform),
|
|
50
|
+
default: platform_1.RequestedPlatform.All,
|
|
51
51
|
}),
|
|
52
|
+
...flags_1.WithEasEnvironmentVariablesSetFlag,
|
|
52
53
|
...flags_1.EASNonInteractiveFlag,
|
|
53
54
|
};
|
|
54
55
|
UpdateConfigure.contextDefinition = {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
+
import { EnvironmentVariableEnvironment } from '../../graphql/generated';
|
|
3
|
+
import { RequestedPlatform } from '../../platform';
|
|
2
4
|
export default class UpdatePublish extends EasCommand {
|
|
3
5
|
static description: string;
|
|
4
6
|
static flags: {
|
|
5
7
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
6
8
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
'with-eas-environment-variables-set': import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment | null>;
|
|
7
10
|
branch: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
8
11
|
channel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
9
12
|
message: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
@@ -12,10 +15,9 @@ export default class UpdatePublish extends EasCommand {
|
|
|
12
15
|
'clear-cache': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
16
|
'emit-metadata': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
17
|
'rollout-percentage': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
|
|
15
|
-
platform: import("@oclif/core/lib/interfaces").OptionFlag<
|
|
18
|
+
platform: import("@oclif/core/lib/interfaces").OptionFlag<RequestedPlatform>;
|
|
16
19
|
auto: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
20
|
'private-key-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
18
|
-
'with-eas-environment-variables-set': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
19
21
|
};
|
|
20
22
|
static contextDefinition: {
|
|
21
23
|
getServerSideEnvironmentVariablesAsync: import("../../commandUtils/context/ServerSideEnvironmentVariablesContextField").ServerSideEnvironmentVariablesContextField;
|
|
@@ -18,6 +18,7 @@ const generated_1 = require("../../graphql/generated");
|
|
|
18
18
|
const PublishMutation_1 = require("../../graphql/mutations/PublishMutation");
|
|
19
19
|
const log_1 = tslib_1.__importStar(require("../../log"));
|
|
20
20
|
const ora_1 = require("../../ora");
|
|
21
|
+
const platform_1 = require("../../platform");
|
|
21
22
|
const maybeUploadFingerprintAsync_1 = require("../../project/maybeUploadFingerprintAsync");
|
|
22
23
|
const projectUtils_1 = require("../../project/projectUtils");
|
|
23
24
|
const publish_1 = require("../../project/publish");
|
|
@@ -37,7 +38,7 @@ class UpdatePublish extends EasCommand_1.default {
|
|
|
37
38
|
const { auto: autoFlag, platform: requestedPlatform, channelName: channelNameArg, updateMessage: updateMessageArg, inputDir, skipBundler, clearCache, privateKeyPath, json: jsonFlag, nonInteractive, branchName: branchNameArg, emitMetadata, rolloutPercentage, withEasEnvironmentVariablesSet, } = this.sanitizeFlags(rawFlags);
|
|
38
39
|
const { getDynamicPublicProjectConfigAsync, getDynamicPrivateProjectConfigAsync, loggedIn: { graphqlClient }, vcsClient, getServerSideEnvironmentVariablesAsync, } = await this.getContextAsync(_a, {
|
|
39
40
|
nonInteractive,
|
|
40
|
-
withServerSideEnvironment: withEasEnvironmentVariablesSet
|
|
41
|
+
withServerSideEnvironment: withEasEnvironmentVariablesSet,
|
|
41
42
|
});
|
|
42
43
|
if (jsonFlag) {
|
|
43
44
|
(0, json_1.enableJsonOutput)();
|
|
@@ -379,12 +380,6 @@ class UpdatePublish extends EasCommand_1.default {
|
|
|
379
380
|
emitMetadata = false;
|
|
380
381
|
log_1.default.warn('ignoring flag --emit-metadata as metadata cannot be generated when skipping bundle generation');
|
|
381
382
|
}
|
|
382
|
-
if (flags['with-eas-environment-variables-set'] &&
|
|
383
|
-
!Object.values(generated_1.EnvironmentVariableEnvironment).includes(flags['with-eas-environment-variables-set'])) {
|
|
384
|
-
core_1.Errors.error(`--with-eas-environment-variables-set must be one of ${Object.values(generated_1.EnvironmentVariableEnvironment)
|
|
385
|
-
.map(env => `"${env.toLocaleLowerCase()}"`)
|
|
386
|
-
.join(', ')}`, { exit: 1 });
|
|
387
|
-
}
|
|
388
383
|
return {
|
|
389
384
|
auto,
|
|
390
385
|
branchName,
|
|
@@ -444,12 +439,8 @@ UpdatePublish.flags = {
|
|
|
444
439
|
}),
|
|
445
440
|
platform: core_1.Flags.enum({
|
|
446
441
|
char: 'p',
|
|
447
|
-
options:
|
|
448
|
-
|
|
449
|
-
...publish_1.defaultPublishPlatforms,
|
|
450
|
-
'all',
|
|
451
|
-
],
|
|
452
|
-
default: 'all',
|
|
442
|
+
options: Object.values(platform_1.RequestedPlatform), // TODO: Add web when it's fully supported
|
|
443
|
+
default: platform_1.RequestedPlatform.All,
|
|
453
444
|
required: false,
|
|
454
445
|
}),
|
|
455
446
|
auto: core_1.Flags.boolean({
|
|
@@ -460,18 +451,7 @@ UpdatePublish.flags = {
|
|
|
460
451
|
description: `File containing the PEM-encoded private key corresponding to the certificate in expo-updates' configuration. Defaults to a file named "private-key.pem" in the certificate's directory. Only relevant if you are using code signing: https://docs.expo.dev/eas-update/code-signing/`,
|
|
461
452
|
required: false,
|
|
462
453
|
}),
|
|
463
|
-
|
|
464
|
-
description: 'Environment to use for EAS environment variables',
|
|
465
|
-
options: [
|
|
466
|
-
generated_1.EnvironmentVariableEnvironment.Development,
|
|
467
|
-
generated_1.EnvironmentVariableEnvironment.Preview,
|
|
468
|
-
generated_1.EnvironmentVariableEnvironment.Production,
|
|
469
|
-
].map(env => env.toLowerCase()),
|
|
470
|
-
// eslint-disable-next-line async-protect/async-suffix
|
|
471
|
-
parse: async (input) => input.toUpperCase(),
|
|
472
|
-
required: false,
|
|
473
|
-
hidden: true,
|
|
474
|
-
}),
|
|
454
|
+
...flags_1.WithEasEnvironmentVariablesSetFlag,
|
|
475
455
|
...flags_1.EasNonInteractiveAndJsonFlags,
|
|
476
456
|
};
|
|
477
457
|
UpdatePublish.contextDefinition = {
|
|
@@ -61,11 +61,11 @@ async function promptUserAndCopyLegacyCredentialsAsync(ctx, app) {
|
|
|
61
61
|
}
|
|
62
62
|
exports.promptUserAndCopyLegacyCredentialsAsync = promptUserAndCopyLegacyCredentialsAsync;
|
|
63
63
|
async function getAppLookupParamsFromContextAsync(ctx, gradleContext) {
|
|
64
|
-
ctx.
|
|
65
|
-
const projectName =
|
|
66
|
-
const projectId = ctx.
|
|
64
|
+
const exp = await ctx.getExpoConfigAsync();
|
|
65
|
+
const projectName = exp.slug;
|
|
66
|
+
const projectId = await ctx.getProjectIdAsync();
|
|
67
67
|
const account = await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(ctx.graphqlClient, projectId);
|
|
68
|
-
const androidApplicationIdentifier = await (0, applicationId_1.getApplicationIdAsync)(ctx.projectDir,
|
|
68
|
+
const androidApplicationIdentifier = await (0, applicationId_1.getApplicationIdAsync)(ctx.projectDir, exp, ctx.vcsClient, gradleContext);
|
|
69
69
|
if (!androidApplicationIdentifier) {
|
|
70
70
|
throw new errors_1.AndroidPackageNotDefinedError(`android.package needs to be defined in your ${(0, projectUtils_1.getProjectConfigDescription)(ctx.projectDir)} file`);
|
|
71
71
|
}
|
|
@@ -15,7 +15,7 @@ class CreateKeystore {
|
|
|
15
15
|
if (ctx.nonInteractive) {
|
|
16
16
|
throw new Error(`New keystore cannot be created in non-interactive mode.`);
|
|
17
17
|
}
|
|
18
|
-
const projectId = ctx.
|
|
18
|
+
const projectId = await ctx.getProjectIdAsync();
|
|
19
19
|
const keystore = await this.provideOrGenerateAsync(ctx.graphqlClient, ctx.analytics, projectId);
|
|
20
20
|
const keystoreFragment = await ctx.android.createKeystoreAsync(ctx.graphqlClient, this.account, keystore);
|
|
21
21
|
log_1.default.succeed('Created keystore');
|
|
@@ -40,8 +40,8 @@ export declare class CredentialsContext {
|
|
|
40
40
|
env?: Env;
|
|
41
41
|
});
|
|
42
42
|
get hasProjectContext(): boolean;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
getExpoConfigAsync(): Promise<ExpoConfig>;
|
|
44
|
+
getProjectIdAsync(): Promise<string>;
|
|
45
|
+
ensureProjectContextAsync(): Promise<void>;
|
|
46
46
|
bestEffortAppStoreAuthenticateAsync(): Promise<void>;
|
|
47
47
|
}
|
|
@@ -31,20 +31,20 @@ class CredentialsContext {
|
|
|
31
31
|
get hasProjectContext() {
|
|
32
32
|
return !!this.projectInfo;
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
this.
|
|
34
|
+
async getExpoConfigAsync() {
|
|
35
|
+
await this.ensureProjectContextAsync();
|
|
36
36
|
return this.projectInfo.exp;
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
this.
|
|
38
|
+
async getProjectIdAsync() {
|
|
39
|
+
await this.ensureProjectContextAsync();
|
|
40
40
|
return this.projectInfo.projectId;
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
async ensureProjectContextAsync() {
|
|
43
43
|
if (this.hasProjectContext) {
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
// trigger getConfig error
|
|
47
|
-
(0, expoConfig_1.
|
|
47
|
+
await (0, expoConfig_1.getPrivateExpoConfigAsync)(this.options.projectDir);
|
|
48
48
|
}
|
|
49
49
|
async bestEffortAppStoreAuthenticateAsync() {
|
|
50
50
|
if (!!this.appStore.authCtx || !this.shouldAskAuthenticateAppStore) {
|
|
@@ -47,9 +47,9 @@ async function assignBuildCredentialsAsync(ctx, app, iosDistributionType, distCe
|
|
|
47
47
|
}
|
|
48
48
|
exports.assignBuildCredentialsAsync = assignBuildCredentialsAsync;
|
|
49
49
|
async function getAppFromContextAsync(ctx) {
|
|
50
|
-
ctx.
|
|
51
|
-
const projectName =
|
|
52
|
-
const projectId = ctx.
|
|
50
|
+
const exp = await ctx.getExpoConfigAsync();
|
|
51
|
+
const projectName = exp.slug;
|
|
52
|
+
const projectId = await ctx.getProjectIdAsync();
|
|
53
53
|
const account = await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(ctx.graphqlClient, projectId);
|
|
54
54
|
return {
|
|
55
55
|
account,
|
|
@@ -73,7 +73,7 @@ class ManageIos {
|
|
|
73
73
|
return await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(ctx.graphqlClient, projectId);
|
|
74
74
|
};
|
|
75
75
|
const account = ctx.hasProjectContext
|
|
76
|
-
? await getAccountForProjectAsync(ctx.
|
|
76
|
+
? await getAccountForProjectAsync(await ctx.getProjectIdAsync())
|
|
77
77
|
: (0, actions_1.ensureActorHasPrimaryAccount)(ctx.user);
|
|
78
78
|
let app = null;
|
|
79
79
|
let targets = null;
|
|
@@ -160,15 +160,16 @@ class ManageIos {
|
|
|
160
160
|
}
|
|
161
161
|
async createProjectContextAsync(ctx, account, buildProfile) {
|
|
162
162
|
(0, assert_1.default)(ctx.hasProjectContext, 'createProjectContextAsync: must have project context.');
|
|
163
|
-
const
|
|
163
|
+
const exp = await ctx.getExpoConfigAsync();
|
|
164
|
+
const app = { account, projectName: exp.slug };
|
|
164
165
|
const xcodeBuildContext = await (0, scheme_1.resolveXcodeBuildContextAsync)({
|
|
165
166
|
projectDir: ctx.projectDir,
|
|
166
167
|
nonInteractive: ctx.nonInteractive,
|
|
167
|
-
exp
|
|
168
|
+
exp,
|
|
168
169
|
vcsClient: ctx.vcsClient,
|
|
169
170
|
}, buildProfile);
|
|
170
171
|
const targets = await (0, target_1.resolveTargetsAsync)({
|
|
171
|
-
exp
|
|
172
|
+
exp,
|
|
172
173
|
projectDir: ctx.projectDir,
|
|
173
174
|
xcodeBuildContext,
|
|
174
175
|
env: buildProfile.env,
|
|
@@ -42,7 +42,7 @@ class SetUpIosBuildCredentials extends ManageIos_1.ManageIos {
|
|
|
42
42
|
return await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(ctx.graphqlClient, projectId);
|
|
43
43
|
};
|
|
44
44
|
const account = ctx.hasProjectContext
|
|
45
|
-
? await getAccountForProjectAsync(ctx.
|
|
45
|
+
? await getAccountForProjectAsync(await ctx.getProjectIdAsync())
|
|
46
46
|
: (0, actions_1.ensureActorHasPrimaryAccount)(ctx.user);
|
|
47
47
|
let app = null;
|
|
48
48
|
let targets = null;
|
|
@@ -13,7 +13,7 @@ export interface ExpoConfigOptions {
|
|
|
13
13
|
export declare function createOrModifyExpoConfigAsync(projectDir: string, exp: Partial<ExpoConfig>, readOptions?: {
|
|
14
14
|
skipSDKVersionRequirement?: boolean;
|
|
15
15
|
}): ReturnType<typeof modifyConfigAsync>;
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function getPrivateExpoConfigAsync(projectDir: string, opts?: ExpoConfigOptions): Promise<ExpoConfig>;
|
|
17
17
|
export declare function ensureExpoConfigExists(projectDir: string): void;
|
|
18
18
|
export declare function isUsingStaticExpoConfig(projectDir: string): boolean;
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function getPublicExpoConfigAsync(projectDir: string, opts?: ExpoConfigOptions): Promise<PublicExpoConfig>;
|