eas-cli 16.22.0 → 16.23.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 +208 -207
- package/build/build/android/graphql.js +1 -2
- package/build/build/evaluateConfigWithEnvVarsAsync.js +5 -11
- package/build/build/ios/graphql.js +1 -2
- package/build/build/utils/environment.d.ts +1 -4
- package/build/build/utils/environment.js +7 -24
- package/build/commandUtils/EasCommand.d.ts +1 -2
- package/build/commandUtils/context/ContextField.d.ts +1 -2
- package/build/commandUtils/context/contextUtils/loadServerSideEnvironmentVariablesAsync.d.ts +1 -2
- package/build/commandUtils/context/contextUtils/loadServerSideEnvironmentVariablesAsync.js +3 -8
- package/build/commandUtils/flags.d.ts +3 -5
- package/build/commandUtils/flags.js +8 -22
- package/build/commands/build/resign.d.ts +2 -3
- package/build/commands/deploy/index.d.ts +1 -2
- package/build/commands/env/create.d.ts +1 -2
- package/build/commands/env/create.js +12 -14
- package/build/commands/env/delete.d.ts +1 -2
- package/build/commands/env/delete.js +2 -6
- package/build/commands/env/exec.js +6 -7
- package/build/commands/env/get.d.ts +1 -2
- package/build/commands/env/get.js +4 -6
- package/build/commands/env/list.d.ts +1 -2
- package/build/commands/env/list.js +8 -6
- package/build/commands/env/pull.d.ts +1 -1
- package/build/commands/env/pull.js +8 -8
- package/build/commands/env/push.d.ts +6 -4
- package/build/commands/env/push.js +42 -30
- package/build/commands/env/update.d.ts +2 -3
- package/build/commands/env/update.js +7 -8
- package/build/commands/fingerprint/compare.d.ts +1 -2
- package/build/commands/fingerprint/compare.js +1 -1
- package/build/commands/fingerprint/generate.d.ts +1 -2
- package/build/commands/fingerprint/generate.js +1 -1
- package/build/commands/update/configure.d.ts +1 -1
- package/build/commands/update/configure.js +1 -1
- package/build/commands/update/index.d.ts +1 -2
- package/build/commands/update/index.js +1 -1
- package/build/graphql/generated.d.ts +14 -0
- package/build/graphql/queries/EnvironmentVariablesQuery.d.ts +6 -6
- package/build/graphql/queries/EnvironmentVariablesQuery.js +15 -0
- package/build/utils/prompts.d.ts +8 -5
- package/build/utils/prompts.js +69 -10
- package/build/utils/variableUtils.d.ts +1 -3
- package/build/utils/variableUtils.js +1 -6
- package/build/worker/assets.d.ts +1 -2
- package/oclif.manifest.json +36 -110
- package/package.json +4 -4
|
@@ -4,7 +4,6 @@ exports.transformJob = void 0;
|
|
|
4
4
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
5
5
|
const generated_1 = require("../../graphql/generated");
|
|
6
6
|
const graphql_1 = require("../graphql");
|
|
7
|
-
const environment_1 = require("../utils/environment");
|
|
8
7
|
function transformJob(job) {
|
|
9
8
|
return {
|
|
10
9
|
type: (0, graphql_1.transformWorkflow)(job.type),
|
|
@@ -25,7 +24,7 @@ function transformJob(job) {
|
|
|
25
24
|
experimental: job.experimental,
|
|
26
25
|
mode: (0, graphql_1.transformBuildMode)(job.mode),
|
|
27
26
|
customBuildConfig: job.customBuildConfig,
|
|
28
|
-
environment:
|
|
27
|
+
environment: job.environment,
|
|
29
28
|
loggerLevel: job.loggerLevel
|
|
30
29
|
? graphql_1.loggerLevelToGraphQLWorkerLoggerLevel[job.loggerLevel]
|
|
31
30
|
: undefined,
|
|
@@ -23,14 +23,8 @@ async function evaluateConfigWithEnvVarsAsync({ buildProfile, buildProfileName,
|
|
|
23
23
|
}
|
|
24
24
|
exports.evaluateConfigWithEnvVarsAsync = evaluateConfigWithEnvVarsAsync;
|
|
25
25
|
async function resolveEnvVarsAsync({ buildProfile, buildProfileName, graphqlClient, projectId, }) {
|
|
26
|
-
const environment = buildProfile.environment
|
|
26
|
+
const environment = buildProfile.environment ??
|
|
27
27
|
resolveSuggestedEnvironmentForBuildProfileConfiguration(buildProfile);
|
|
28
|
-
if (!(0, environment_1.isEnvironment)(environment)) {
|
|
29
|
-
log_1.default.log(`Loaded "env" configuration for the "${buildProfileName}" profile: ${buildProfile.env && Object.keys(buildProfile.env).length > 0
|
|
30
|
-
? Object.keys(buildProfile.env).join(', ')
|
|
31
|
-
: 'no environment variables specified'}. ${(0, log_1.learnMore)('https://docs.expo.dev/build-reference/variables/')}`);
|
|
32
|
-
return { ...buildProfile.env };
|
|
33
|
-
}
|
|
34
28
|
try {
|
|
35
29
|
const environmentVariables = await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.byAppIdWithSensitiveAsync(graphqlClient, {
|
|
36
30
|
appId: projectId,
|
|
@@ -68,10 +62,10 @@ async function resolveEnvVarsAsync({ buildProfile, buildProfileName, graphqlClie
|
|
|
68
62
|
}
|
|
69
63
|
function resolveSuggestedEnvironmentForBuildProfileConfiguration(buildProfile) {
|
|
70
64
|
const environment = buildProfile.distribution === 'store'
|
|
71
|
-
? environment_1.
|
|
65
|
+
? environment_1.DefaultEnvironment.Production
|
|
72
66
|
: buildProfile.developmentClient
|
|
73
|
-
? environment_1.
|
|
74
|
-
: environment_1.
|
|
75
|
-
log_1.default.log(`Resolved "${environment
|
|
67
|
+
? environment_1.DefaultEnvironment.Development
|
|
68
|
+
: environment_1.DefaultEnvironment.Preview;
|
|
69
|
+
log_1.default.log(`Resolved "${environment}" environment for the build. ${(0, log_1.learnMore)('https://docs.expo.dev/eas/environment-variables/#setting-the-environment-for-your-builds')}`);
|
|
76
70
|
return environment;
|
|
77
71
|
}
|
|
@@ -4,7 +4,6 @@ exports.transformIosSecrets = exports.transformJob = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
|
|
6
6
|
const graphql_1 = require("../graphql");
|
|
7
|
-
const environment_1 = require("../utils/environment");
|
|
8
7
|
function transformJob(job) {
|
|
9
8
|
return {
|
|
10
9
|
type: (0, graphql_1.transformWorkflow)(job.type),
|
|
@@ -26,7 +25,7 @@ function transformJob(job) {
|
|
|
26
25
|
experimental: job.experimental,
|
|
27
26
|
mode: (0, graphql_1.transformBuildMode)(job.mode),
|
|
28
27
|
customBuildConfig: job.customBuildConfig,
|
|
29
|
-
environment:
|
|
28
|
+
environment: job.environment,
|
|
30
29
|
loggerLevel: job.loggerLevel
|
|
31
30
|
? graphql_1.loggerLevelToGraphQLWorkerLoggerLevel[job.loggerLevel]
|
|
32
31
|
: undefined,
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export declare enum EnvironmentVariableEnvironment {
|
|
1
|
+
export declare enum DefaultEnvironment {
|
|
3
2
|
Development = "development",
|
|
4
3
|
Preview = "preview",
|
|
5
4
|
Production = "production"
|
|
6
5
|
}
|
|
7
|
-
export declare function isEnvironment(env: string): env is EnvironmentVariableEnvironment;
|
|
8
|
-
export declare function buildProfileEnvironmentToEnvironment(environment: BuildProfile['environment']): EnvironmentVariableEnvironment | null;
|
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
})(EnvironmentVariableEnvironment || (exports.EnvironmentVariableEnvironment = EnvironmentVariableEnvironment = {}));
|
|
11
|
-
const BuildProfileEnvironmentToEnvironment = {
|
|
12
|
-
production: EnvironmentVariableEnvironment.Production,
|
|
13
|
-
preview: EnvironmentVariableEnvironment.Preview,
|
|
14
|
-
development: EnvironmentVariableEnvironment.Development,
|
|
15
|
-
};
|
|
16
|
-
function isEnvironment(env) {
|
|
17
|
-
return Object.values(EnvironmentVariableEnvironment).includes(env.toLowerCase());
|
|
18
|
-
}
|
|
19
|
-
exports.isEnvironment = isEnvironment;
|
|
20
|
-
function buildProfileEnvironmentToEnvironment(environment) {
|
|
21
|
-
if (!environment) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
return BuildProfileEnvironmentToEnvironment[environment];
|
|
25
|
-
}
|
|
26
|
-
exports.buildProfileEnvironmentToEnvironment = buildProfileEnvironmentToEnvironment;
|
|
3
|
+
exports.DefaultEnvironment = void 0;
|
|
4
|
+
var DefaultEnvironment;
|
|
5
|
+
(function (DefaultEnvironment) {
|
|
6
|
+
DefaultEnvironment["Development"] = "development";
|
|
7
|
+
DefaultEnvironment["Preview"] = "preview";
|
|
8
|
+
DefaultEnvironment["Production"] = "production";
|
|
9
|
+
})(DefaultEnvironment || (exports.DefaultEnvironment = DefaultEnvironment = {}));
|
|
@@ -12,7 +12,6 @@ import { ProjectIdContextField } from './context/ProjectIdContextField';
|
|
|
12
12
|
import { ServerSideEnvironmentVariablesContextField } from './context/ServerSideEnvironmentVariablesContextField';
|
|
13
13
|
import SessionManagementContextField from './context/SessionManagementContextField';
|
|
14
14
|
import VcsClientContextField from './context/VcsClientContextField';
|
|
15
|
-
import { EnvironmentVariableEnvironment } from '../build/utils/environment';
|
|
16
15
|
import { Client } from '../vcs/vcs';
|
|
17
16
|
export type ContextInput<T extends {
|
|
18
17
|
[name: string]: any;
|
|
@@ -32,7 +31,7 @@ interface BaseGetContextAsyncArgs {
|
|
|
32
31
|
vcsClientOverride?: Client;
|
|
33
32
|
}
|
|
34
33
|
interface GetContextAsyncArgsWithRequiredServerSideEnvironmentArgument extends BaseGetContextAsyncArgs {
|
|
35
|
-
withServerSideEnvironment:
|
|
34
|
+
withServerSideEnvironment: string | null;
|
|
36
35
|
}
|
|
37
36
|
interface GetContextAsyncArgsWithoutServerSideEnvironmentArgument extends BaseGetContextAsyncArgs {
|
|
38
37
|
withServerSideEnvironment?: never;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Analytics } from '../../analytics/AnalyticsManager';
|
|
2
|
-
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
|
3
2
|
import SessionManager from '../../user/SessionManager';
|
|
4
3
|
import { Client } from '../../vcs/vcs';
|
|
5
4
|
export interface ContextOptions {
|
|
@@ -10,7 +9,7 @@ export interface ContextOptions {
|
|
|
10
9
|
/**
|
|
11
10
|
* If specified, env variables from the selected environment will be fetched from the server and used to evaluate the dynamic config.
|
|
12
11
|
*/
|
|
13
|
-
withServerSideEnvironment?:
|
|
12
|
+
withServerSideEnvironment?: string | null;
|
|
14
13
|
}
|
|
15
14
|
export default abstract class ContextField<T> {
|
|
16
15
|
abstract getValueAsync(options: ContextOptions): Promise<T>;
|
package/build/commandUtils/context/contextUtils/loadServerSideEnvironmentVariablesAsync.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ExpoGraphqlClient } from './createGraphqlClient';
|
|
2
|
-
import { EnvironmentVariableEnvironment } from '../../../build/utils/environment';
|
|
3
2
|
export declare function loadServerSideEnvironmentVariablesAsync({ environment, projectId, graphqlClient, }: {
|
|
4
|
-
environment:
|
|
3
|
+
environment: string;
|
|
5
4
|
projectId: string;
|
|
6
5
|
graphqlClient: ExpoGraphqlClient;
|
|
7
6
|
}): Promise<Record<string, string>>;
|
|
@@ -2,14 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadServerSideEnvironmentVariablesAsync = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const environment_1 = require("../../../build/utils/environment");
|
|
6
5
|
const EnvironmentVariablesQuery_1 = require("../../../graphql/queries/EnvironmentVariablesQuery");
|
|
7
6
|
const log_1 = tslib_1.__importDefault(require("../../../log"));
|
|
8
|
-
const cachedServerSideEnvironmentVariables = {
|
|
9
|
-
[environment_1.EnvironmentVariableEnvironment.Development]: null,
|
|
10
|
-
[environment_1.EnvironmentVariableEnvironment.Preview]: null,
|
|
11
|
-
[environment_1.EnvironmentVariableEnvironment.Production]: null,
|
|
12
|
-
};
|
|
7
|
+
const cachedServerSideEnvironmentVariables = {};
|
|
13
8
|
async function loadServerSideEnvironmentVariablesAsync({ environment, projectId, graphqlClient, }) {
|
|
14
9
|
// don't load environment variables if they were already loaded while executing a command
|
|
15
10
|
const cachedEnvVarsForEnvironment = cachedServerSideEnvironmentVariables[environment];
|
|
@@ -24,10 +19,10 @@ async function loadServerSideEnvironmentVariablesAsync({ environment, projectId,
|
|
|
24
19
|
.filter(({ name, value }) => name && value)
|
|
25
20
|
.map(({ name, value }) => [name, value]));
|
|
26
21
|
if (Object.keys(serverEnvVars).length > 0) {
|
|
27
|
-
log_1.default.log(`Environment variables with visibility "Plain text" and "Sensitive" loaded from the "${environment
|
|
22
|
+
log_1.default.log(`Environment variables with visibility "Plain text" and "Sensitive" loaded from the "${environment}" environment on EAS: ${Object.keys(serverEnvVars).join(', ')}.`);
|
|
28
23
|
}
|
|
29
24
|
else {
|
|
30
|
-
log_1.default.log(`No environment variables with visibility "Plain text" and "Sensitive" found for the "${environment
|
|
25
|
+
log_1.default.log(`No environment variables with visibility "Plain text" and "Sensitive" found for the "${environment}" environment on EAS.`);
|
|
31
26
|
}
|
|
32
27
|
log_1.default.newLine();
|
|
33
28
|
cachedServerSideEnvironmentVariables[environment] = serverEnvVars;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { EnvironmentVariableEnvironment } from '../build/utils/environment';
|
|
2
1
|
export declare const EasNonInteractiveAndJsonFlags: {
|
|
3
2
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
4
3
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
5
4
|
};
|
|
6
5
|
export declare const EasEnvironmentFlagParameters: {
|
|
7
6
|
description: string;
|
|
8
|
-
options: EnvironmentVariableEnvironment[];
|
|
9
7
|
};
|
|
10
8
|
export declare const EASEnvironmentFlag: {
|
|
11
|
-
environment: import("@oclif/core/lib/interfaces").OptionFlag<
|
|
9
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
12
10
|
};
|
|
13
11
|
export declare const EASMultiEnvironmentFlag: {
|
|
14
|
-
environment: import("@oclif/core/lib/interfaces").OptionFlag<
|
|
12
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined>;
|
|
15
13
|
};
|
|
16
14
|
export declare const EASVariableFormatFlag: {
|
|
17
15
|
format: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
@@ -30,5 +28,5 @@ export declare const EasJsonOnlyFlag: {
|
|
|
30
28
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
31
29
|
};
|
|
32
30
|
export declare const EasUpdateEnvironmentFlag: {
|
|
33
|
-
environment: import("@oclif/core/lib/interfaces").OptionFlag<
|
|
31
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
34
32
|
};
|
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EasUpdateEnvironmentFlag = exports.EasJsonOnlyFlag = exports.EASNonInteractiveFlag = exports.EASEnvironmentVariableScopeFlag = exports.EASVariableVisibilityFlag = exports.EASVariableFormatFlag = exports.EASMultiEnvironmentFlag = exports.EASEnvironmentFlag = exports.EasEnvironmentFlagParameters = exports.EasNonInteractiveAndJsonFlags = void 0;
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
|
-
const environment_1 = require("../build/utils/environment");
|
|
6
|
-
// NOTE: not exactly true, but, provided mapToLowercase and upperCaseAsync
|
|
7
|
-
// are used in tandem, it saves on unnecessary typying in commands
|
|
8
|
-
async function upperCaseAsync(input) {
|
|
9
|
-
return input.toUpperCase();
|
|
10
|
-
}
|
|
11
|
-
function mapToLowercase(options) {
|
|
12
|
-
return options.map(option => option.toLowerCase());
|
|
13
|
-
}
|
|
14
5
|
exports.EasNonInteractiveAndJsonFlags = {
|
|
15
6
|
json: core_1.Flags.boolean({
|
|
16
7
|
description: 'Enable JSON output, non-JSON messages will be printed to stderr.',
|
|
@@ -21,18 +12,15 @@ exports.EasNonInteractiveAndJsonFlags = {
|
|
|
21
12
|
}),
|
|
22
13
|
};
|
|
23
14
|
exports.EasEnvironmentFlagParameters = {
|
|
24
|
-
description: "Environment variable's environment",
|
|
25
|
-
options: mapToLowercase([
|
|
26
|
-
environment_1.EnvironmentVariableEnvironment.Development,
|
|
27
|
-
environment_1.EnvironmentVariableEnvironment.Preview,
|
|
28
|
-
environment_1.EnvironmentVariableEnvironment.Production,
|
|
29
|
-
]),
|
|
15
|
+
description: "Environment variable's environment, e.g. 'production', 'preview', 'development'",
|
|
30
16
|
};
|
|
31
17
|
exports.EASEnvironmentFlag = {
|
|
32
|
-
environment: core_1.Flags.
|
|
18
|
+
environment: core_1.Flags.string({
|
|
19
|
+
description: "Environment variable's environment, e.g. 'production', 'preview', 'development'",
|
|
20
|
+
}),
|
|
33
21
|
};
|
|
34
22
|
exports.EASMultiEnvironmentFlag = {
|
|
35
|
-
environment: core_1.Flags.
|
|
23
|
+
environment: core_1.Flags.string({
|
|
36
24
|
...exports.EasEnvironmentFlagParameters,
|
|
37
25
|
multiple: true,
|
|
38
26
|
}),
|
|
@@ -68,11 +56,9 @@ exports.EasJsonOnlyFlag = {
|
|
|
68
56
|
}),
|
|
69
57
|
};
|
|
70
58
|
exports.EasUpdateEnvironmentFlag = {
|
|
71
|
-
environment: core_1.Flags.
|
|
72
|
-
description: 'Environment to use for the server-side defined EAS environment variables during command execution.',
|
|
73
|
-
options: mapToLowercase(Object.values(environment_1.EnvironmentVariableEnvironment)),
|
|
74
|
-
parse: upperCaseAsync,
|
|
59
|
+
environment: core_1.Flags.string({
|
|
60
|
+
description: 'Environment to use for the server-side defined EAS environment variables during command execution, e.g. "production", "preview", "development"',
|
|
75
61
|
required: false,
|
|
76
|
-
default:
|
|
62
|
+
default: undefined,
|
|
77
63
|
}),
|
|
78
64
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Platform } from '@expo/eas-build-job';
|
|
2
|
-
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
|
3
2
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
4
3
|
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
5
4
|
import { BuildFragment } from '../../graphql/generated';
|
|
@@ -13,7 +12,7 @@ interface BuildResignFlags {
|
|
|
13
12
|
sourceProfile?: string;
|
|
14
13
|
maybeBuildId?: string;
|
|
15
14
|
wait: boolean;
|
|
16
|
-
environment?:
|
|
15
|
+
environment?: string;
|
|
17
16
|
}
|
|
18
17
|
interface RawBuildResignFlags {
|
|
19
18
|
json: boolean;
|
|
@@ -25,7 +24,7 @@ interface RawBuildResignFlags {
|
|
|
25
24
|
'source-profile': string | undefined;
|
|
26
25
|
wait: boolean;
|
|
27
26
|
id: string | undefined;
|
|
28
|
-
environment:
|
|
27
|
+
environment: string | undefined;
|
|
29
28
|
}
|
|
30
29
|
export default class BuildResign extends EasCommand {
|
|
31
30
|
static description: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
|
2
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
3
2
|
export default class WorkerDeploy extends EasCommand {
|
|
4
3
|
static description: string;
|
|
@@ -8,7 +7,7 @@ export default class WorkerDeploy extends EasCommand {
|
|
|
8
7
|
static flags: {
|
|
9
8
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
9
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
-
environment: import("@oclif/core/lib/interfaces").OptionFlag<
|
|
10
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
12
11
|
prod: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
12
|
alias: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
14
13
|
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
|
2
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
3
2
|
import { EASEnvironmentVariableScopeFlagValue } from '../../commandUtils/flags';
|
|
4
3
|
export default class EnvCreate extends EasCommand {
|
|
@@ -10,7 +9,7 @@ export default class EnvCreate extends EasCommand {
|
|
|
10
9
|
}[];
|
|
11
10
|
static flags: {
|
|
12
11
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
environment: import("@oclif/core/lib/interfaces").OptionFlag<
|
|
12
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined>;
|
|
14
13
|
scope: import("@oclif/core/lib/interfaces").OptionFlag<EASEnvironmentVariableScopeFlagValue>;
|
|
15
14
|
visibility: import("@oclif/core/lib/interfaces").OptionFlag<"plaintext" | "sensitive" | "secret" | undefined>;
|
|
16
15
|
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
@@ -14,13 +14,12 @@ const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
|
14
14
|
const projectUtils_1 = require("../../project/projectUtils");
|
|
15
15
|
const prompts_1 = require("../../prompts");
|
|
16
16
|
const prompts_2 = require("../../utils/prompts");
|
|
17
|
-
const variableUtils_1 = require("../../utils/variableUtils");
|
|
18
17
|
class EnvCreate extends EasCommand_1.default {
|
|
19
18
|
static description = 'create an environment variable for the current project or account';
|
|
20
19
|
static args = [
|
|
21
20
|
{
|
|
22
21
|
name: 'environment',
|
|
23
|
-
description: "Environment to create the variable in.
|
|
22
|
+
description: "Environment to create the variable in. Default environments are 'production', 'preview', and 'development'.",
|
|
24
23
|
required: false,
|
|
25
24
|
},
|
|
26
25
|
];
|
|
@@ -52,10 +51,10 @@ class EnvCreate extends EasCommand_1.default {
|
|
|
52
51
|
async runAsync() {
|
|
53
52
|
const { args, flags } = await this.parse(EnvCreate);
|
|
54
53
|
const validatedFlags = this.sanitizeFlags(flags);
|
|
55
|
-
const { name, value, scope, 'non-interactive': nonInteractive, environment: environments, visibility, force, type, fileName, } = await this.promptForMissingFlagsAsync(validatedFlags, args);
|
|
56
54
|
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(EnvCreate, {
|
|
57
|
-
nonInteractive,
|
|
55
|
+
nonInteractive: validatedFlags['non-interactive'],
|
|
58
56
|
});
|
|
57
|
+
const { name, value, scope, 'non-interactive': nonInteractive, environment: environments, visibility, force, type, fileName, } = await this.promptForMissingFlagsAsync(validatedFlags, args, { graphqlClient, projectId });
|
|
59
58
|
const [projectDisplayName, ownerAccount] = await Promise.all([
|
|
60
59
|
(0, projectUtils_1.getDisplayNameForProjectIdAsync)(graphqlClient, projectId),
|
|
61
60
|
(0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, projectId),
|
|
@@ -152,7 +151,7 @@ class EnvCreate extends EasCommand_1.default {
|
|
|
152
151
|
throw new Error(`${message} Use --force to overwrite it.`);
|
|
153
152
|
}
|
|
154
153
|
}
|
|
155
|
-
async promptForMissingFlagsAsync({ name, value, environment: environments, visibility, 'non-interactive': nonInteractive, type, ...rest }, { environment }) {
|
|
154
|
+
async promptForMissingFlagsAsync({ name, value, environment: environments, visibility, 'non-interactive': nonInteractive, type, ...rest }, { environment }, { graphqlClient, projectId }) {
|
|
156
155
|
if (!name) {
|
|
157
156
|
name = await (0, prompts_2.promptVariableNameAsync)(nonInteractive);
|
|
158
157
|
}
|
|
@@ -187,16 +186,15 @@ class EnvCreate extends EasCommand_1.default {
|
|
|
187
186
|
fileName = path_1.default.basename(environmentFilePath);
|
|
188
187
|
}
|
|
189
188
|
value = environmentFilePath ? await fs_extra_1.default.readFile(environmentFilePath, 'base64') : value;
|
|
190
|
-
|
|
191
|
-
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
192
|
-
}
|
|
193
|
-
let newEnvironments = environments
|
|
194
|
-
? environments
|
|
195
|
-
: environment
|
|
196
|
-
? [environment.toLowerCase()]
|
|
197
|
-
: undefined;
|
|
189
|
+
let newEnvironments = environments ? environments : environment ? [environment] : undefined;
|
|
198
190
|
if (!newEnvironments) {
|
|
199
|
-
newEnvironments = await (0, prompts_2.promptVariableEnvironmentAsync)({
|
|
191
|
+
newEnvironments = await (0, prompts_2.promptVariableEnvironmentAsync)({
|
|
192
|
+
nonInteractive,
|
|
193
|
+
multiple: true,
|
|
194
|
+
canEnterCustomEnvironment: true,
|
|
195
|
+
graphqlClient,
|
|
196
|
+
projectId,
|
|
197
|
+
});
|
|
200
198
|
if (!newEnvironments || newEnvironments.length === 0) {
|
|
201
199
|
throw new Error('No environments selected');
|
|
202
200
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
|
2
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
3
2
|
import { EASEnvironmentVariableScopeFlagValue } from '../../commandUtils/flags';
|
|
4
3
|
export default class EnvDelete extends EasCommand {
|
|
@@ -7,7 +6,7 @@ export default class EnvDelete extends EasCommand {
|
|
|
7
6
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
7
|
scope: import("@oclif/core/lib/interfaces").OptionFlag<EASEnvironmentVariableScopeFlagValue>;
|
|
9
8
|
'variable-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
10
|
-
'variable-environment': import("@oclif/core/lib/interfaces").OptionFlag<
|
|
9
|
+
'variable-environment': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
11
10
|
};
|
|
12
11
|
static args: {
|
|
13
12
|
name: string;
|
|
@@ -18,7 +18,7 @@ class EnvDelete extends EasCommand_1.default {
|
|
|
18
18
|
'variable-name': core_1.Flags.string({
|
|
19
19
|
description: 'Name of the variable to delete',
|
|
20
20
|
}),
|
|
21
|
-
'variable-environment': core_1.Flags.
|
|
21
|
+
'variable-environment': core_1.Flags.string({
|
|
22
22
|
...flags_1.EasEnvironmentFlagParameters,
|
|
23
23
|
description: 'Current environment of the variable to delete',
|
|
24
24
|
}),
|
|
@@ -28,7 +28,7 @@ class EnvDelete extends EasCommand_1.default {
|
|
|
28
28
|
static args = [
|
|
29
29
|
{
|
|
30
30
|
name: 'environment',
|
|
31
|
-
description: "Current environment of the variable to delete.
|
|
31
|
+
description: "Current environment of the variable to delete. Default environments are 'production', 'preview', and 'development'.",
|
|
32
32
|
required: false,
|
|
33
33
|
},
|
|
34
34
|
];
|
|
@@ -108,10 +108,6 @@ class EnvDelete extends EasCommand_1.default {
|
|
|
108
108
|
? generated_1.EnvironmentVariableScope.Shared
|
|
109
109
|
: generated_1.EnvironmentVariableScope.Project;
|
|
110
110
|
if (environment) {
|
|
111
|
-
environment = environment.toLowerCase();
|
|
112
|
-
if (!(0, variableUtils_1.isEnvironment)(environment)) {
|
|
113
|
-
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
114
|
-
}
|
|
115
111
|
return { ...flags, 'variable-environment': environment, scope };
|
|
116
112
|
}
|
|
117
113
|
return { ...flags, scope };
|
|
@@ -8,7 +8,6 @@ const flags_1 = require("../../commandUtils/flags");
|
|
|
8
8
|
const EnvironmentVariablesQuery_1 = require("../../graphql/queries/EnvironmentVariablesQuery");
|
|
9
9
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
10
10
|
const prompts_1 = require("../../utils/prompts");
|
|
11
|
-
const variableUtils_1 = require("../../utils/variableUtils");
|
|
12
11
|
class EnvExec extends EasCommand_1.default {
|
|
13
12
|
static description = 'execute a command with environment variables from the selected environment';
|
|
14
13
|
static contextDefinition = {
|
|
@@ -22,7 +21,7 @@ class EnvExec extends EasCommand_1.default {
|
|
|
22
21
|
{
|
|
23
22
|
name: 'environment',
|
|
24
23
|
required: true,
|
|
25
|
-
description: "Environment to execute the command in.
|
|
24
|
+
description: "Environment to execute the command in. Default environments are 'production', 'preview', and 'development'.",
|
|
26
25
|
},
|
|
27
26
|
{
|
|
28
27
|
name: 'bash_command',
|
|
@@ -39,7 +38,11 @@ class EnvExec extends EasCommand_1.default {
|
|
|
39
38
|
});
|
|
40
39
|
this.isNonInteractive = parsedFlags.nonInteractive;
|
|
41
40
|
const environment = parsedFlags.environment ??
|
|
42
|
-
(await (0, prompts_1.promptVariableEnvironmentAsync)({
|
|
41
|
+
(await (0, prompts_1.promptVariableEnvironmentAsync)({
|
|
42
|
+
nonInteractive: parsedFlags.nonInteractive,
|
|
43
|
+
graphqlClient,
|
|
44
|
+
projectId,
|
|
45
|
+
}));
|
|
43
46
|
const environmentVariables = await this.loadEnvironmentVariablesAsync({
|
|
44
47
|
graphqlClient,
|
|
45
48
|
projectId,
|
|
@@ -63,10 +66,6 @@ class EnvExec extends EasCommand_1.default {
|
|
|
63
66
|
if (rawFlags['non-interactive'] && (!bash_command || !environment)) {
|
|
64
67
|
throw new Error("You must specify both environment and bash command when running in non-interactive mode. Run command as `eas env:exec ENVIRONMENT 'bash command'`.");
|
|
65
68
|
}
|
|
66
|
-
environment = environment?.toLowerCase();
|
|
67
|
-
if (!(0, variableUtils_1.isEnvironment)(environment)) {
|
|
68
|
-
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
69
|
-
}
|
|
70
69
|
const firstChar = bash_command[0];
|
|
71
70
|
const lastChar = bash_command[bash_command.length - 1];
|
|
72
71
|
const cleanCommand = (firstChar === '"' && lastChar === '"') || (firstChar === "'" && lastChar === "'")
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
|
2
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
3
2
|
import { EASEnvironmentVariableScopeFlagValue } from '../../commandUtils/flags';
|
|
4
3
|
export default class EnvGet extends EasCommand {
|
|
@@ -17,7 +16,7 @@ export default class EnvGet extends EasCommand {
|
|
|
17
16
|
scope: import("@oclif/core/lib/interfaces").OptionFlag<EASEnvironmentVariableScopeFlagValue>;
|
|
18
17
|
format: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
19
18
|
'variable-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
20
|
-
'variable-environment': import("@oclif/core/lib/interfaces").OptionFlag<
|
|
19
|
+
'variable-environment': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
21
20
|
};
|
|
22
21
|
runAsync(): Promise<void>;
|
|
23
22
|
private sanitizeInputs;
|
|
@@ -19,7 +19,7 @@ class EnvGet extends EasCommand_1.default {
|
|
|
19
19
|
static args = [
|
|
20
20
|
{
|
|
21
21
|
name: 'environment',
|
|
22
|
-
description: "Current environment of the variable.
|
|
22
|
+
description: "Current environment of the variable. Default environments are 'production', 'preview', and 'development'.",
|
|
23
23
|
required: false,
|
|
24
24
|
},
|
|
25
25
|
];
|
|
@@ -27,7 +27,7 @@ class EnvGet extends EasCommand_1.default {
|
|
|
27
27
|
'variable-name': core_1.Flags.string({
|
|
28
28
|
description: 'Name of the variable',
|
|
29
29
|
}),
|
|
30
|
-
'variable-environment': core_1.Flags.
|
|
30
|
+
'variable-environment': core_1.Flags.string({
|
|
31
31
|
...flags_1.EasEnvironmentFlagParameters,
|
|
32
32
|
description: 'Current environment of the variable',
|
|
33
33
|
}),
|
|
@@ -48,6 +48,8 @@ class EnvGet extends EasCommand_1.default {
|
|
|
48
48
|
environment = await (0, prompts_1.promptVariableEnvironmentAsync)({
|
|
49
49
|
nonInteractive,
|
|
50
50
|
multiple: false,
|
|
51
|
+
graphqlClient,
|
|
52
|
+
projectId,
|
|
51
53
|
});
|
|
52
54
|
}
|
|
53
55
|
const variables = await getVariablesAsync(graphqlClient, scope, projectId, name, environment);
|
|
@@ -95,10 +97,6 @@ class EnvGet extends EasCommand_1.default {
|
|
|
95
97
|
? generated_1.EnvironmentVariableScope.Shared
|
|
96
98
|
: generated_1.EnvironmentVariableScope.Project;
|
|
97
99
|
if (environment) {
|
|
98
|
-
environment = environment.toLowerCase();
|
|
99
|
-
if (!(0, variableUtils_1.isEnvironment)(environment)) {
|
|
100
|
-
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
101
|
-
}
|
|
102
100
|
return {
|
|
103
101
|
...flags,
|
|
104
102
|
'variable-environment': environment,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
|
2
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
3
2
|
import { EASEnvironmentVariableScopeFlagValue } from '../../commandUtils/flags';
|
|
4
3
|
export default class EnvList extends EasCommand {
|
|
@@ -10,7 +9,7 @@ export default class EnvList extends EasCommand {
|
|
|
10
9
|
static flags: {
|
|
11
10
|
scope: import("@oclif/core/lib/interfaces").OptionFlag<EASEnvironmentVariableScopeFlagValue>;
|
|
12
11
|
format: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
13
|
-
environment: import("@oclif/core/lib/interfaces").OptionFlag<
|
|
12
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined>;
|
|
14
13
|
'include-sensitive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
14
|
'include-file-content': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
15
|
};
|
|
@@ -59,7 +59,7 @@ class EnvList extends EasCommand_1.default {
|
|
|
59
59
|
static args = [
|
|
60
60
|
{
|
|
61
61
|
name: 'environment',
|
|
62
|
-
description: "Environment to list the variables from.
|
|
62
|
+
description: "Environment to list the variables from. Default environments are 'production', 'preview', and 'development'.",
|
|
63
63
|
required: false,
|
|
64
64
|
},
|
|
65
65
|
];
|
|
@@ -70,7 +70,12 @@ class EnvList extends EasCommand_1.default {
|
|
|
70
70
|
nonInteractive: true,
|
|
71
71
|
});
|
|
72
72
|
if (!environments) {
|
|
73
|
-
environments = await (0, prompts_1.promptVariableEnvironmentAsync)({
|
|
73
|
+
environments = await (0, prompts_1.promptVariableEnvironmentAsync)({
|
|
74
|
+
nonInteractive,
|
|
75
|
+
multiple: true,
|
|
76
|
+
graphqlClient,
|
|
77
|
+
projectId,
|
|
78
|
+
});
|
|
74
79
|
}
|
|
75
80
|
await (0, variableUtils_1.performForEnvironmentsAsync)(environments, async (environment) => {
|
|
76
81
|
const variables = await getVariablesForScopeAsync(graphqlClient, {
|
|
@@ -105,13 +110,10 @@ class EnvList extends EasCommand_1.default {
|
|
|
105
110
|
});
|
|
106
111
|
}
|
|
107
112
|
sanitizeInputs(flags, { environment }) {
|
|
108
|
-
if (environment && !(0, variableUtils_1.isEnvironment)(environment.toLowerCase())) {
|
|
109
|
-
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
110
|
-
}
|
|
111
113
|
const environments = flags.environment
|
|
112
114
|
? flags.environment
|
|
113
115
|
: environment
|
|
114
|
-
? [environment
|
|
116
|
+
? [environment]
|
|
115
117
|
: undefined;
|
|
116
118
|
return {
|
|
117
119
|
...flags,
|
|
@@ -13,7 +13,7 @@ export default class EnvPull extends EasCommand {
|
|
|
13
13
|
}[];
|
|
14
14
|
static flags: {
|
|
15
15
|
path: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
16
|
-
environment: import("@oclif/core/lib/interfaces").OptionFlag<
|
|
16
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
17
17
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
18
|
};
|
|
19
19
|
runAsync(): Promise<void>;
|
|
@@ -12,7 +12,6 @@ const EnvironmentVariablesQuery_1 = require("../../graphql/queries/EnvironmentVa
|
|
|
12
12
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
13
13
|
const prompts_1 = require("../../prompts");
|
|
14
14
|
const prompts_2 = require("../../utils/prompts");
|
|
15
|
-
const variableUtils_1 = require("../../utils/variableUtils");
|
|
16
15
|
class EnvPull extends EasCommand_1.default {
|
|
17
16
|
static description = 'pull environment variables for the selected environment to .env file';
|
|
18
17
|
static contextDefinition = {
|
|
@@ -23,7 +22,7 @@ class EnvPull extends EasCommand_1.default {
|
|
|
23
22
|
static args = [
|
|
24
23
|
{
|
|
25
24
|
name: 'environment',
|
|
26
|
-
description: "Environment to pull variables from.
|
|
25
|
+
description: "Environment to pull variables from. Default environments are 'production', 'preview', and 'development'.",
|
|
27
26
|
required: false,
|
|
28
27
|
},
|
|
29
28
|
];
|
|
@@ -38,15 +37,16 @@ class EnvPull extends EasCommand_1.default {
|
|
|
38
37
|
async runAsync() {
|
|
39
38
|
let { args: { environment: argEnvironment }, flags: { environment: flagEnvironment, path: targetPath, 'non-interactive': nonInteractive }, } = await this.parse(EnvPull);
|
|
40
39
|
let environment = flagEnvironment?.toLowerCase() ?? argEnvironment?.toLowerCase();
|
|
41
|
-
if (!environment) {
|
|
42
|
-
environment = await (0, prompts_2.promptVariableEnvironmentAsync)({ nonInteractive });
|
|
43
|
-
}
|
|
44
|
-
if (!(0, variableUtils_1.isEnvironment)(environment)) {
|
|
45
|
-
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
46
|
-
}
|
|
47
40
|
const { projectId, loggedIn: { graphqlClient }, projectDir, } = await this.getContextAsync(EnvPull, {
|
|
48
41
|
nonInteractive,
|
|
49
42
|
});
|
|
43
|
+
if (!environment) {
|
|
44
|
+
environment = await (0, prompts_2.promptVariableEnvironmentAsync)({
|
|
45
|
+
nonInteractive,
|
|
46
|
+
graphqlClient,
|
|
47
|
+
projectId,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
50
|
targetPath = targetPath ?? '.env.local';
|
|
51
51
|
const environmentVariables = await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.byAppIdWithSensitiveAsync(graphqlClient, {
|
|
52
52
|
appId: projectId,
|