eas-cli 20.4.0 → 20.5.1
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 +114 -114
- package/build/build/context.d.ts +2 -2
- package/build/build/createContext.d.ts +2 -2
- package/build/build/local.d.ts +2 -2
- package/build/build/utils/url.d.ts +1 -0
- package/build/build/utils/url.js +4 -0
- package/build/commands/integrations/posthog/connect.d.ts +3 -0
- package/build/commands/integrations/posthog/connect.js +66 -12
- package/build/commands/simulator/get.js +8 -10
- package/build/commands/simulator/list.js +7 -13
- package/build/commands/simulator/start.js +27 -27
- package/build/commands/simulator/stop.js +5 -5
- package/build/fingerprint/utils.d.ts +2 -2
- package/build/graphql/generated.d.ts +302 -4
- package/build/graphql/generated.js +40 -4
- package/build/graphql/mutations/PostHogMutation.d.ts +2 -2
- package/build/graphql/mutations/PostHogMutation.js +13 -7
- package/build/graphql/queries/AccountQuery.js +5 -0
- package/build/graphql/queries/PostHogQuery.d.ts +3 -1
- package/build/graphql/queries/PostHogQuery.js +5 -2
- package/build/graphql/types/PostHogConnection.d.ts +8 -0
- package/build/project/ios/entitlements.d.ts +2 -1
- package/build/project/ios/target.d.ts +15 -1
- package/build/project/ios/target.js +23 -0
- package/build/submit/context.d.ts +2 -2
- package/build/utils/usage/checkForOverages.d.ts +15 -3
- package/build/utils/usage/checkForOverages.js +80 -21
- package/oclif.manifest.json +144 -144
- package/package.json +6 -6
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
2
|
import { PostHogOrganizationConnectionData, PostHogProjectData } from '../types/PostHogConnection';
|
|
3
3
|
export declare const PostHogQuery: {
|
|
4
|
-
getPostHogOrganizationConnectionByAccountIdAsync(graphqlClient: ExpoGraphqlClient, accountId: string
|
|
4
|
+
getPostHogOrganizationConnectionByAccountIdAsync(graphqlClient: ExpoGraphqlClient, accountId: string, { useCache }?: {
|
|
5
|
+
useCache?: boolean;
|
|
6
|
+
}): Promise<PostHogOrganizationConnectionData | null>;
|
|
5
7
|
getPostHogProjectByAppIdAsync(graphqlClient: ExpoGraphqlClient, appId: string): Promise<PostHogProjectData | null>;
|
|
6
8
|
};
|
|
@@ -7,7 +7,7 @@ const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
|
7
7
|
const client_1 = require("../client");
|
|
8
8
|
const PostHogConnection_1 = require("../types/PostHogConnection");
|
|
9
9
|
exports.PostHogQuery = {
|
|
10
|
-
async getPostHogOrganizationConnectionByAccountIdAsync(graphqlClient, accountId) {
|
|
10
|
+
async getPostHogOrganizationConnectionByAccountIdAsync(graphqlClient, accountId, { useCache = true } = {}) {
|
|
11
11
|
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
12
12
|
.query((0, graphql_tag_1.default) `
|
|
13
13
|
query PostHogOrganizationConnectionByAccountId($accountId: String!) {
|
|
@@ -22,7 +22,10 @@ exports.PostHogQuery = {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
${(0, graphql_1.print)(PostHogConnection_1.PostHogOrganizationConnectionFragmentNode)}
|
|
25
|
-
`, { accountId }, {
|
|
25
|
+
`, { accountId }, {
|
|
26
|
+
additionalTypenames: ['PostHogOrganizationConnection'],
|
|
27
|
+
requestPolicy: useCache ? 'cache-first' : 'network-only',
|
|
28
|
+
})
|
|
26
29
|
.toPromise());
|
|
27
30
|
return data.account.byId.posthogOrganizationConnection ?? null;
|
|
28
31
|
},
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { PostHogOrganizationConnection, PostHogProject } from '../generated';
|
|
2
2
|
export type PostHogOrganizationConnectionData = Pick<PostHogOrganizationConnection, 'id' | 'posthogOrganizationIdentifier' | 'posthogOrganizationName' | 'posthogRegion' | 'createdAt' | 'updatedAt'>;
|
|
3
|
+
export type PostHogPendingConnectionData = {
|
|
4
|
+
url: string;
|
|
5
|
+
};
|
|
6
|
+
export type StartPostHogConnectionResult = ({
|
|
7
|
+
__typename: 'PostHogOrganizationConnection';
|
|
8
|
+
} & PostHogOrganizationConnectionData) | ({
|
|
9
|
+
__typename: 'PostHogPendingConnection';
|
|
10
|
+
} & PostHogPendingConnectionData);
|
|
3
11
|
export type PostHogProjectData = Pick<PostHogProject, 'id' | 'posthogProjectIdentifier' | 'posthogProjectName' | 'posthogProjectToken' | 'posthogHost' | 'createdAt' | 'updatedAt'> & {
|
|
4
12
|
posthogOrganizationConnection: PostHogOrganizationConnectionData;
|
|
5
13
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { Env } from '@expo/eas-build-job';
|
|
1
2
|
import { JSONObject } from '@expo/json-file';
|
|
2
3
|
import { Client } from '../../vcs/vcs';
|
|
3
4
|
interface Target {
|
|
4
5
|
buildConfiguration?: string;
|
|
5
6
|
targetName: string;
|
|
6
7
|
}
|
|
7
|
-
export declare function getManagedApplicationTargetEntitlementsAsync(projectDir: string, env:
|
|
8
|
+
export declare function getManagedApplicationTargetEntitlementsAsync(projectDir: string, env: Env, vcsClient: Client): Promise<JSONObject>;
|
|
8
9
|
export declare function getNativeTargetEntitlementsAsync(projectDir: string, target: Target): Promise<JSONObject | null>;
|
|
9
10
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ExpoConfig } from '@expo/config';
|
|
2
|
+
import { Env } from '@expo/eas-build-job';
|
|
2
3
|
import { XcodeBuildContext } from './scheme';
|
|
3
4
|
import { ApplePlatform } from '../../credentials/ios/appstore/constants';
|
|
4
5
|
import { Target } from '../../credentials/ios/types';
|
|
@@ -6,10 +7,23 @@ import { Client } from '../../vcs/vcs';
|
|
|
6
7
|
interface ResolveTargetOptions {
|
|
7
8
|
projectDir: string;
|
|
8
9
|
exp: ExpoConfig;
|
|
9
|
-
env?:
|
|
10
|
+
env?: Env;
|
|
10
11
|
xcodeBuildContext: XcodeBuildContext;
|
|
11
12
|
vcsClient: Client;
|
|
12
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* For managed projects we don't have an Xcode project to read build settings
|
|
16
|
+
* from, but the @react-native-tvos/config-tv plugin signals a tvOS build via
|
|
17
|
+
* the EXPO_TV environment variable. That variable can come from the build
|
|
18
|
+
* profile's `env` in eas.json (the typical case, which flows in via `env`),
|
|
19
|
+
* or from the shell process when the user runs `EXPO_TV=1 eas build ...`
|
|
20
|
+
* (which is NOT included in the merged `env` upstream, so we read
|
|
21
|
+
* `process.env` directly as a fallback). When set, synthesize
|
|
22
|
+
* TARGETED_DEVICE_FAMILY=3 so getApplePlatformFromTarget (and every
|
|
23
|
+
* Apple-portal flow downstream) picks TV_OS for these targets instead of
|
|
24
|
+
* defaulting to IOS.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getManagedTvBuildSettings(env: Env | undefined): Target['buildSettings'] | undefined;
|
|
13
27
|
export declare function resolveManagedProjectTargetsAsync({ exp, projectDir, xcodeBuildContext, env, vcsClient, }: ResolveTargetOptions): Promise<Target[]>;
|
|
14
28
|
export declare function resolveBareProjectTargetsAsync({ exp, projectDir, xcodeBuildContext, vcsClient, }: ResolveTargetOptions): Promise<Target[]>;
|
|
15
29
|
export declare function resolveTargetsAsync(opts: ResolveTargetOptions): Promise<Target[]>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getManagedTvBuildSettings = getManagedTvBuildSettings;
|
|
3
4
|
exports.resolveManagedProjectTargetsAsync = resolveManagedProjectTargetsAsync;
|
|
4
5
|
exports.resolveBareProjectTargetsAsync = resolveBareProjectTargetsAsync;
|
|
5
6
|
exports.resolveTargetsAsync = resolveTargetsAsync;
|
|
@@ -22,6 +23,25 @@ const AppExtensionsConfigSchema = joi_1.default.array().items(joi_1.default.obje
|
|
|
22
23
|
parentBundleIdentifier: joi_1.default.string(),
|
|
23
24
|
entitlements: joi_1.default.object(),
|
|
24
25
|
}));
|
|
26
|
+
/**
|
|
27
|
+
* For managed projects we don't have an Xcode project to read build settings
|
|
28
|
+
* from, but the @react-native-tvos/config-tv plugin signals a tvOS build via
|
|
29
|
+
* the EXPO_TV environment variable. That variable can come from the build
|
|
30
|
+
* profile's `env` in eas.json (the typical case, which flows in via `env`),
|
|
31
|
+
* or from the shell process when the user runs `EXPO_TV=1 eas build ...`
|
|
32
|
+
* (which is NOT included in the merged `env` upstream, so we read
|
|
33
|
+
* `process.env` directly as a fallback). When set, synthesize
|
|
34
|
+
* TARGETED_DEVICE_FAMILY=3 so getApplePlatformFromTarget (and every
|
|
35
|
+
* Apple-portal flow downstream) picks TV_OS for these targets instead of
|
|
36
|
+
* defaulting to IOS.
|
|
37
|
+
*/
|
|
38
|
+
function getManagedTvBuildSettings(env) {
|
|
39
|
+
const expoTv = (env?.EXPO_TV ?? process.env.EXPO_TV ?? '').toString().toLowerCase();
|
|
40
|
+
if (expoTv === '1' || expoTv === 'true' || expoTv === 'yes') {
|
|
41
|
+
return { TARGETED_DEVICE_FAMILY: '3' };
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
25
45
|
async function resolveManagedProjectTargetsAsync({ exp, projectDir, xcodeBuildContext, env, vcsClient, }) {
|
|
26
46
|
const { buildScheme, buildConfiguration } = xcodeBuildContext;
|
|
27
47
|
const applicationTargetName = buildScheme;
|
|
@@ -38,12 +58,14 @@ async function resolveManagedProjectTargetsAsync({ exp, projectDir, xcodeBuildCo
|
|
|
38
58
|
if (error) {
|
|
39
59
|
throw new Error(`Failed to validate "extra.eas.build.experimental.ios.appExtensions" in you app config.\n${error.message}`);
|
|
40
60
|
}
|
|
61
|
+
const managedBuildSettings = getManagedTvBuildSettings(env);
|
|
41
62
|
const extensionsTargets = appExtensions.map(extension => ({
|
|
42
63
|
targetName: extension.targetName,
|
|
43
64
|
buildConfiguration,
|
|
44
65
|
bundleIdentifier: extension.bundleIdentifier,
|
|
45
66
|
parentBundleIdentifier: extension.parentBundleIdentifier ?? applicationTargetBundleIdentifier,
|
|
46
67
|
entitlements: extension.entitlements ?? {},
|
|
68
|
+
...(managedBuildSettings && { buildSettings: managedBuildSettings }),
|
|
47
69
|
}));
|
|
48
70
|
return [
|
|
49
71
|
{
|
|
@@ -51,6 +73,7 @@ async function resolveManagedProjectTargetsAsync({ exp, projectDir, xcodeBuildCo
|
|
|
51
73
|
bundleIdentifier: applicationTargetBundleIdentifier,
|
|
52
74
|
buildConfiguration,
|
|
53
75
|
entitlements: applicationTargetEntitlements,
|
|
76
|
+
...(managedBuildSettings && { buildSettings: managedBuildSettings }),
|
|
54
77
|
},
|
|
55
78
|
...extensionsTargets,
|
|
56
79
|
];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExpoConfig } from '@expo/config';
|
|
2
|
-
import { Platform } from '@expo/eas-build-job';
|
|
2
|
+
import { Env, Platform } from '@expo/eas-build-job';
|
|
3
3
|
import { SubmitProfile } from '@expo/eas-json';
|
|
4
4
|
import { Analytics, AnalyticsEventProperties } from '../analytics/AnalyticsManager';
|
|
5
5
|
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
@@ -37,7 +37,7 @@ export interface SubmitArchiveFlags {
|
|
|
37
37
|
export declare function createSubmissionContextAsync<T extends Platform>(params: {
|
|
38
38
|
archiveFlags: SubmitArchiveFlags;
|
|
39
39
|
credentialsCtx?: CredentialsContext;
|
|
40
|
-
env?:
|
|
40
|
+
env?: Env;
|
|
41
41
|
nonInteractive: boolean;
|
|
42
42
|
isVerboseFastlaneEnabled: boolean;
|
|
43
43
|
groups: string[] | undefined;
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
|
+
export type UsageTier = 'approaching' | 'at' | 'over';
|
|
2
3
|
export declare function maybeWarnAboutUsageOveragesAsync({ graphqlClient, accountId, }: {
|
|
3
4
|
graphqlClient: ExpoGraphqlClient;
|
|
4
5
|
accountId: string;
|
|
5
6
|
}): Promise<void>;
|
|
7
|
+
export declare function classifyUsageTier({ planValue, limit, overageCount, overageCostCents, hasFreePlan, }: {
|
|
8
|
+
planValue: number;
|
|
9
|
+
limit: number;
|
|
10
|
+
overageCount: number;
|
|
11
|
+
overageCostCents: number;
|
|
12
|
+
hasFreePlan: boolean;
|
|
13
|
+
}): UsageTier | null;
|
|
6
14
|
export declare function calculatePercentUsed(value: number, limit: number): number;
|
|
7
15
|
export declare function createProgressBar(percentUsed: number, width?: number): string;
|
|
8
|
-
export declare function displayOverageWarning({
|
|
9
|
-
|
|
10
|
-
hasFreePlan: boolean;
|
|
16
|
+
export declare function displayOverageWarning({ tier, name, hasFreePlan, planValue, limit, overageCount, overageCostCents, }: {
|
|
17
|
+
tier: UsageTier;
|
|
11
18
|
name: string;
|
|
19
|
+
hasFreePlan: boolean;
|
|
20
|
+
planValue: number;
|
|
21
|
+
limit: number;
|
|
22
|
+
overageCount: number;
|
|
23
|
+
overageCostCents: number;
|
|
12
24
|
}): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.maybeWarnAboutUsageOveragesAsync = maybeWarnAboutUsageOveragesAsync;
|
|
4
|
+
exports.classifyUsageTier = classifyUsageTier;
|
|
4
5
|
exports.calculatePercentUsed = calculatePercentUsed;
|
|
5
6
|
exports.createProgressBar = createProgressBar;
|
|
6
7
|
exports.displayOverageWarning = displayOverageWarning;
|
|
@@ -8,26 +9,67 @@ const tslib_1 = require("tslib");
|
|
|
8
9
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
9
10
|
const AccountQuery_1 = require("../../graphql/queries/AccountQuery");
|
|
10
11
|
const log_1 = tslib_1.__importStar(require("../../log"));
|
|
11
|
-
const
|
|
12
|
+
const APPROACHING_THRESHOLD_PERCENT = 80;
|
|
12
13
|
async function maybeWarnAboutUsageOveragesAsync({ graphqlClient, accountId, }) {
|
|
13
14
|
try {
|
|
14
15
|
const currentDate = new Date();
|
|
15
|
-
const
|
|
16
|
-
|
|
16
|
+
const account = await AccountQuery_1.AccountQuery.getUsageForOverageWarningAsync(graphqlClient, accountId, currentDate);
|
|
17
|
+
if (!account) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const { name, subscription, usageMetrics } = account;
|
|
21
|
+
const buildMetrics = usageMetrics.EAS_BUILD;
|
|
22
|
+
const planMetric = buildMetrics?.planMetrics?.[0];
|
|
17
23
|
if (!planMetric || !subscription) {
|
|
18
24
|
return;
|
|
19
25
|
}
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
const overageCount = buildMetrics.overageMetrics.reduce((sum, o) => sum + o.value, 0);
|
|
27
|
+
const overageCostCents = buildMetrics.totalCost;
|
|
28
|
+
const hasFreePlan = subscription.name === 'Free';
|
|
29
|
+
const tier = classifyUsageTier({
|
|
30
|
+
planValue: planMetric.value,
|
|
31
|
+
limit: planMetric.limit,
|
|
32
|
+
overageCount,
|
|
33
|
+
overageCostCents,
|
|
34
|
+
hasFreePlan,
|
|
35
|
+
});
|
|
36
|
+
if (!tier) {
|
|
37
|
+
return;
|
|
24
38
|
}
|
|
39
|
+
displayOverageWarning({
|
|
40
|
+
tier,
|
|
41
|
+
name,
|
|
42
|
+
hasFreePlan,
|
|
43
|
+
planValue: planMetric.value,
|
|
44
|
+
limit: planMetric.limit,
|
|
45
|
+
overageCount,
|
|
46
|
+
overageCostCents,
|
|
47
|
+
});
|
|
25
48
|
}
|
|
26
49
|
catch (error) {
|
|
27
50
|
// Silently fail if we can't fetch usage data - we don't want to block the user's workflow
|
|
28
51
|
log_1.default.debug(`Failed to fetch usage data: ${error}`);
|
|
29
52
|
}
|
|
30
53
|
}
|
|
54
|
+
function classifyUsageTier({ planValue, limit, overageCount, overageCostCents, hasFreePlan, }) {
|
|
55
|
+
// Only paid plans can incur pay-as-you-go overages, and only when there is an
|
|
56
|
+
// actual billable cost. Free plans are blocked at the limit and are never charged,
|
|
57
|
+
// so they can never be in an "over" state — a nonzero overage row (e.g. a usage
|
|
58
|
+
// rollup returned by the API) must not be treated as billable usage. Without this
|
|
59
|
+
// guard, free users well below their limit were shown a "you've reached your limit,
|
|
60
|
+
// upgrade to keep building" warning.
|
|
61
|
+
if (!hasFreePlan && overageCount > 0 && overageCostCents > 0) {
|
|
62
|
+
return 'over';
|
|
63
|
+
}
|
|
64
|
+
if (limit > 0 && planValue >= limit) {
|
|
65
|
+
return 'at';
|
|
66
|
+
}
|
|
67
|
+
const percentUsed = calculatePercentUsed(planValue, limit);
|
|
68
|
+
if (percentUsed >= APPROACHING_THRESHOLD_PERCENT) {
|
|
69
|
+
return 'approaching';
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
31
73
|
function calculatePercentUsed(value, limit) {
|
|
32
74
|
if (limit === 0) {
|
|
33
75
|
return 0;
|
|
@@ -41,19 +83,36 @@ function createProgressBar(percentUsed, width = 30) {
|
|
|
41
83
|
const empty = '░'.repeat(emptyWidth);
|
|
42
84
|
return `${filled}${empty}`;
|
|
43
85
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
log_1.default.warn(message + progressBar);
|
|
86
|
+
function formatCents(cents) {
|
|
87
|
+
return `$${(cents / 100).toFixed(2)}`;
|
|
88
|
+
}
|
|
89
|
+
function displayOverageWarning({ tier, name, hasFreePlan, planValue, limit, overageCount, overageCostCents, }) {
|
|
49
90
|
const billingUrl = `https://expo.dev/accounts/${name}/settings/billing`;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
91
|
+
if (tier === 'approaching') {
|
|
92
|
+
const percentUsed = calculatePercentUsed(planValue, limit);
|
|
93
|
+
log_1.default.warn(chalk_1.default.bold(`You've used ${percentUsed}% of your included build credits this billing period.`) +
|
|
94
|
+
' ' +
|
|
95
|
+
createProgressBar(percentUsed));
|
|
96
|
+
log_1.default.warn(hasFreePlan
|
|
97
|
+
? "You won't be able to start new builds once you reach the limit. " +
|
|
98
|
+
(0, log_1.link)(billingUrl, { text: 'Upgrade your plan to continue service.', dim: false })
|
|
99
|
+
: 'Additional usage beyond your limit will be charged at pay-as-you-go rates. ' +
|
|
100
|
+
(0, log_1.link)(billingUrl, { text: 'See usage in billing.', dim: false }));
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
// Free users are blocked at the limit, so they can't reach an "over" state.
|
|
104
|
+
// If we ever see Free + over (data inconsistency, mid-flight plan change), treat it as "at".
|
|
105
|
+
if (tier === 'at' || (tier === 'over' && hasFreePlan)) {
|
|
106
|
+
log_1.default.warn(chalk_1.default.bold("You've reached your included build credits this billing period."));
|
|
107
|
+
log_1.default.warn(hasFreePlan
|
|
108
|
+
? 'New builds are blocked until your billing period resets. ' +
|
|
109
|
+
(0, log_1.link)(billingUrl, { text: 'Upgrade your plan to continue building.', dim: false })
|
|
110
|
+
: 'Additional builds will be charged at pay-as-you-go rates. ' +
|
|
111
|
+
(0, log_1.link)(billingUrl, { text: 'See usage in billing.', dim: false }));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
// tier === 'over' && paid plan
|
|
115
|
+
log_1.default.warn(chalk_1.default.bold(`You've used ${overageCount} build${overageCount === 1 ? '' : 's'} beyond your included credits this billing period (${formatCents(overageCostCents)} in overages so far).`));
|
|
116
|
+
log_1.default.warn('Additional builds continue at pay-as-you-go rates. ' +
|
|
117
|
+
(0, log_1.link)(billingUrl, { text: 'See usage in billing.', dim: false }));
|
|
59
118
|
}
|