eas-cli 25.1.1 → 25.2.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 +246 -144
- package/build/analytics/AnalyticsManager.d.ts +6 -1
- package/build/analytics/AnalyticsManager.js +11 -1
- package/build/build/build.d.ts +2 -1
- package/build/build/build.js +5 -4
- package/build/build/context.d.ts +2 -0
- package/build/build/createContext.d.ts +3 -1
- package/build/build/createContext.js +2 -1
- package/build/build/freeTierLimitGuidance.d.ts +19 -0
- package/build/build/freeTierLimitGuidance.js +39 -0
- package/build/build/runBuildAndSubmit.d.ts +4 -1
- package/build/build/runBuildAndSubmit.js +4 -2
- package/build/commandUtils/EasCommand.d.ts +9 -0
- package/build/commandUtils/EasCommand.js +9 -0
- package/build/commandUtils/context/ExperimentationContextField.d.ts +13 -0
- package/build/commandUtils/context/ExperimentationContextField.js +79 -0
- package/build/commandUtils/context/contextUtils/createGraphqlClient.d.ts +3 -0
- package/build/commandUtils/context/contextUtils/createGraphqlClient.js +29 -2
- package/build/commands/analytics.js +1 -1
- package/build/commands/build/index.d.ts +1 -0
- package/build/commands/build/index.js +3 -1
- package/build/commands/simulator/control.d.ts +26 -0
- package/build/commands/simulator/control.js +250 -0
- package/build/commands/update/republish.d.ts +1 -1
- package/build/env.d.ts +6 -0
- package/build/env.js +6 -0
- package/build/experimentation/AnalyticsExposureLogger.d.ts +7 -0
- package/build/experimentation/AnalyticsExposureLogger.js +21 -0
- package/build/experimentation/ExperimentNamespace.d.ts +24 -0
- package/build/experimentation/ExperimentNamespace.js +69 -0
- package/build/experimentation/ExperimentOverrides.d.ts +17 -0
- package/build/experimentation/ExperimentOverrides.js +68 -0
- package/build/experimentation/ExperimentationClient.d.ts +32 -0
- package/build/experimentation/ExperimentationClient.js +125 -0
- package/build/experimentation/LazyExperimentationClient.d.ts +12 -0
- package/build/experimentation/LazyExperimentationClient.js +22 -0
- package/build/graphql/generated.d.ts +12 -0
- package/build/graphql/queries/ExperimentationConfigQuery.d.ts +10 -0
- package/build/graphql/queries/ExperimentationConfigQuery.js +49 -0
- package/build/graphql/queries/UserQuery.d.ts +3 -1
- package/build/graphql/queries/UserQuery.js +2 -1
- package/build/help.d.ts +4 -0
- package/build/help.js +56 -0
- package/build/simulator/hostActions.d.ts +70 -0
- package/build/simulator/hostActions.js +411 -0
- package/build/simulator/utils.d.ts +5 -0
- package/build/simulator/utils.js +11 -0
- package/build/user/SessionManager.d.ts +8 -1
- package/build/user/SessionManager.js +7 -2
- package/oclif.manifest.json +1110 -203
- package/package.json +8 -6
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Actor } from '../user/User';
|
|
2
|
-
export type AnalyticsEvent = CommandEvent | BuildEvent | SubmissionEvent | MetadataEvent | BillingEvent | SimulatorEvent;
|
|
2
|
+
export type AnalyticsEvent = CommandEvent | BuildEvent | SubmissionEvent | MetadataEvent | BillingEvent | SimulatorEvent | ExperimentationEvent;
|
|
3
3
|
export declare enum CommandEvent {
|
|
4
4
|
ACTION = "action"
|
|
5
5
|
}
|
|
6
|
+
export declare enum ExperimentationEvent {
|
|
7
|
+
EXPERIMENT_VIEWED = "Experiment Viewed"
|
|
8
|
+
}
|
|
6
9
|
export declare enum BillingEvent {
|
|
7
10
|
SUBSCRIBE_COMMAND = "billing cli subscribe command"
|
|
8
11
|
}
|
|
@@ -71,6 +74,8 @@ export interface Analytics {
|
|
|
71
74
|
export interface AnalyticsWithOrchestration extends Analytics {
|
|
72
75
|
setActor(actor: Actor): void;
|
|
73
76
|
flushAsync(): Promise<void>;
|
|
77
|
+
/** The persisted RudderStack anonymous ID, or null when analytics is disabled. */
|
|
78
|
+
getDeviceId(): string | null;
|
|
74
79
|
}
|
|
75
80
|
/**
|
|
76
81
|
* Sets the user's analytics enabled preference. Note that this will only take effect
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MetadataEvent = exports.SimulatorEvent = exports.BuildEvent = exports.SubmissionEvent = exports.BillingEvent = exports.CommandEvent = void 0;
|
|
3
|
+
exports.MetadataEvent = exports.SimulatorEvent = exports.BuildEvent = exports.SubmissionEvent = exports.BillingEvent = exports.ExperimentationEvent = exports.CommandEvent = void 0;
|
|
4
4
|
exports.setAnalyticsEnabledAsync = setAnalyticsEnabledAsync;
|
|
5
5
|
exports.getAnalyticsEnabledAsync = getAnalyticsEnabledAsync;
|
|
6
6
|
exports.isAnalyticsOptedOutAsync = isAnalyticsOptedOutAsync;
|
|
@@ -24,6 +24,10 @@ var CommandEvent;
|
|
|
24
24
|
(function (CommandEvent) {
|
|
25
25
|
CommandEvent["ACTION"] = "action";
|
|
26
26
|
})(CommandEvent || (exports.CommandEvent = CommandEvent = {}));
|
|
27
|
+
var ExperimentationEvent;
|
|
28
|
+
(function (ExperimentationEvent) {
|
|
29
|
+
ExperimentationEvent["EXPERIMENT_VIEWED"] = "Experiment Viewed";
|
|
30
|
+
})(ExperimentationEvent || (exports.ExperimentationEvent = ExperimentationEvent = {}));
|
|
27
31
|
var BillingEvent;
|
|
28
32
|
(function (BillingEvent) {
|
|
29
33
|
BillingEvent["SUBSCRIBE_COMMAND"] = "billing cli subscribe command";
|
|
@@ -144,6 +148,9 @@ class NoOpAnalytics {
|
|
|
144
148
|
logEvent() { }
|
|
145
149
|
setActor() { }
|
|
146
150
|
async flushAsync() { }
|
|
151
|
+
getDeviceId() {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
147
154
|
}
|
|
148
155
|
const RudderstackAnalyticsConfig = process.env.EXPO_STAGING || process.env.EXPO_LOCAL
|
|
149
156
|
? {
|
|
@@ -185,6 +192,9 @@ class RudderstackAnalytics {
|
|
|
185
192
|
});
|
|
186
193
|
this.identifiedActor = actor;
|
|
187
194
|
}
|
|
195
|
+
getDeviceId() {
|
|
196
|
+
return this.persistentDeviceId;
|
|
197
|
+
}
|
|
188
198
|
logEvent(name, properties) {
|
|
189
199
|
const userId = this.identifiedActor?.id;
|
|
190
200
|
const deviceId = this.persistentDeviceId;
|
package/build/build/build.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ArchiveSource, BuildJob, Platform } from '@expo/eas-build-job';
|
|
2
2
|
import { CredentialsSource } from '@expo/eas-json';
|
|
3
3
|
import { BuildContext } from './context';
|
|
4
|
+
import { FreeTierLimitAgentGuidanceExperiment } from './freeTierLimitGuidance';
|
|
4
5
|
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
5
6
|
import { BuildFragment, BuildMetadataInput, BuildParamsInput } from '../graphql/generated';
|
|
6
7
|
import { BuildResult } from '../graphql/mutations/BuildMutation';
|
|
@@ -21,7 +22,7 @@ interface Builder<TPlatform extends Platform, Credentials, TJob extends BuildJob
|
|
|
21
22
|
}
|
|
22
23
|
export type BuildRequestSender = () => Promise<BuildFragment | undefined>;
|
|
23
24
|
export declare function prepareBuildRequestForPlatformAsync<TPlatform extends Platform, Credentials, TJob extends BuildJob>(builder: Builder<TPlatform, Credentials, TJob>): Promise<BuildRequestSender>;
|
|
24
|
-
export declare function
|
|
25
|
+
export declare function handleBuildRequestErrorAsync(error: any, platform: Platform, accountName?: string, freeTierLimitAgentGuidanceExperiment?: FreeTierLimitAgentGuidanceExperiment): Promise<never>;
|
|
25
26
|
export type MaybeBuildFragment = BuildFragment | null;
|
|
26
27
|
export declare function waitForBuildEndAsync(graphqlClient: ExpoGraphqlClient, { buildIds, accountName }: {
|
|
27
28
|
buildIds: string[];
|
package/build/build/build.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.prepareBuildRequestForPlatformAsync = prepareBuildRequestForPlatformAsync;
|
|
4
|
-
exports.
|
|
4
|
+
exports.handleBuildRequestErrorAsync = handleBuildRequestErrorAsync;
|
|
5
5
|
exports.waitForBuildEndAsync = waitForBuildEndAsync;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
@@ -11,6 +11,7 @@ const cli_progress_1 = tslib_1.__importDefault(require("cli-progress"));
|
|
|
11
11
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
12
12
|
const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
|
|
13
13
|
const errors_1 = require("./errors");
|
|
14
|
+
const freeTierLimitGuidance_1 = require("./freeTierLimitGuidance");
|
|
14
15
|
const graphql_1 = require("./graphql");
|
|
15
16
|
const local_1 = require("./local");
|
|
16
17
|
const logs_1 = require("./logs");
|
|
@@ -121,7 +122,7 @@ async function prepareBuildRequestForPlatformAsync(builder) {
|
|
|
121
122
|
return await sendBuildRequestAsync(builder, job, graphqlMetadata, buildParams);
|
|
122
123
|
}
|
|
123
124
|
catch (error) {
|
|
124
|
-
|
|
125
|
+
return await handleBuildRequestErrorAsync(error, job.platform, ctx.accountName, (0, freeTierLimitGuidance_1.getFreeTierLimitAgentGuidanceExperiment)(ctx));
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
else {
|
|
@@ -140,7 +141,7 @@ const SERVER_SIDE_DEFINED_ERRORS = {
|
|
|
140
141
|
EAS_BUILD_LEGACY_RESOURCE_CLASS_NOT_AVAILABLE: errors_1.EasBuildLegacyResourceClassNotAvailableError,
|
|
141
142
|
VALIDATION_ERROR: errors_1.RequestValidationError,
|
|
142
143
|
};
|
|
143
|
-
function
|
|
144
|
+
async function handleBuildRequestErrorAsync(error, platform, accountName, freeTierLimitAgentGuidanceExperiment) {
|
|
144
145
|
logBuildRequestErrorDebugInfo(error);
|
|
145
146
|
const graphQLErrors = Array.isArray(error?.graphQLErrors)
|
|
146
147
|
? error.graphQLErrors
|
|
@@ -152,7 +153,7 @@ function handleBuildRequestError(error, platform, accountName) {
|
|
|
152
153
|
const isFreeTierLimitError = graphQLErrorCode === 'EAS_BUILD_FREE_TIER_LIMIT_EXCEEDED' ||
|
|
153
154
|
graphQLErrorCode === 'EAS_BUILD_FREE_TIER_IOS_LIMIT_EXCEEDED';
|
|
154
155
|
throw new ErrorClass(isFreeTierLimitError
|
|
155
|
-
? `${message}\nRun ${(0, plans_1.formatStarterSubscribeCommand)(accountName)} to upgrade to the Starter plan
|
|
156
|
+
? await (0, freeTierLimitGuidance_1.maybeAppendFreeTierLimitAgentGuidanceAsync)(`${message}\nRun ${(0, plans_1.formatStarterSubscribeCommand)(accountName)} to upgrade to the Starter plan.`, platform, freeTierLimitAgentGuidanceExperiment)
|
|
156
157
|
: message);
|
|
157
158
|
}
|
|
158
159
|
else if (graphQLErrorCode === 'EAS_BUILD_DOWN_FOR_MAINTENANCE') {
|
package/build/build/context.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { LocalBuildOptions } from './local';
|
|
|
7
7
|
import { Analytics, AnalyticsEventProperties } from '../analytics/AnalyticsManager';
|
|
8
8
|
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
9
9
|
import { CredentialsContext } from '../credentials/context';
|
|
10
|
+
import { LazyExperimentationClient } from '../experimentation/LazyExperimentationClient';
|
|
10
11
|
import { Target } from '../credentials/ios/types';
|
|
11
12
|
import { BuildResourceClass } from '../graphql/generated';
|
|
12
13
|
import { GradleBuildContext } from '../project/android/gradle';
|
|
@@ -61,4 +62,5 @@ export interface BuildContext<T extends Platform> {
|
|
|
61
62
|
isVerboseLoggingEnabled: boolean;
|
|
62
63
|
whatToTest?: string;
|
|
63
64
|
env: Env;
|
|
65
|
+
experimentation?: LazyExperimentationClient;
|
|
64
66
|
}
|
|
@@ -6,10 +6,11 @@ import { LocalBuildOptions } from './local';
|
|
|
6
6
|
import { Analytics } from '../analytics/AnalyticsManager';
|
|
7
7
|
import { DynamicConfigContextFn } from '../commandUtils/context/DynamicProjectConfigContextField';
|
|
8
8
|
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
9
|
+
import { LazyExperimentationClient } from '../experimentation/LazyExperimentationClient';
|
|
9
10
|
import { CustomBuildConfigMetadata } from '../project/customBuildConfig';
|
|
10
11
|
import { Actor } from '../user/User';
|
|
11
12
|
import { Client } from '../vcs/vcs';
|
|
12
|
-
export declare function createBuildContextAsync<T extends Platform>({ buildProfileName, buildProfile, easJsonCliConfig, clearCache, localBuildOptions, nonInteractive, noWait, platform, projectDir, resourceClassFlag, message, actor, graphqlClient, analytics, vcsClient, getDynamicPrivateProjectConfigAsync, customBuildConfigMetadata, buildLoggerLevel, freezeCredentials, refreshAdHocProvisioningProfile: refreshAdHocProvisioningProfileFlag, isVerboseLoggingEnabled, whatToTest, env, }: {
|
|
13
|
+
export declare function createBuildContextAsync<T extends Platform>({ buildProfileName, buildProfile, easJsonCliConfig, clearCache, localBuildOptions, nonInteractive, noWait, platform, projectDir, resourceClassFlag, message, actor, graphqlClient, analytics, vcsClient, getDynamicPrivateProjectConfigAsync, customBuildConfigMetadata, buildLoggerLevel, freezeCredentials, refreshAdHocProvisioningProfile: refreshAdHocProvisioningProfileFlag, isVerboseLoggingEnabled, whatToTest, env, experimentation, }: {
|
|
13
14
|
buildProfileName: string;
|
|
14
15
|
buildProfile: BuildProfile<T>;
|
|
15
16
|
easJsonCliConfig: EasJson['cli'];
|
|
@@ -33,4 +34,5 @@ export declare function createBuildContextAsync<T extends Platform>({ buildProfi
|
|
|
33
34
|
isVerboseLoggingEnabled: boolean;
|
|
34
35
|
whatToTest?: string;
|
|
35
36
|
env: Env;
|
|
37
|
+
experimentation?: LazyExperimentationClient;
|
|
36
38
|
}): Promise<BuildContext<T>>;
|
|
@@ -16,7 +16,7 @@ const AnalyticsManager_1 = require("../analytics/AnalyticsManager");
|
|
|
16
16
|
const context_1 = require("../credentials/context");
|
|
17
17
|
const projectUtils_1 = require("../project/projectUtils");
|
|
18
18
|
const workflow_1 = require("../project/workflow");
|
|
19
|
-
async function createBuildContextAsync({ buildProfileName, buildProfile, easJsonCliConfig, clearCache = false, localBuildOptions, nonInteractive, noWait, platform, projectDir, resourceClassFlag, message, actor, graphqlClient, analytics, vcsClient, getDynamicPrivateProjectConfigAsync, customBuildConfigMetadata, buildLoggerLevel, freezeCredentials, refreshAdHocProvisioningProfile: refreshAdHocProvisioningProfileFlag, isVerboseLoggingEnabled, whatToTest, env, }) {
|
|
19
|
+
async function createBuildContextAsync({ buildProfileName, buildProfile, easJsonCliConfig, clearCache = false, localBuildOptions, nonInteractive, noWait, platform, projectDir, resourceClassFlag, message, actor, graphqlClient, analytics, vcsClient, getDynamicPrivateProjectConfigAsync, customBuildConfigMetadata, buildLoggerLevel, freezeCredentials, refreshAdHocProvisioningProfile: refreshAdHocProvisioningProfileFlag, isVerboseLoggingEnabled, whatToTest, env, experimentation, }) {
|
|
20
20
|
const { exp, projectId } = await getDynamicPrivateProjectConfigAsync({
|
|
21
21
|
env,
|
|
22
22
|
});
|
|
@@ -97,6 +97,7 @@ async function createBuildContextAsync({ buildProfileName, buildProfile, easJson
|
|
|
97
97
|
isVerboseLoggingEnabled,
|
|
98
98
|
env,
|
|
99
99
|
whatToTest,
|
|
100
|
+
experimentation,
|
|
100
101
|
};
|
|
101
102
|
if (platform === eas_build_job_1.Platform.ANDROID) {
|
|
102
103
|
const common = commonContext;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Platform } from '@expo/eas-build-job';
|
|
2
|
+
import { LazyExperimentationClient } from '../experimentation/LazyExperimentationClient';
|
|
3
|
+
export declare const FREE_TIER_LIMIT_AGENT_GUIDANCE_EXPERIMENT_NAMESPACE = "cli-build-free-tier-limit-agent-guidance";
|
|
4
|
+
export type FreeTierLimitAgentGuidanceVariant = 'control' | 'treatment';
|
|
5
|
+
export type FreeTierLimitAgentGuidanceExperiment = {
|
|
6
|
+
experimentation: LazyExperimentationClient;
|
|
7
|
+
accountId: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function getFreeTierLimitAgentGuidanceExperiment(ctx: {
|
|
10
|
+
experimentation?: LazyExperimentationClient;
|
|
11
|
+
accountId: string;
|
|
12
|
+
}): FreeTierLimitAgentGuidanceExperiment | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Resolves the account's variant. Only runs driven by a coding agent are eligible. Other runs get
|
|
15
|
+
* control before the client loads, so they make no config request and log no exposure.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveFreeTierLimitAgentGuidanceVariantAsync({ experimentation, accountId, }: FreeTierLimitAgentGuidanceExperiment): Promise<FreeTierLimitAgentGuidanceVariant>;
|
|
18
|
+
export declare function formatFreeTierLimitAgentGuidance(platform: Platform): string;
|
|
19
|
+
export declare function maybeAppendFreeTierLimitAgentGuidanceAsync(message: string, platform: Platform, experiment: FreeTierLimitAgentGuidanceExperiment | undefined): Promise<string>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FREE_TIER_LIMIT_AGENT_GUIDANCE_EXPERIMENT_NAMESPACE = void 0;
|
|
4
|
+
exports.getFreeTierLimitAgentGuidanceExperiment = getFreeTierLimitAgentGuidanceExperiment;
|
|
5
|
+
exports.resolveFreeTierLimitAgentGuidanceVariantAsync = resolveFreeTierLimitAgentGuidanceVariantAsync;
|
|
6
|
+
exports.formatFreeTierLimitAgentGuidance = formatFreeTierLimitAgentGuidance;
|
|
7
|
+
exports.maybeAppendFreeTierLimitAgentGuidanceAsync = maybeAppendFreeTierLimitAgentGuidanceAsync;
|
|
8
|
+
const agent_1 = require("../analytics/agent");
|
|
9
|
+
const platform_1 = require("../platform");
|
|
10
|
+
exports.FREE_TIER_LIMIT_AGENT_GUIDANCE_EXPERIMENT_NAMESPACE = 'cli-build-free-tier-limit-agent-guidance';
|
|
11
|
+
function getFreeTierLimitAgentGuidanceExperiment(ctx) {
|
|
12
|
+
return ctx.experimentation
|
|
13
|
+
? { experimentation: ctx.experimentation, accountId: ctx.accountId }
|
|
14
|
+
: undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the account's variant. Only runs driven by a coding agent are eligible. Other runs get
|
|
18
|
+
* control before the client loads, so they make no config request and log no exposure.
|
|
19
|
+
*/
|
|
20
|
+
async function resolveFreeTierLimitAgentGuidanceVariantAsync({ experimentation, accountId, }) {
|
|
21
|
+
if (!(0, agent_1.getAgentTelemetryContext)()) {
|
|
22
|
+
return 'control';
|
|
23
|
+
}
|
|
24
|
+
const client = await experimentation.getClientAsync();
|
|
25
|
+
return client
|
|
26
|
+
.getAccountNamespace(exports.FREE_TIER_LIMIT_AGENT_GUIDANCE_EXPERIMENT_NAMESPACE, { accountId })
|
|
27
|
+
.getParam('variant', 'control');
|
|
28
|
+
}
|
|
29
|
+
function formatFreeTierLimitAgentGuidance(platform) {
|
|
30
|
+
const platformName = platform_1.requestedPlatformDisplayNames[platform];
|
|
31
|
+
return `Fix: Human required: ${platformName} builds for this account are blocked until the Free plan resets. Upgrading costs money, so an account owner or admin decides.`;
|
|
32
|
+
}
|
|
33
|
+
async function maybeAppendFreeTierLimitAgentGuidanceAsync(message, platform, experiment) {
|
|
34
|
+
if (!experiment ||
|
|
35
|
+
(await resolveFreeTierLimitAgentGuidanceVariantAsync(experiment)) !== 'treatment') {
|
|
36
|
+
return message;
|
|
37
|
+
}
|
|
38
|
+
return `${message}\n${formatFreeTierLimitAgentGuidance(platform)}`;
|
|
39
|
+
}
|
|
@@ -5,6 +5,7 @@ import { LocalBuildOptions } from './local';
|
|
|
5
5
|
import { Analytics } from '../analytics/AnalyticsManager';
|
|
6
6
|
import { DynamicConfigContextFn } from '../commandUtils/context/DynamicProjectConfigContextField';
|
|
7
7
|
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
8
|
+
import { LazyExperimentationClient } from '../experimentation/LazyExperimentationClient';
|
|
8
9
|
import { BuildFragment } from '../graphql/generated';
|
|
9
10
|
import { RequestedPlatform } from '../platform';
|
|
10
11
|
import { SimulatorRunTarget } from '../run/ios/run';
|
|
@@ -30,7 +31,7 @@ export interface BuildFlags {
|
|
|
30
31
|
whatToTest?: string;
|
|
31
32
|
simulator?: SimulatorRunTarget;
|
|
32
33
|
}
|
|
33
|
-
export declare function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsClient, projectDir, flags, actor, getDynamicPrivateProjectConfigAsync, downloadSimBuildAutoConfirm, envOverride, }: {
|
|
34
|
+
export declare function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsClient, projectDir, flags, actor, getDynamicPrivateProjectConfigAsync, downloadSimBuildAutoConfirm, envOverride, experimentation, }: {
|
|
34
35
|
graphqlClient: ExpoGraphqlClient;
|
|
35
36
|
analytics: Analytics;
|
|
36
37
|
vcsClient: Client;
|
|
@@ -40,6 +41,8 @@ export declare function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsCl
|
|
|
40
41
|
getDynamicPrivateProjectConfigAsync: DynamicConfigContextFn;
|
|
41
42
|
downloadSimBuildAutoConfirm?: boolean;
|
|
42
43
|
envOverride?: Env;
|
|
44
|
+
/** Enables the Free plan limit guidance experiment for builds driven by a coding agent. */
|
|
45
|
+
experimentation?: LazyExperimentationClient;
|
|
43
46
|
}): Promise<{
|
|
44
47
|
buildIds: string[];
|
|
45
48
|
buildProfiles?: ProfileData<'build'>[];
|
|
@@ -49,7 +49,7 @@ let metroConfigValidated = false;
|
|
|
49
49
|
let sdkVersionChecked = false;
|
|
50
50
|
let lockfileChecked = false;
|
|
51
51
|
let hasWarnedAboutUsageOverages = false;
|
|
52
|
-
async function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsClient, projectDir, flags, actor, getDynamicPrivateProjectConfigAsync, downloadSimBuildAutoConfirm, envOverride, }) {
|
|
52
|
+
async function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsClient, projectDir, flags, actor, getDynamicPrivateProjectConfigAsync, downloadSimBuildAutoConfirm, envOverride, experimentation, }) {
|
|
53
53
|
await vcsClient.ensureRepoExistsAsync();
|
|
54
54
|
await (0, repository_1.ensureRepoIsCleanAsync)(vcsClient, flags.nonInteractive);
|
|
55
55
|
await (0, configure_1.ensureProjectConfiguredAsync)({
|
|
@@ -129,6 +129,7 @@ async function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsClient, pro
|
|
|
129
129
|
customBuildConfigMetadata: customBuildConfigMetadataByPlatform[platform],
|
|
130
130
|
env,
|
|
131
131
|
easJsonAccessor,
|
|
132
|
+
experimentation,
|
|
132
133
|
});
|
|
133
134
|
if (maybeBuild) {
|
|
134
135
|
startedBuilds.push({ build: maybeBuild, buildProfile });
|
|
@@ -222,7 +223,7 @@ async function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsClient, pro
|
|
|
222
223
|
buildProfiles,
|
|
223
224
|
};
|
|
224
225
|
}
|
|
225
|
-
async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildProfile, easJsonCliConfig, actor, graphqlClient, analytics, vcsClient, getDynamicPrivateProjectConfigAsync, customBuildConfigMetadata, env, easJsonAccessor, }) {
|
|
226
|
+
async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildProfile, easJsonCliConfig, actor, graphqlClient, analytics, vcsClient, getDynamicPrivateProjectConfigAsync, customBuildConfigMetadata, env, easJsonAccessor, experimentation, }) {
|
|
226
227
|
const buildCtx = await (0, createContext_1.createBuildContextAsync)({
|
|
227
228
|
buildProfileName: buildProfile.profileName,
|
|
228
229
|
resourceClassFlag: flags.resourceClass,
|
|
@@ -247,6 +248,7 @@ async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildP
|
|
|
247
248
|
isVerboseLoggingEnabled: flags.isVerboseLoggingEnabled ?? false,
|
|
248
249
|
whatToTest: flags.whatToTest,
|
|
249
250
|
env,
|
|
251
|
+
experimentation,
|
|
250
252
|
});
|
|
251
253
|
if (!lockfileChecked && !flags.localBuildOptions.localBuildMode) {
|
|
252
254
|
if (!process.env.EAS_BUILD_SKIP_LOCKFILE_CHECK) {
|
|
@@ -2,6 +2,7 @@ import { Command } from '@oclif/core';
|
|
|
2
2
|
import AnalyticsContextField from './context/AnalyticsContextField';
|
|
3
3
|
import ContextField from './context/ContextField';
|
|
4
4
|
import DynamicLoggedInContextField from './context/DynamicLoggedInContextField';
|
|
5
|
+
import ExperimentationContextField from './context/ExperimentationContextField';
|
|
5
6
|
import { DynamicPrivateProjectConfigContextField, DynamicPublicProjectConfigContextField } from './context/DynamicProjectConfigContextField';
|
|
6
7
|
import LoggedInContextField from './context/LoggedInContextField';
|
|
7
8
|
import MaybeLoggedInContextField from './context/MaybeLoggedInContextField';
|
|
@@ -113,6 +114,14 @@ export default abstract class EasCommand extends Command {
|
|
|
113
114
|
ProjectId: {
|
|
114
115
|
projectId: ProjectIdContextField;
|
|
115
116
|
};
|
|
117
|
+
/**
|
|
118
|
+
* Experimentation client for user, account, and device experiments.
|
|
119
|
+
* Declare a login field first so user experiments see the actor.
|
|
120
|
+
* Account experiments take the account ID from the command.
|
|
121
|
+
*/
|
|
122
|
+
Experimentation: {
|
|
123
|
+
experimentation: ExperimentationContextField;
|
|
124
|
+
};
|
|
116
125
|
};
|
|
117
126
|
/**
|
|
118
127
|
* Context allows for subclasses (commands) to declare their prerequisites in a type-safe manner.
|
|
@@ -7,6 +7,7 @@ const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
|
7
7
|
const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
|
|
8
8
|
const AnalyticsContextField_1 = tslib_1.__importDefault(require("./context/AnalyticsContextField"));
|
|
9
9
|
const DynamicLoggedInContextField_1 = tslib_1.__importDefault(require("./context/DynamicLoggedInContextField"));
|
|
10
|
+
const ExperimentationContextField_1 = tslib_1.__importDefault(require("./context/ExperimentationContextField"));
|
|
10
11
|
const DynamicProjectConfigContextField_1 = require("./context/DynamicProjectConfigContextField");
|
|
11
12
|
const LoggedInContextField_1 = tslib_1.__importDefault(require("./context/LoggedInContextField"));
|
|
12
13
|
const MaybeLoggedInContextField_1 = tslib_1.__importDefault(require("./context/MaybeLoggedInContextField"));
|
|
@@ -104,6 +105,14 @@ class EasCommand extends core_1.Command {
|
|
|
104
105
|
ProjectId: {
|
|
105
106
|
projectId: new ProjectIdContextField_1.ProjectIdContextField(),
|
|
106
107
|
},
|
|
108
|
+
/**
|
|
109
|
+
* Experimentation client for user, account, and device experiments.
|
|
110
|
+
* Declare a login field first so user experiments see the actor.
|
|
111
|
+
* Account experiments take the account ID from the command.
|
|
112
|
+
*/
|
|
113
|
+
Experimentation: {
|
|
114
|
+
experimentation: new ExperimentationContextField_1.default(),
|
|
115
|
+
},
|
|
107
116
|
};
|
|
108
117
|
/**
|
|
109
118
|
* Context allows for subclasses (commands) to declare their prerequisites in a type-safe manner.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import ContextField, { ContextOptions } from './ContextField';
|
|
2
|
+
import { LazyExperimentationClient } from '../../experimentation/LazyExperimentationClient';
|
|
3
|
+
/**
|
|
4
|
+
* Never prompts, throws, writes files, or reads the app config. A failed config fetch disables
|
|
5
|
+
* all scopes. CI runs skip the fetch and get defaults.
|
|
6
|
+
* The config fetch runs on the first `getClientAsync` call, so commands that never read a variant
|
|
7
|
+
* make no request.
|
|
8
|
+
*/
|
|
9
|
+
export default class ExperimentationContextField extends ContextField<LazyExperimentationClient> {
|
|
10
|
+
private readonly clientByAnalytics;
|
|
11
|
+
getValueAsync(options: ContextOptions): Promise<LazyExperimentationClient>;
|
|
12
|
+
private buildClientAsync;
|
|
13
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const ContextField_1 = tslib_1.__importDefault(require("./ContextField"));
|
|
5
|
+
const createGraphqlClient_1 = require("./contextUtils/createGraphqlClient");
|
|
6
|
+
const ExperimentOverrides_1 = require("../../experimentation/ExperimentOverrides");
|
|
7
|
+
const ExperimentationClient_1 = require("../../experimentation/ExperimentationClient");
|
|
8
|
+
const LazyExperimentationClient_1 = require("../../experimentation/LazyExperimentationClient");
|
|
9
|
+
const ExperimentationConfigQuery_1 = require("../../graphql/queries/ExperimentationConfigQuery");
|
|
10
|
+
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
11
|
+
/** Caps how long the config fetch and the actor lookup can delay a command. */
|
|
12
|
+
const REQUEST_TIMEOUT_MS = 3000;
|
|
13
|
+
const CI_ENVIRONMENT_FLAGS = ['EAS_BUILD', 'CI'];
|
|
14
|
+
function isRunningInCi() {
|
|
15
|
+
return CI_ENVIRONMENT_FLAGS.some(flag => !!process.env[flag]);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Never prompts, throws, writes files, or reads the app config. A failed config fetch disables
|
|
19
|
+
* all scopes. CI runs skip the fetch and get defaults.
|
|
20
|
+
* The config fetch runs on the first `getClientAsync` call, so commands that never read a variant
|
|
21
|
+
* make no request.
|
|
22
|
+
*/
|
|
23
|
+
class ExperimentationContextField extends ContextField_1.default {
|
|
24
|
+
// One handle per command run, so repeated getContextAsync calls cannot log duplicate exposures.
|
|
25
|
+
clientByAnalytics = new WeakMap();
|
|
26
|
+
async getValueAsync(options) {
|
|
27
|
+
let client = this.clientByAnalytics.get(options.analytics);
|
|
28
|
+
if (!client) {
|
|
29
|
+
client = new LazyExperimentationClient_1.LazyExperimentationClient(() => this.buildClientAsync(options));
|
|
30
|
+
this.clientByAnalytics.set(options.analytics, client);
|
|
31
|
+
}
|
|
32
|
+
return client;
|
|
33
|
+
}
|
|
34
|
+
async buildClientAsync({ sessionManager, analytics, }) {
|
|
35
|
+
const overrides = ExperimentOverrides_1.ExperimentOverrides.fromEnv();
|
|
36
|
+
if (isRunningInCi()) {
|
|
37
|
+
log_1.default.debug('[experimentation] Running in CI. Experiments return defaults.');
|
|
38
|
+
return ExperimentationClient_1.ExperimentationClient.createDisabled(overrides);
|
|
39
|
+
}
|
|
40
|
+
const deviceId = analytics.getDeviceId();
|
|
41
|
+
if (deviceId === null) {
|
|
42
|
+
log_1.default.debug('[experimentation] Analytics is disabled. Experiments return defaults.');
|
|
43
|
+
return ExperimentationClient_1.ExperimentationClient.createDisabled(overrides);
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)({
|
|
47
|
+
accessToken: sessionManager.getAccessToken(),
|
|
48
|
+
sessionSecret: sessionManager.getSessionSecret(),
|
|
49
|
+
}, { requestTimeoutMs: REQUEST_TIMEOUT_MS });
|
|
50
|
+
// The session manager skips the request once an actor is cached. Without a cached actor
|
|
51
|
+
// (for example, a stale session) it makes its own request, so it needs the same cap.
|
|
52
|
+
const [actorResult, configsResult] = await Promise.allSettled([
|
|
53
|
+
sessionManager.getUserAsync({ requestTimeoutMs: REQUEST_TIMEOUT_MS }),
|
|
54
|
+
ExperimentationConfigQuery_1.ExperimentationConfigQuery.getConfigsAsync(graphqlClient),
|
|
55
|
+
]);
|
|
56
|
+
if (configsResult.status === 'rejected') {
|
|
57
|
+
log_1.default.debug('[experimentation] Failed to fetch the experiment config. Experiments return defaults.', errorMessage(configsResult.reason));
|
|
58
|
+
return ExperimentationClient_1.ExperimentationClient.createDisabled(overrides);
|
|
59
|
+
}
|
|
60
|
+
const configs = configsResult.value;
|
|
61
|
+
return new ExperimentationClient_1.ExperimentationClient({
|
|
62
|
+
user: configs.userConfig,
|
|
63
|
+
account: configs.accountConfig,
|
|
64
|
+
device: configs.deviceConfig,
|
|
65
|
+
}, {
|
|
66
|
+
user: actorResult.status === 'fulfilled' ? (actorResult.value?.id ?? null) : null,
|
|
67
|
+
device: deviceId,
|
|
68
|
+
}, overrides, (0, ExperimentationClient_1.createLoggerConfig)(analytics));
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
log_1.default.debug('[experimentation] Failed to initialize experiments. Experiments return defaults.', errorMessage(error));
|
|
72
|
+
return ExperimentationClient_1.ExperimentationClient.createDisabled(overrides);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.default = ExperimentationContextField;
|
|
77
|
+
function errorMessage(error) {
|
|
78
|
+
return error instanceof Error ? error.message : String(error);
|
|
79
|
+
}
|
|
@@ -4,4 +4,7 @@ export interface ExpoGraphqlClient extends Client {
|
|
|
4
4
|
export declare function createGraphqlClient(authInfo: {
|
|
5
5
|
accessToken: string | null;
|
|
6
6
|
sessionSecret: string | null;
|
|
7
|
+
}, options?: {
|
|
8
|
+
/** Request timeout. Kept at the client level: a per-operation `fetchOptions` in urql would replace the auth headers. */
|
|
9
|
+
requestTimeoutMs?: number;
|
|
7
10
|
}): ExpoGraphqlClient;
|
|
@@ -7,7 +7,34 @@ const exchange_retry_1 = require("@urql/exchange-retry");
|
|
|
7
7
|
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
8
8
|
const api_1 = require("../../../api");
|
|
9
9
|
const fetch_1 = require("../../../fetch");
|
|
10
|
-
function createGraphqlClient(authInfo) {
|
|
10
|
+
function createGraphqlClient(authInfo, options = {}) {
|
|
11
|
+
const { requestTimeoutMs } = options;
|
|
12
|
+
// urql overwrites `fetchOptions.signal`, so the timeout must be added inside fetch.
|
|
13
|
+
const fetchWithTimeoutAsync = async (url, init) => {
|
|
14
|
+
if (!requestTimeoutMs) {
|
|
15
|
+
return await (0, node_fetch_1.default)(url, init);
|
|
16
|
+
}
|
|
17
|
+
const timeoutSignal = AbortSignal.timeout(requestTimeoutMs);
|
|
18
|
+
try {
|
|
19
|
+
return await (0, node_fetch_1.default)(url, {
|
|
20
|
+
...init,
|
|
21
|
+
signal: AbortSignal.any([
|
|
22
|
+
...(init?.signal ? [init.signal] : []),
|
|
23
|
+
timeoutSignal,
|
|
24
|
+
]),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
if (timeoutSignal.aborted) {
|
|
29
|
+
const timeoutError = new Error(`Request timed out after ${requestTimeoutMs} ms`, {
|
|
30
|
+
cause: error,
|
|
31
|
+
});
|
|
32
|
+
timeoutError.name = 'TimeoutError';
|
|
33
|
+
throw timeoutError;
|
|
34
|
+
}
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
11
38
|
return (0, core_1.createClient)({
|
|
12
39
|
url: (0, api_1.getExpoApiBaseUrl)() + '/graphql',
|
|
13
40
|
exchanges: [
|
|
@@ -23,7 +50,7 @@ function createGraphqlClient(authInfo) {
|
|
|
23
50
|
core_1.fetchExchange,
|
|
24
51
|
],
|
|
25
52
|
// @ts-expect-error Type 'typeof fetch' is not assignable to type '(input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>'.
|
|
26
|
-
fetch:
|
|
53
|
+
fetch: fetchWithTimeoutAsync,
|
|
27
54
|
fetchOptions: () => {
|
|
28
55
|
const headers = {};
|
|
29
56
|
if (authInfo.accessToken) {
|
|
@@ -6,7 +6,7 @@ const AnalyticsManager_1 = require("../analytics/AnalyticsManager");
|
|
|
6
6
|
const EasCommand_1 = tslib_1.__importDefault(require("../commandUtils/EasCommand"));
|
|
7
7
|
const log_1 = tslib_1.__importDefault(require("../log"));
|
|
8
8
|
class AnalyticsView extends EasCommand_1.default {
|
|
9
|
-
static description = 'display or change analytics settings';
|
|
9
|
+
static description = 'display or change analytics settings (disabling analytics also disables experiments)';
|
|
10
10
|
static args = {
|
|
11
11
|
STATUS: core_1.Args.string({
|
|
12
12
|
options: ['on', 'off'],
|
|
@@ -25,6 +25,7 @@ export default class Build extends EasCommand {
|
|
|
25
25
|
'verbose-logs': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
26
26
|
};
|
|
27
27
|
static contextDefinition: {
|
|
28
|
+
experimentation: import("../../commandUtils/context/ExperimentationContextField").default;
|
|
28
29
|
vcsClient: import("../../commandUtils/context/VcsClientContextField").default;
|
|
29
30
|
analytics: import("../../commandUtils/context/AnalyticsContextField").default;
|
|
30
31
|
projectDir: import("../../commandUtils/context/ProjectDirContextField").default;
|
|
@@ -108,6 +108,7 @@ class Build extends EasCommand_1.default {
|
|
|
108
108
|
...this.ContextOptions.ProjectDir,
|
|
109
109
|
...this.ContextOptions.Analytics,
|
|
110
110
|
...this.ContextOptions.Vcs,
|
|
111
|
+
...this.ContextOptions.Experimentation,
|
|
111
112
|
};
|
|
112
113
|
async runAsync() {
|
|
113
114
|
const { flags: rawFlags } = await this.parse(Build);
|
|
@@ -115,7 +116,7 @@ class Build extends EasCommand_1.default {
|
|
|
115
116
|
(0, json_1.enableJsonOutput)();
|
|
116
117
|
}
|
|
117
118
|
const flags = this.sanitizeFlags(rawFlags);
|
|
118
|
-
const { loggedIn: { actor, graphqlClient }, getDynamicPrivateProjectConfigAsync, projectDir, analytics, vcsClient, } = await this.getContextAsync(Build, {
|
|
119
|
+
const { loggedIn: { actor, graphqlClient }, getDynamicPrivateProjectConfigAsync, projectDir, analytics, vcsClient, experimentation, } = await this.getContextAsync(Build, {
|
|
119
120
|
nonInteractive: flags.nonInteractive,
|
|
120
121
|
withServerSideEnvironment: null,
|
|
121
122
|
});
|
|
@@ -134,6 +135,7 @@ class Build extends EasCommand_1.default {
|
|
|
134
135
|
flags: flagsWithPlatform,
|
|
135
136
|
actor,
|
|
136
137
|
getDynamicPrivateProjectConfigAsync,
|
|
138
|
+
experimentation,
|
|
137
139
|
});
|
|
138
140
|
this.maybeSuggestUsingEasBuildDev({
|
|
139
141
|
buildProfiles,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
+
export default class SimulatorControl extends EasCommand {
|
|
3
|
+
static aliases: string[];
|
|
4
|
+
static description: string;
|
|
5
|
+
static strict: boolean;
|
|
6
|
+
static examples: string[];
|
|
7
|
+
static args: {
|
|
8
|
+
action: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
9
|
+
};
|
|
10
|
+
static flags: {
|
|
11
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
list: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
|
+
};
|
|
18
|
+
static contextDefinition: {
|
|
19
|
+
projectDir: import("../../commandUtils/context/ProjectDirContextField").default;
|
|
20
|
+
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
21
|
+
};
|
|
22
|
+
runAsync(): Promise<void>;
|
|
23
|
+
private printCatalog;
|
|
24
|
+
private printActionHelp;
|
|
25
|
+
private runActionAsync;
|
|
26
|
+
}
|