eas-cli 26.0.0 → 27.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 +293 -148
- package/build/analytics/AnalyticsManager.d.ts +2 -0
- package/build/analytics/AnalyticsManager.js +2 -0
- package/build/build/build.d.ts +1 -2
- package/build/build/build.js +9 -4
- package/build/build/errors.d.ts +2 -0
- package/build/build/errors.js +4 -1
- package/build/build/evaluateConfigWithEnvVarsAsync.js +1 -3
- package/build/build/freeTierNearLimitAgentUpdatesTip.d.ts +98 -0
- package/build/build/freeTierNearLimitAgentUpdatesTip.js +205 -0
- package/build/build/runBuildAndSubmit.d.ts +2 -0
- package/build/build/runBuildAndSubmit.js +3 -0
- package/build/build/simulatorsLaunchHint.d.ts +7 -0
- package/build/build/simulatorsLaunchHint.js +40 -0
- package/build/build/utils/expoTokenRole.d.ts +4 -0
- package/build/build/utils/expoTokenRole.js +14 -0
- package/build/commandUtils/EasCommand.js +3 -3
- package/build/commandUtils/context/contextUtils/findProjectDirAndVerifyProjectSetupAsync.js +2 -1
- package/build/commandUtils/workflow/referencedFiles.d.ts +6 -0
- package/build/commandUtils/workflow/referencedFiles.js +63 -0
- package/build/commandUtils/workflow/types.d.ts +1 -1
- package/build/commandUtils/workflow/utils.js +34 -5
- package/build/commands/account/login.js +6 -0
- package/build/commands/account/view.d.ts +0 -7
- package/build/commands/account/view.js +4 -74
- package/build/commands/build/index.js +8 -1
- package/build/commands/observe/session.js +4 -3
- package/build/commands/observe/trace.d.ts +17 -0
- package/build/commands/observe/trace.js +58 -0
- package/build/commands/observe/traces.d.ts +33 -0
- package/build/commands/observe/traces.js +159 -0
- package/build/commands/simulator/control.js +41 -6
- package/build/commands/simulator/logs.d.ts +22 -0
- package/build/commands/simulator/logs.js +188 -0
- package/build/commands/workflow/cancel.js +9 -20
- package/build/commands/workflow/run.js +9 -0
- package/build/commands/workflow/runs.js +1 -1
- package/build/graphql/generated.d.ts +698 -5
- package/build/graphql/generated.js +25 -4
- package/build/graphql/mutations/UserPreferenceMutation.d.ts +5 -0
- package/build/graphql/mutations/UserPreferenceMutation.js +24 -0
- package/build/graphql/mutations/WorkflowRevisionMutation.d.ts +3 -2
- package/build/graphql/mutations/WorkflowRevisionMutation.js +12 -3
- package/build/graphql/queries/AccountQuery.d.ts +3 -1
- package/build/graphql/queries/AccountQuery.js +54 -0
- package/build/graphql/queries/ObserveQuery.d.ts +24 -1
- package/build/graphql/queries/ObserveQuery.js +114 -1
- package/build/graphql/queries/UserPreferenceQuery.d.ts +8 -0
- package/build/graphql/queries/UserPreferenceQuery.js +28 -0
- package/build/graphql/queries/WorkflowRunQuery.js +6 -0
- package/build/graphql/types/Observe.d.ts +1 -0
- package/build/graphql/types/Observe.js +53 -1
- package/build/graphql/types/WorkflowRun.js +1 -0
- package/build/help.js +13 -6
- package/build/log.d.ts +2 -0
- package/build/log.js +10 -0
- package/build/observe/fetchSessions.d.ts +12 -1
- package/build/observe/fetchSessions.js +39 -2
- package/build/observe/fetchSpans.d.ts +27 -0
- package/build/observe/fetchSpans.js +36 -0
- package/build/observe/formatSessions.d.ts +3 -1
- package/build/observe/formatSessions.js +40 -3
- package/build/observe/formatSpans.d.ts +110 -0
- package/build/observe/formatSpans.js +250 -0
- package/build/observe/spanFilters.d.ts +5 -0
- package/build/observe/spanFilters.js +32 -0
- package/build/project/projectStatus.js +1 -0
- package/build/simulator/artifacts.d.ts +9 -0
- package/build/simulator/artifacts.js +97 -0
- package/build/simulator/download.d.ts +2 -0
- package/build/simulator/download.js +57 -0
- package/build/simulator/events.js +2 -10
- package/build/simulator/preview.d.ts +26 -0
- package/build/simulator/preview.js +156 -0
- package/build/simulator/utils.d.ts +5 -0
- package/build/simulator/utils.js +42 -0
- package/build/user/accountPermissions.d.ts +11 -0
- package/build/user/accountPermissions.js +89 -0
- package/oclif.manifest.json +920 -422
- package/package.json +6 -6
- package/build/build/freeTierLimitGuidance.d.ts +0 -19
- package/build/build/freeTierLimitGuidance.js +0 -39
|
@@ -42,6 +42,8 @@ export declare enum BuildEvent {
|
|
|
42
42
|
BUILD_REQUEST_SUCCESS = "build cli build request success",
|
|
43
43
|
BUILD_REQUEST_FAIL = "build cli build request fail",
|
|
44
44
|
FREE_TIER_LIMIT_CHECKOUT_PROMPT = "build cli free tier limit checkout prompt",
|
|
45
|
+
FREE_TIER_NEAR_LIMIT_AGENT_UPDATES_TIP = "build cli free tier near limit agent updates tip",
|
|
46
|
+
SIMULATORS_LAUNCH_HINT_SHOWN = "build cli simulators launch hint shown",
|
|
45
47
|
BUILD_STATUS_COMMAND = "build cli build status",
|
|
46
48
|
CREDENTIALS_SYNC_COMMAND = "build cli credentials sync command",
|
|
47
49
|
CREDENTIALS_SYNC_UPDATE_LOCAL_ATTEMPT = "build cli credentials sync update local attempt",
|
|
@@ -67,6 +67,8 @@ var BuildEvent;
|
|
|
67
67
|
BuildEvent["BUILD_REQUEST_SUCCESS"] = "build cli build request success";
|
|
68
68
|
BuildEvent["BUILD_REQUEST_FAIL"] = "build cli build request fail";
|
|
69
69
|
BuildEvent["FREE_TIER_LIMIT_CHECKOUT_PROMPT"] = "build cli free tier limit checkout prompt";
|
|
70
|
+
BuildEvent["FREE_TIER_NEAR_LIMIT_AGENT_UPDATES_TIP"] = "build cli free tier near limit agent updates tip";
|
|
71
|
+
BuildEvent["SIMULATORS_LAUNCH_HINT_SHOWN"] = "build cli simulators launch hint shown";
|
|
70
72
|
BuildEvent["BUILD_STATUS_COMMAND"] = "build cli build status";
|
|
71
73
|
BuildEvent["CREDENTIALS_SYNC_COMMAND"] = "build cli credentials sync command";
|
|
72
74
|
BuildEvent["CREDENTIALS_SYNC_UPDATE_LOCAL_ATTEMPT"] = "build cli credentials sync update local attempt";
|
package/build/build/build.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { ArchiveSource, BuildJob, Platform } from '@expo/eas-build-job';
|
|
|
2
2
|
import { CredentialsSource } from '@expo/eas-json';
|
|
3
3
|
import { BuildContext } from './context';
|
|
4
4
|
import { FreeTierLimitCheckoutExperiment } from './freeTierLimitCheckout';
|
|
5
|
-
import { FreeTierLimitAgentGuidanceExperiment } from './freeTierLimitGuidance';
|
|
6
5
|
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
7
6
|
import { BuildFragment, BuildMetadataInput, BuildParamsInput } from '../graphql/generated';
|
|
8
7
|
import { BuildResult } from '../graphql/mutations/BuildMutation';
|
|
@@ -23,7 +22,7 @@ interface Builder<TPlatform extends Platform, Credentials, TJob extends BuildJob
|
|
|
23
22
|
}
|
|
24
23
|
export type BuildRequestSender = () => Promise<BuildFragment | undefined>;
|
|
25
24
|
export declare function prepareBuildRequestForPlatformAsync<TPlatform extends Platform, Credentials, TJob extends BuildJob>(builder: Builder<TPlatform, Credentials, TJob>): Promise<BuildRequestSender>;
|
|
26
|
-
export declare function handleBuildRequestErrorAsync(error: any, platform: Platform, accountName?: string,
|
|
25
|
+
export declare function handleBuildRequestErrorAsync(error: any, platform: Platform, accountName?: string, freeTierLimitCheckoutExperiment?: FreeTierLimitCheckoutExperiment): Promise<never>;
|
|
27
26
|
export type MaybeBuildFragment = BuildFragment | null;
|
|
28
27
|
export declare function waitForBuildEndAsync(graphqlClient: ExpoGraphqlClient, { buildIds, accountName }: {
|
|
29
28
|
buildIds: string[];
|
package/build/build/build.js
CHANGED
|
@@ -12,11 +12,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
14
|
const freeTierLimitCheckout_1 = require("./freeTierLimitCheckout");
|
|
15
|
-
const freeTierLimitGuidance_1 = require("./freeTierLimitGuidance");
|
|
16
15
|
const graphql_1 = require("./graphql");
|
|
17
16
|
const local_1 = require("./local");
|
|
18
17
|
const logs_1 = require("./logs");
|
|
19
18
|
const metadata_1 = require("./metadata");
|
|
19
|
+
const expoTokenRole_1 = require("./utils/expoTokenRole");
|
|
20
20
|
const printBuildInfo_1 = require("./utils/printBuildInfo");
|
|
21
21
|
const repository_1 = require("./utils/repository");
|
|
22
22
|
const url_1 = require("./utils/url");
|
|
@@ -44,6 +44,7 @@ function resolveBuildParamsInput(ctx, metadata) {
|
|
|
44
44
|
resourceClass: ctx.resourceClass,
|
|
45
45
|
sdkVersion: metadata.sdkVersion,
|
|
46
46
|
reactNativeVersion: metadata.reactNativeVersion,
|
|
47
|
+
expoTokenRole: (0, expoTokenRole_1.resolveJobExpoTokenRole)(ctx.buildProfile),
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
50
|
async function prepareBuildRequestForPlatformAsync(builder) {
|
|
@@ -123,7 +124,7 @@ async function prepareBuildRequestForPlatformAsync(builder) {
|
|
|
123
124
|
return await sendBuildRequestAsync(builder, job, graphqlMetadata, buildParams);
|
|
124
125
|
}
|
|
125
126
|
catch (error) {
|
|
126
|
-
return await handleBuildRequestErrorAsync(error, job.platform, ctx.accountName, (0,
|
|
127
|
+
return await handleBuildRequestErrorAsync(error, job.platform, ctx.accountName, (0, freeTierLimitCheckout_1.getFreeTierLimitCheckoutExperiment)(ctx));
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
else {
|
|
@@ -142,7 +143,7 @@ const SERVER_SIDE_DEFINED_ERRORS = {
|
|
|
142
143
|
EAS_BUILD_LEGACY_RESOURCE_CLASS_NOT_AVAILABLE: errors_1.EasBuildLegacyResourceClassNotAvailableError,
|
|
143
144
|
VALIDATION_ERROR: errors_1.RequestValidationError,
|
|
144
145
|
};
|
|
145
|
-
async function handleBuildRequestErrorAsync(error, platform, accountName,
|
|
146
|
+
async function handleBuildRequestErrorAsync(error, platform, accountName, freeTierLimitCheckoutExperiment) {
|
|
146
147
|
logBuildRequestErrorDebugInfo(error);
|
|
147
148
|
const graphQLErrors = Array.isArray(error?.graphQLErrors)
|
|
148
149
|
? error.graphQLErrors
|
|
@@ -156,7 +157,7 @@ async function handleBuildRequestErrorAsync(error, platform, accountName, freeTi
|
|
|
156
157
|
if (!isFreeTierLimitError) {
|
|
157
158
|
throw new ErrorClass(message);
|
|
158
159
|
}
|
|
159
|
-
const limitMessage =
|
|
160
|
+
const limitMessage = `${message}\nRun ${(0, plans_1.formatStarterSubscribeCommand)(accountName)} to upgrade to the Starter plan.`;
|
|
160
161
|
const messageAlreadyPrinted = await (0, freeTierLimitCheckout_1.maybeOfferFreeTierLimitCheckoutAsync)(limitMessage, freeTierLimitCheckoutExperiment);
|
|
161
162
|
throw new ErrorClass(limitMessage, { messageAlreadyPrinted });
|
|
162
163
|
}
|
|
@@ -166,6 +167,10 @@ async function handleBuildRequestErrorAsync(error, platform, accountName, freeTi
|
|
|
166
167
|
else if (graphQLErrorCode === 'EAS_BUILD_TOO_MANY_PENDING_BUILDS') {
|
|
167
168
|
throw new errors_1.EasBuildTooManyPendingBuildsError(`You have already reached the maximum number of pending ${platform_1.requestedPlatformDisplayNames[platform]} builds for your account. Try again later.`);
|
|
168
169
|
}
|
|
170
|
+
else if (graphQLErrorCode === 'UNAUTHORIZED') {
|
|
171
|
+
const requestId = graphQLErrors[0]?.extensions?.requestId;
|
|
172
|
+
throw new errors_1.EasBuildUnauthorizedError(`${graphQLErrors[0]?.message}${requestId ? `\nRequest ID: ${requestId}` : ''}\n\nRun ${chalk_1.default.bold('eas whoami')} to check the user you are logged in as and your permission grant. Run ${chalk_1.default.bold('eas login')} to change the user or permission grant.\n\nIf your build profile in eas.json uses ${chalk_1.default.bold('permissions.account.role')}, it may mean your credentials do not grant the requested role.`);
|
|
173
|
+
}
|
|
169
174
|
else if (Array.isArray(error?.graphQLErrors)) {
|
|
170
175
|
const errorDetails = formatBuildRequestErrorDetails(error, graphQLErrors);
|
|
171
176
|
throw new Error(`Build request failed. Make sure you are using the latest eas-cli version. If the problem persists, report the issue.${errorDetails}`);
|
package/build/build/errors.d.ts
CHANGED
|
@@ -21,5 +21,7 @@ export declare class EasBuildDownForMaintenanceError extends EasCommandError {
|
|
|
21
21
|
}
|
|
22
22
|
export declare class EasBuildTooManyPendingBuildsError extends EasCommandError {
|
|
23
23
|
}
|
|
24
|
+
export declare class EasBuildUnauthorizedError extends EasCommandError {
|
|
25
|
+
}
|
|
24
26
|
export declare class EasBuildProjectArchiveUploadError extends EasCommandError {
|
|
25
27
|
}
|
package/build/build/errors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EasBuildProjectArchiveUploadError = exports.EasBuildTooManyPendingBuildsError = exports.EasBuildDownForMaintenanceError = exports.RequestValidationError = exports.EasBuildLegacyResourceClassNotAvailableError = exports.EasBuildResourceClassNotAvailableInFreeTierError = exports.EasBuildFreeTierIosLimitExceededError = exports.EasBuildFreeTierLimitExceededError = exports.EasBuildFreeTierDisabledAndroidError = exports.EasBuildFreeTierDisabledIOSError = exports.EasBuildFreeTierDisabledError = exports.TurtleDeprecatedJobFormatError = void 0;
|
|
3
|
+
exports.EasBuildProjectArchiveUploadError = exports.EasBuildUnauthorizedError = exports.EasBuildTooManyPendingBuildsError = exports.EasBuildDownForMaintenanceError = exports.RequestValidationError = exports.EasBuildLegacyResourceClassNotAvailableError = exports.EasBuildResourceClassNotAvailableInFreeTierError = exports.EasBuildFreeTierIosLimitExceededError = exports.EasBuildFreeTierLimitExceededError = exports.EasBuildFreeTierDisabledAndroidError = exports.EasBuildFreeTierDisabledIOSError = exports.EasBuildFreeTierDisabledError = exports.TurtleDeprecatedJobFormatError = void 0;
|
|
4
4
|
const errors_1 = require("../commandUtils/errors");
|
|
5
5
|
class TurtleDeprecatedJobFormatError extends errors_1.EasCommandError {
|
|
6
6
|
}
|
|
@@ -35,6 +35,9 @@ exports.EasBuildDownForMaintenanceError = EasBuildDownForMaintenanceError;
|
|
|
35
35
|
class EasBuildTooManyPendingBuildsError extends errors_1.EasCommandError {
|
|
36
36
|
}
|
|
37
37
|
exports.EasBuildTooManyPendingBuildsError = EasBuildTooManyPendingBuildsError;
|
|
38
|
+
class EasBuildUnauthorizedError extends errors_1.EasCommandError {
|
|
39
|
+
}
|
|
40
|
+
exports.EasBuildUnauthorizedError = EasBuildUnauthorizedError;
|
|
38
41
|
class EasBuildProjectArchiveUploadError extends errors_1.EasCommandError {
|
|
39
42
|
}
|
|
40
43
|
exports.EasBuildProjectArchiveUploadError = EasBuildProjectArchiveUploadError;
|
|
@@ -54,9 +54,7 @@ async function resolveEnvVarsAsync({ buildProfile, buildProfileName, graphqlClie
|
|
|
54
54
|
}
|
|
55
55
|
catch (e) {
|
|
56
56
|
log_1.default.error(`Failed to pull env variables for environment ${environment} from EAS servers`);
|
|
57
|
-
|
|
58
|
-
log_1.default.error('This can possibly be a bug in EAS/EAS CLI. Report it here: https://github.com/expo/eas-cli/issues');
|
|
59
|
-
return { ...buildProfile.env };
|
|
57
|
+
throw e;
|
|
60
58
|
}
|
|
61
59
|
}
|
|
62
60
|
function resolveSuggestedEnvironmentForBuildProfileConfiguration(buildProfile) {
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ExpoConfig } from '@expo/config';
|
|
2
|
+
import { Analytics, AnalyticsEventProperties } from '../analytics/AnalyticsManager';
|
|
3
|
+
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
4
|
+
import { LazyExperimentationClient } from '../experimentation/LazyExperimentationClient';
|
|
5
|
+
import { AppPlatform, BuildFragment } from '../graphql/generated';
|
|
6
|
+
import { LoggedInAuthenticationInfo } from '../user/SessionManager';
|
|
7
|
+
import { Actor } from '../user/User';
|
|
8
|
+
export declare const FREE_TIER_NEAR_LIMIT_AGENT_UPDATES_TIP_EXPERIMENT_NAMESPACE = "cli-build-free-tier-near-limit-agent-updates-tip";
|
|
9
|
+
/** The tip shows when this many builds or fewer are left on the platform. */
|
|
10
|
+
export declare const FREE_TIER_NEAR_LIMIT_AGENT_UPDATES_TIP_BUILDS_LEFT = 5;
|
|
11
|
+
export declare const EAS_UPDATE_GETTING_STARTED_URL = "https://docs.expo.dev/eas-update/getting-started/";
|
|
12
|
+
export type FreeTierNearLimitAgentUpdatesTipVariant = 'control' | 'treatment';
|
|
13
|
+
/** The project state of one platform's build. Each build profile evaluates its own config. */
|
|
14
|
+
export type FreeTierNearLimitAgentUpdatesTipPlatformProject = {
|
|
15
|
+
developmentClient: boolean;
|
|
16
|
+
projectDir: string;
|
|
17
|
+
projectId: string;
|
|
18
|
+
exp: ExpoConfig;
|
|
19
|
+
manifestHostOverride: string | null;
|
|
20
|
+
};
|
|
21
|
+
export type FreeTierNearLimitAgentUpdatesTipExperiment = {
|
|
22
|
+
experimentation: LazyExperimentationClient;
|
|
23
|
+
graphqlClient: ExpoGraphqlClient;
|
|
24
|
+
analytics: Analytics;
|
|
25
|
+
analyticsEventProperties: AnalyticsEventProperties;
|
|
26
|
+
accountId: string;
|
|
27
|
+
/** Only regular and SSO users can store user preferences. */
|
|
28
|
+
isUser: boolean;
|
|
29
|
+
runFromCI: boolean;
|
|
30
|
+
json: boolean;
|
|
31
|
+
projectByPlatform: Partial<Record<AppPlatform, FreeTierNearLimitAgentUpdatesTipPlatformProject>>;
|
|
32
|
+
};
|
|
33
|
+
export type FreeTierNearLimitAgentUpdatesTipBuildContext = {
|
|
34
|
+
experimentation?: LazyExperimentationClient;
|
|
35
|
+
authenticationInfo?: LoggedInAuthenticationInfo;
|
|
36
|
+
analytics: Analytics;
|
|
37
|
+
analyticsEventProperties: AnalyticsEventProperties;
|
|
38
|
+
accountId: string;
|
|
39
|
+
user: Actor;
|
|
40
|
+
developmentClient: boolean;
|
|
41
|
+
projectDir: string;
|
|
42
|
+
projectId: string;
|
|
43
|
+
exp: ExpoConfig;
|
|
44
|
+
easJsonCliConfig: {
|
|
45
|
+
updateManifestHostOverride?: string;
|
|
46
|
+
} | undefined;
|
|
47
|
+
runFromCI: boolean;
|
|
48
|
+
};
|
|
49
|
+
export type FreeTierPlatformBuildUsage = {
|
|
50
|
+
used: number;
|
|
51
|
+
limit: number;
|
|
52
|
+
};
|
|
53
|
+
export type FreeTierBuildUsage = {
|
|
54
|
+
billingPeriodId: string;
|
|
55
|
+
byPlatform: Record<AppPlatform, FreeTierPlatformBuildUsage>;
|
|
56
|
+
};
|
|
57
|
+
/** All build contexts belong to one command run, so the account and the actor are shared. */
|
|
58
|
+
export declare function getFreeTierNearLimitAgentUpdatesTipExperiment(buildCtxByPlatform: Partial<Record<AppPlatform, FreeTierNearLimitAgentUpdatesTipBuildContext>>, { json }: {
|
|
59
|
+
json: boolean;
|
|
60
|
+
}): FreeTierNearLimitAgentUpdatesTipExperiment | undefined;
|
|
61
|
+
export declare function isProjectConfiguredForEASUpdate({ projectDir, exp, projectId, manifestHostOverride, }: Pick<FreeTierNearLimitAgentUpdatesTipPlatformProject, 'projectDir' | 'exp' | 'projectId' | 'manifestHostOverride'>): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Only runs driven by a coding agent logged in as a user, outside CI and without --json are
|
|
64
|
+
* eligible. Everything else gets no tip and no usage request.
|
|
65
|
+
*/
|
|
66
|
+
export declare function isEligibleForFreeTierNearLimitAgentUpdatesTip(experiment: FreeTierNearLimitAgentUpdatesTipExperiment): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* A platform is eligible when its project is not set up for Expo Update. Development builds load
|
|
69
|
+
* JavaScript from the dev server, so the tip does not apply to them.
|
|
70
|
+
*/
|
|
71
|
+
export declare function isPlatformEligibleForFreeTierNearLimitAgentUpdatesTip(project: FreeTierNearLimitAgentUpdatesTipPlatformProject): boolean;
|
|
72
|
+
/** True when the platform still has builds left, but no more than the tip's threshold. */
|
|
73
|
+
export declare function isWithinFreeTierNearLimitBand({ used, limit }: FreeTierPlatformBuildUsage): boolean;
|
|
74
|
+
/** Returns the Free plan build usage per platform, or null when the account is not on the Free plan. */
|
|
75
|
+
export declare function getFreeTierBuildUsageAsync({ graphqlClient, accountId, }: Pick<FreeTierNearLimitAgentUpdatesTipExperiment, 'graphqlClient' | 'accountId'>): Promise<FreeTierBuildUsage | null>;
|
|
76
|
+
/**
|
|
77
|
+
* The first call logs the exposure, so call it only when the tip would show. Accounts outside the
|
|
78
|
+
* rollout get the control default and no exposure.
|
|
79
|
+
*/
|
|
80
|
+
export declare function resolveFreeTierNearLimitAgentUpdatesTipVariantAsync({ experimentation, accountId, }: Pick<FreeTierNearLimitAgentUpdatesTipExperiment, 'experimentation' | 'accountId'>): Promise<FreeTierNearLimitAgentUpdatesTipVariant>;
|
|
81
|
+
export declare function formatFreeTierNearLimitAgentUpdatesTip({ platform, used, limit, }: FreeTierPlatformBuildUsage & {
|
|
82
|
+
platform: AppPlatform;
|
|
83
|
+
}): string;
|
|
84
|
+
export declare function getFreeTierNearLimitAgentUpdatesTipPreferenceKey(accountId: string, platform: AppPlatform): string;
|
|
85
|
+
/**
|
|
86
|
+
* The tip shows at most once per user, account, platform and billing period. The marker is a
|
|
87
|
+
* user preference on the server, so it follows the user across machines and fresh agent
|
|
88
|
+
* sandboxes.
|
|
89
|
+
*/
|
|
90
|
+
export declare function wasFreeTierNearLimitAgentUpdatesTipShownAsync(graphqlClient: ExpoGraphqlClient, accountId: string, platform: AppPlatform, billingPeriodId: string): Promise<boolean>;
|
|
91
|
+
export declare function markFreeTierNearLimitAgentUpdatesTipShownAsync(graphqlClient: ExpoGraphqlClient, accountId: string, platform: AppPlatform, billingPeriodId: string): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* After finished builds, suggests Expo Update to coding agents whose Free plan account is close to
|
|
94
|
+
* the platform build limit. The exposure logs only when every eligibility check passed, so both
|
|
95
|
+
* arms see the same population. The treatment arm prints the tip, logs the tip event, then
|
|
96
|
+
* writes the marker, so a failed write means at most a repeated tip. Fails open on any error.
|
|
97
|
+
*/
|
|
98
|
+
export declare function maybeSuggestEASUpdateToAgentNearFreeTierLimitAsync(builds: (BuildFragment | null)[], experiment: FreeTierNearLimitAgentUpdatesTipExperiment | undefined): Promise<void>;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EAS_UPDATE_GETTING_STARTED_URL = exports.FREE_TIER_NEAR_LIMIT_AGENT_UPDATES_TIP_BUILDS_LEFT = exports.FREE_TIER_NEAR_LIMIT_AGENT_UPDATES_TIP_EXPERIMENT_NAMESPACE = void 0;
|
|
4
|
+
exports.getFreeTierNearLimitAgentUpdatesTipExperiment = getFreeTierNearLimitAgentUpdatesTipExperiment;
|
|
5
|
+
exports.isProjectConfiguredForEASUpdate = isProjectConfiguredForEASUpdate;
|
|
6
|
+
exports.isEligibleForFreeTierNearLimitAgentUpdatesTip = isEligibleForFreeTierNearLimitAgentUpdatesTip;
|
|
7
|
+
exports.isPlatformEligibleForFreeTierNearLimitAgentUpdatesTip = isPlatformEligibleForFreeTierNearLimitAgentUpdatesTip;
|
|
8
|
+
exports.isWithinFreeTierNearLimitBand = isWithinFreeTierNearLimitBand;
|
|
9
|
+
exports.getFreeTierBuildUsageAsync = getFreeTierBuildUsageAsync;
|
|
10
|
+
exports.resolveFreeTierNearLimitAgentUpdatesTipVariantAsync = resolveFreeTierNearLimitAgentUpdatesTipVariantAsync;
|
|
11
|
+
exports.formatFreeTierNearLimitAgentUpdatesTip = formatFreeTierNearLimitAgentUpdatesTip;
|
|
12
|
+
exports.getFreeTierNearLimitAgentUpdatesTipPreferenceKey = getFreeTierNearLimitAgentUpdatesTipPreferenceKey;
|
|
13
|
+
exports.wasFreeTierNearLimitAgentUpdatesTipShownAsync = wasFreeTierNearLimitAgentUpdatesTipShownAsync;
|
|
14
|
+
exports.markFreeTierNearLimitAgentUpdatesTipShownAsync = markFreeTierNearLimitAgentUpdatesTipShownAsync;
|
|
15
|
+
exports.maybeSuggestEASUpdateToAgentNearFreeTierLimitAsync = maybeSuggestEASUpdateToAgentNearFreeTierLimitAsync;
|
|
16
|
+
const tslib_1 = require("tslib");
|
|
17
|
+
const agent_1 = require("../analytics/agent");
|
|
18
|
+
const AnalyticsManager_1 = require("../analytics/AnalyticsManager");
|
|
19
|
+
const createGraphqlClient_1 = require("../commandUtils/context/contextUtils/createGraphqlClient");
|
|
20
|
+
const generated_1 = require("../graphql/generated");
|
|
21
|
+
const UserPreferenceMutation_1 = require("../graphql/mutations/UserPreferenceMutation");
|
|
22
|
+
const AccountQuery_1 = require("../graphql/queries/AccountQuery");
|
|
23
|
+
const UserPreferenceQuery_1 = require("../graphql/queries/UserPreferenceQuery");
|
|
24
|
+
const log_1 = tslib_1.__importDefault(require("../log"));
|
|
25
|
+
const platform_1 = require("../platform");
|
|
26
|
+
const projectUtils_1 = require("../project/projectUtils");
|
|
27
|
+
exports.FREE_TIER_NEAR_LIMIT_AGENT_UPDATES_TIP_EXPERIMENT_NAMESPACE = 'cli-build-free-tier-near-limit-agent-updates-tip';
|
|
28
|
+
/** The tip shows when this many builds or fewer are left on the platform. */
|
|
29
|
+
exports.FREE_TIER_NEAR_LIMIT_AGENT_UPDATES_TIP_BUILDS_LEFT = 5;
|
|
30
|
+
exports.EAS_UPDATE_GETTING_STARTED_URL = 'https://docs.expo.dev/eas-update/getting-started/';
|
|
31
|
+
/** Server-side user preference key prefix. The full key is `<prefix>/<accountId>/<platform>`. */
|
|
32
|
+
const USER_PREFERENCE_KEY_PREFIX = 'free-tier-near-limit-agent-updates-tip-shown';
|
|
33
|
+
/** The tip's requests run after the build, so a stalled request must not delay the exit. */
|
|
34
|
+
const REQUEST_TIMEOUT_MS = 3000;
|
|
35
|
+
/** All build contexts belong to one command run, so the account and the actor are shared. */
|
|
36
|
+
function getFreeTierNearLimitAgentUpdatesTipExperiment(buildCtxByPlatform, { json }) {
|
|
37
|
+
const ctx = Object.values(buildCtxByPlatform)[0];
|
|
38
|
+
if (!ctx?.experimentation || !ctx.authenticationInfo) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
const projectByPlatform = {};
|
|
42
|
+
for (const [platform, platformCtx] of Object.entries(buildCtxByPlatform)) {
|
|
43
|
+
projectByPlatform[platform] = {
|
|
44
|
+
developmentClient: platformCtx.developmentClient,
|
|
45
|
+
projectDir: platformCtx.projectDir,
|
|
46
|
+
projectId: platformCtx.projectId,
|
|
47
|
+
exp: platformCtx.exp,
|
|
48
|
+
manifestHostOverride: platformCtx.easJsonCliConfig?.updateManifestHostOverride ?? null,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
experimentation: ctx.experimentation,
|
|
53
|
+
graphqlClient: (0, createGraphqlClient_1.createGraphqlClient)(ctx.authenticationInfo, {
|
|
54
|
+
requestTimeoutMs: REQUEST_TIMEOUT_MS,
|
|
55
|
+
}),
|
|
56
|
+
analytics: ctx.analytics,
|
|
57
|
+
analyticsEventProperties: ctx.analyticsEventProperties,
|
|
58
|
+
accountId: ctx.accountId,
|
|
59
|
+
isUser: ctx.user.__typename === 'User' || ctx.user.__typename === 'SSOUser',
|
|
60
|
+
runFromCI: ctx.runFromCI,
|
|
61
|
+
json,
|
|
62
|
+
projectByPlatform,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function isProjectConfiguredForEASUpdate({ projectDir, exp, projectId, manifestHostOverride, }) {
|
|
66
|
+
return ((0, projectUtils_1.isExpoUpdatesInstalled)(projectDir) && (0, projectUtils_1.isUsingEASUpdate)(exp, projectId, manifestHostOverride));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Only runs driven by a coding agent logged in as a user, outside CI and without --json are
|
|
70
|
+
* eligible. Everything else gets no tip and no usage request.
|
|
71
|
+
*/
|
|
72
|
+
function isEligibleForFreeTierNearLimitAgentUpdatesTip(experiment) {
|
|
73
|
+
return !(experiment.runFromCI ||
|
|
74
|
+
experiment.json ||
|
|
75
|
+
!experiment.isUser ||
|
|
76
|
+
!(0, agent_1.getAgentTelemetryContext)());
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A platform is eligible when its project is not set up for Expo Update. Development builds load
|
|
80
|
+
* JavaScript from the dev server, so the tip does not apply to them.
|
|
81
|
+
*/
|
|
82
|
+
function isPlatformEligibleForFreeTierNearLimitAgentUpdatesTip(project) {
|
|
83
|
+
return !project.developmentClient && !isProjectConfiguredForEASUpdate(project);
|
|
84
|
+
}
|
|
85
|
+
/** True when the platform still has builds left, but no more than the tip's threshold. */
|
|
86
|
+
function isWithinFreeTierNearLimitBand({ used, limit }) {
|
|
87
|
+
return limit > 0 && used < limit && limit - used <= exports.FREE_TIER_NEAR_LIMIT_AGENT_UPDATES_TIP_BUILDS_LEFT;
|
|
88
|
+
}
|
|
89
|
+
/** Returns the Free plan build usage per platform, or null when the account is not on the Free plan. */
|
|
90
|
+
async function getFreeTierBuildUsageAsync({ graphqlClient, accountId, }) {
|
|
91
|
+
const account = await AccountQuery_1.AccountQuery.getFreeTierBuildUsageAsync(graphqlClient, accountId, new Date());
|
|
92
|
+
if ((account.subscription?.name ?? 'Free') !== 'Free') {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
const buildMetric = account.usageMetrics.EAS_BUILD.planMetrics.find(metric => metric.serviceMetric === generated_1.EasServiceMetric.Builds &&
|
|
96
|
+
metric.metricType === generated_1.UsageMetricType.Build);
|
|
97
|
+
const breakdown = buildMetric?.platformBreakdown;
|
|
98
|
+
if (!breakdown) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
billingPeriodId: account.billingPeriod.id,
|
|
103
|
+
byPlatform: {
|
|
104
|
+
[generated_1.AppPlatform.Android]: { used: breakdown.android.value, limit: breakdown.android.limit },
|
|
105
|
+
[generated_1.AppPlatform.Ios]: { used: breakdown.ios.value, limit: breakdown.ios.limit },
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The first call logs the exposure, so call it only when the tip would show. Accounts outside the
|
|
111
|
+
* rollout get the control default and no exposure.
|
|
112
|
+
*/
|
|
113
|
+
async function resolveFreeTierNearLimitAgentUpdatesTipVariantAsync({ experimentation, accountId, }) {
|
|
114
|
+
const client = await experimentation.getClientAsync();
|
|
115
|
+
return client
|
|
116
|
+
.getAccountNamespace(exports.FREE_TIER_NEAR_LIMIT_AGENT_UPDATES_TIP_EXPERIMENT_NAMESPACE, { accountId })
|
|
117
|
+
.getParam('variant', 'control');
|
|
118
|
+
}
|
|
119
|
+
function formatFreeTierNearLimitAgentUpdatesTip({ platform, used, limit, }) {
|
|
120
|
+
const platformName = platform_1.appPlatformDisplayNames[platform];
|
|
121
|
+
return [
|
|
122
|
+
`Tip: this account has used ${used} of ${limit} ${platformName} builds on the Free plan this period. This project isn't set up for Expo Update, so every change needs a new build.`,
|
|
123
|
+
'With Expo Update, JavaScript, styling and image changes reach installed builds without a new build. Setup takes effect from the next build, so it saves the most builds if done now.',
|
|
124
|
+
'Next: eas update:configure --non-interactive, then build once more.',
|
|
125
|
+
'Tell the user: this adds expo-updates and changes app.json and eas.json.',
|
|
126
|
+
`Docs: ${exports.EAS_UPDATE_GETTING_STARTED_URL}`,
|
|
127
|
+
].join('\n');
|
|
128
|
+
}
|
|
129
|
+
function getFreeTierNearLimitAgentUpdatesTipPreferenceKey(accountId, platform) {
|
|
130
|
+
return `${USER_PREFERENCE_KEY_PREFIX}/${accountId}/${platform.toLowerCase()}`;
|
|
131
|
+
}
|
|
132
|
+
function isShownTipPreference(value) {
|
|
133
|
+
return (typeof value === 'object' &&
|
|
134
|
+
value !== null &&
|
|
135
|
+
typeof value.billingPeriodId === 'string');
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The tip shows at most once per user, account, platform and billing period. The marker is a
|
|
139
|
+
* user preference on the server, so it follows the user across machines and fresh agent
|
|
140
|
+
* sandboxes.
|
|
141
|
+
*/
|
|
142
|
+
async function wasFreeTierNearLimitAgentUpdatesTipShownAsync(graphqlClient, accountId, platform, billingPeriodId) {
|
|
143
|
+
const value = await UserPreferenceQuery_1.UserPreferenceQuery.getValueAsync(graphqlClient, getFreeTierNearLimitAgentUpdatesTipPreferenceKey(accountId, platform));
|
|
144
|
+
return isShownTipPreference(value) && value.billingPeriodId === billingPeriodId;
|
|
145
|
+
}
|
|
146
|
+
async function markFreeTierNearLimitAgentUpdatesTipShownAsync(graphqlClient, accountId, platform, billingPeriodId) {
|
|
147
|
+
const value = { billingPeriodId };
|
|
148
|
+
await UserPreferenceMutation_1.UserPreferenceMutation.setAsync(graphqlClient, getFreeTierNearLimitAgentUpdatesTipPreferenceKey(accountId, platform), value);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* After finished builds, suggests Expo Update to coding agents whose Free plan account is close to
|
|
152
|
+
* the platform build limit. The exposure logs only when every eligibility check passed, so both
|
|
153
|
+
* arms see the same population. The treatment arm prints the tip, logs the tip event, then
|
|
154
|
+
* writes the marker, so a failed write means at most a repeated tip. Fails open on any error.
|
|
155
|
+
*/
|
|
156
|
+
async function maybeSuggestEASUpdateToAgentNearFreeTierLimitAsync(builds, experiment) {
|
|
157
|
+
if (!experiment || !isEligibleForFreeTierNearLimitAgentUpdatesTip(experiment)) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const eligiblePlatforms = new Set(builds
|
|
161
|
+
.filter((build) => build?.status === generated_1.BuildStatus.Finished)
|
|
162
|
+
.map(build => build.platform)
|
|
163
|
+
.filter(platform => {
|
|
164
|
+
const project = experiment.projectByPlatform[platform];
|
|
165
|
+
return project && isPlatformEligibleForFreeTierNearLimitAgentUpdatesTip(project);
|
|
166
|
+
}));
|
|
167
|
+
if (eligiblePlatforms.size === 0) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
const usage = await getFreeTierBuildUsageAsync(experiment);
|
|
172
|
+
if (!usage) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
for (const platform of eligiblePlatforms) {
|
|
176
|
+
const platformUsage = usage.byPlatform[platform];
|
|
177
|
+
if (!isWithinFreeTierNearLimitBand(platformUsage) ||
|
|
178
|
+
(await wasFreeTierNearLimitAgentUpdatesTipShownAsync(experiment.graphqlClient, experiment.accountId, platform, usage.billingPeriodId))) {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
const variant = await resolveFreeTierNearLimitAgentUpdatesTipVariantAsync(experiment);
|
|
182
|
+
if (variant !== 'treatment') {
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
log_1.default.newLine();
|
|
186
|
+
log_1.default.log(formatFreeTierNearLimitAgentUpdatesTip({ platform, ...platformUsage }));
|
|
187
|
+
experiment.analytics.logEvent(AnalyticsManager_1.BuildEvent.FREE_TIER_NEAR_LIMIT_AGENT_UPDATES_TIP, {
|
|
188
|
+
...experiment.analyticsEventProperties,
|
|
189
|
+
platform,
|
|
190
|
+
builds_used: platformUsage.used,
|
|
191
|
+
builds_limit: platformUsage.limit,
|
|
192
|
+
});
|
|
193
|
+
try {
|
|
194
|
+
await markFreeTierNearLimitAgentUpdatesTipShownAsync(experiment.graphqlClient, experiment.accountId, platform, usage.billingPeriodId);
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
// The tip was shown. A missing marker means at most a repeated tip, so keep going.
|
|
198
|
+
log_1.default.debug('Failed to mark the Expo Update tip as shown:', error?.message ?? error);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
log_1.default.debug('Failed to run the Expo Update tip check:', error?.message ?? error);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
@@ -2,6 +2,7 @@ import { ExpoConfig } from '@expo/config';
|
|
|
2
2
|
import { Env } from '@expo/eas-build-job';
|
|
3
3
|
import { ResourceClass } from '@expo/eas-json';
|
|
4
4
|
import { LoggerLevel } from '@expo/logger';
|
|
5
|
+
import { MaybeBuildFragment } from './build';
|
|
5
6
|
import { LocalBuildOptions } from './local';
|
|
6
7
|
import { Analytics } from '../analytics/AnalyticsManager';
|
|
7
8
|
import { DynamicConfigContextFn } from '../commandUtils/context/DynamicProjectConfigContextField';
|
|
@@ -54,5 +55,6 @@ export declare function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsCl
|
|
|
54
55
|
}): Promise<{
|
|
55
56
|
buildIds: string[];
|
|
56
57
|
buildProfiles?: ProfileData<'build'>[];
|
|
58
|
+
builds?: MaybeBuildFragment[];
|
|
57
59
|
}>;
|
|
58
60
|
export declare function downloadAndRunAsync(build: BuildFragment, simulator?: SimulatorRunTarget): Promise<void>;
|
|
@@ -19,6 +19,7 @@ const build_3 = require("./ios/build");
|
|
|
19
19
|
const local_1 = require("./local");
|
|
20
20
|
const validateLockfile_1 = require("./validateLockfile");
|
|
21
21
|
const devClient_1 = require("./utils/devClient");
|
|
22
|
+
const freeTierNearLimitAgentUpdatesTip_1 = require("./freeTierNearLimitAgentUpdatesTip");
|
|
22
23
|
const printBuildInfo_1 = require("./utils/printBuildInfo");
|
|
23
24
|
const repository_1 = require("./utils/repository");
|
|
24
25
|
const queries_1 = require("../channel/queries");
|
|
@@ -201,6 +202,7 @@ async function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsClient, pro
|
|
|
201
202
|
if (!flags.json) {
|
|
202
203
|
(0, printBuildInfo_1.printBuildResults)(builds);
|
|
203
204
|
}
|
|
205
|
+
await (0, freeTierNearLimitAgentUpdatesTip_1.maybeSuggestEASUpdateToAgentNearFreeTierLimitAsync)(builds, (0, freeTierNearLimitAgentUpdatesTip_1.getFreeTierNearLimitAgentUpdatesTipExperiment)(buildCtxByPlatform, { json: flags.json }));
|
|
204
206
|
const haveAllBuildsFailedOrCanceled = builds.every(build => build?.status &&
|
|
205
207
|
[generated_1.BuildStatus.Errored, generated_1.BuildStatus.Canceled, generated_1.BuildStatus.PendingCancel].includes(build?.status));
|
|
206
208
|
await maybeDownloadAndRunSimulatorBuildsAsync(builds, flags, downloadSimBuildAutoConfirm);
|
|
@@ -222,6 +224,7 @@ async function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsClient, pro
|
|
|
222
224
|
return {
|
|
223
225
|
buildIds: startedBuilds.map(({ build }) => build.id),
|
|
224
226
|
buildProfiles,
|
|
227
|
+
builds,
|
|
225
228
|
};
|
|
226
229
|
}
|
|
227
230
|
async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildProfile, easJsonCliConfig, actor, graphqlClient, analytics, vcsClient, exp, projectId, customBuildConfigMetadata, env, easJsonAccessor, experimentation, authenticationInfo, }) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Analytics } from '../analytics/AnalyticsManager';
|
|
2
|
+
import { LoggedInAuthenticationInfo } from '../user/SessionManager';
|
|
3
|
+
import { Actor } from '../user/User';
|
|
4
|
+
export declare function maybeShowSimulatorsLaunchHintAsync(authenticationInfo: LoggedInAuthenticationInfo, analytics: Analytics, { actor, nonInteractive }: {
|
|
5
|
+
actor: Actor;
|
|
6
|
+
nonInteractive: boolean;
|
|
7
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.maybeShowSimulatorsLaunchHintAsync = maybeShowSimulatorsLaunchHintAsync;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const getenv_1 = require("getenv");
|
|
6
|
+
const AnalyticsManager_1 = require("../analytics/AnalyticsManager");
|
|
7
|
+
const createGraphqlClient_1 = require("../commandUtils/context/contextUtils/createGraphqlClient");
|
|
8
|
+
const UserPreferenceMutation_1 = require("../graphql/mutations/UserPreferenceMutation");
|
|
9
|
+
const UserPreferenceQuery_1 = require("../graphql/queries/UserPreferenceQuery");
|
|
10
|
+
const log_1 = tslib_1.__importStar(require("../log"));
|
|
11
|
+
const SIMULATORS_LAUNCH_AT = new Date('2026-11-05T18:00:00Z');
|
|
12
|
+
const SIMULATORS_LAUNCH_HINT_PREFERENCE_KEY = 'simulators-launch-cli-hint-seen';
|
|
13
|
+
const REQUEST_TIMEOUT_MS = 3000;
|
|
14
|
+
const SIMULATORS_QUICKSTART_URL = 'https://docs.expo.dev/preview/simulators/get-started/?utm_source=eas-cli&utm_medium=cli&utm_campaign=simulators-launch';
|
|
15
|
+
async function maybeShowSimulatorsLaunchHintAsync(authenticationInfo, analytics, { actor, nonInteractive }) {
|
|
16
|
+
if (nonInteractive ||
|
|
17
|
+
(0, getenv_1.boolish)('CI', false) ||
|
|
18
|
+
Date.now() < SIMULATORS_LAUNCH_AT.getTime() ||
|
|
19
|
+
(actor.__typename !== 'User' && actor.__typename !== 'SSOUser')) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo, {
|
|
24
|
+
requestTimeoutMs: REQUEST_TIMEOUT_MS,
|
|
25
|
+
});
|
|
26
|
+
const value = await UserPreferenceQuery_1.UserPreferenceQuery.getValueAsync(graphqlClient, SIMULATORS_LAUNCH_HINT_PREFERENCE_KEY);
|
|
27
|
+
if (value && typeof value === 'object' && 'isDismissed' in value && value.isDismissed) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
log_1.default.newLine();
|
|
31
|
+
log_1.default.log(`✨ New: run your build in Expo Simulators, cloud Android and iOS simulators for you and your agents. ${(0, log_1.link)(SIMULATORS_QUICKSTART_URL)}`);
|
|
32
|
+
analytics.logEvent(AnalyticsManager_1.BuildEvent.SIMULATORS_LAUNCH_HINT_SHOWN, {});
|
|
33
|
+
await UserPreferenceMutation_1.UserPreferenceMutation.setAsync(graphqlClient, SIMULATORS_LAUNCH_HINT_PREFERENCE_KEY, {
|
|
34
|
+
isDismissed: true,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
log_1.default.debug('Failed to show the Expo Simulators hint', error);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Platform } from '@expo/eas-build-job';
|
|
2
|
+
import { BuildProfile } from '@expo/eas-json';
|
|
3
|
+
import { JobExpoTokenRole } from '../../graphql/generated';
|
|
4
|
+
export declare function resolveJobExpoTokenRole<T extends Platform>(profile: BuildProfile<T>): JobExpoTokenRole | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveJobExpoTokenRole = resolveJobExpoTokenRole;
|
|
4
|
+
const eas_json_1 = require("@expo/eas-json");
|
|
5
|
+
const generated_1 = require("../../graphql/generated");
|
|
6
|
+
const easJsonJobExpoTokenRoleToJobExpoTokenRoleMapping = {
|
|
7
|
+
[eas_json_1.JobExpoTokenRole.RUNNER]: generated_1.JobExpoTokenRole.Runner,
|
|
8
|
+
[eas_json_1.JobExpoTokenRole.DEVELOPER]: generated_1.JobExpoTokenRole.Developer,
|
|
9
|
+
[eas_json_1.JobExpoTokenRole.RELEASE_MANAGER]: generated_1.JobExpoTokenRole.ReleaseManager,
|
|
10
|
+
};
|
|
11
|
+
function resolveJobExpoTokenRole(profile) {
|
|
12
|
+
const role = profile.permissions?.account.role;
|
|
13
|
+
return role ? easJsonJobExpoTokenRoleToJobExpoTokenRoleMapping[role] : undefined;
|
|
14
|
+
}
|
|
@@ -196,7 +196,7 @@ class EasCommand extends core_1.Command {
|
|
|
196
196
|
let baseMessage = `${commandId} command failed.`;
|
|
197
197
|
if (err instanceof errors_1.EasCommandError) {
|
|
198
198
|
if (!err.messageAlreadyPrinted) {
|
|
199
|
-
log_1.default.
|
|
199
|
+
log_1.default.errorToStderr(err.message);
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
else if (err instanceof core_2.CombinedError && err?.graphQLErrors) {
|
|
@@ -227,11 +227,11 @@ class EasCommand extends core_1.Command {
|
|
|
227
227
|
const cleanMessage = err.networkError
|
|
228
228
|
? `${cleanGQLErrorsMessage}\n${err.networkError.message}`
|
|
229
229
|
: cleanGQLErrorsMessage;
|
|
230
|
-
log_1.default.
|
|
230
|
+
log_1.default.errorToStderr(cleanMessage);
|
|
231
231
|
baseMessage = BASE_GRAPHQL_ERROR_MESSAGE;
|
|
232
232
|
}
|
|
233
233
|
else {
|
|
234
|
-
log_1.default.
|
|
234
|
+
log_1.default.errorToStderr(err.message);
|
|
235
235
|
}
|
|
236
236
|
log_1.default.debug(err);
|
|
237
237
|
sentry_1.default.withScope(scope => {
|
|
@@ -95,7 +95,8 @@ let ranEnsureEasCliIsNotInDependencies = false;
|
|
|
95
95
|
async function findProjectDirAndVerifyProjectSetupAsync({ cwd, } = {}) {
|
|
96
96
|
const projectDir = await findProjectRootAsync({ cwd });
|
|
97
97
|
await applyCliConfigAsync(projectDir);
|
|
98
|
-
|
|
98
|
+
// The notice is advice for a person. Programs that run eas-cli read stderr for its errors.
|
|
99
|
+
if (!ranEnsureEasCliIsNotInDependencies && process.stderr.isTTY) {
|
|
99
100
|
ranEnsureEasCliIsNotInDependencies = true;
|
|
100
101
|
await ensureEasCliIsNotInDependenciesAsync(projectDir);
|
|
101
102
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { WorkflowReferencedFileInput } from '../../graphql/generated';
|
|
2
|
+
export declare function collectReferencedWorkflowFilesAsync({ projectDir, rootFileName, rootYamlConfig, }: {
|
|
3
|
+
projectDir: string;
|
|
4
|
+
rootFileName: string;
|
|
5
|
+
rootYamlConfig: string;
|
|
6
|
+
}): Promise<WorkflowReferencedFileInput[]>;
|