eas-cli 25.3.0 → 27.1.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.
Files changed (81) hide show
  1. package/README.md +268 -198
  2. package/build/build/build.js +6 -0
  3. package/build/build/createContext.d.ts +4 -3
  4. package/build/build/createContext.js +1 -4
  5. package/build/build/errors.d.ts +2 -0
  6. package/build/build/errors.js +4 -1
  7. package/build/build/evaluateConfigWithEnvVarsAsync.js +1 -3
  8. package/build/build/runBuildAndSubmit.d.ts +7 -2
  9. package/build/build/runBuildAndSubmit.js +9 -8
  10. package/build/build/utils/expoTokenRole.d.ts +4 -0
  11. package/build/build/utils/expoTokenRole.js +14 -0
  12. package/build/commandUtils/EasCommand.js +3 -3
  13. package/build/commandUtils/context/DynamicProjectConfigContextField.d.ts +2 -2
  14. package/build/commandUtils/context/DynamicProjectConfigContextField.js +40 -61
  15. package/build/commandUtils/context/LoggedInContextField.js +1 -2
  16. package/build/commandUtils/context/MaybeLoggedInContextField.js +1 -2
  17. package/build/commandUtils/context/OptionalPrivateProjectConfigContextField.js +3 -1
  18. package/build/commandUtils/context/PrivateProjectConfigContextField.js +3 -1
  19. package/build/commandUtils/context/contextUtils/findProjectDirAndVerifyProjectSetupAsync.js +2 -1
  20. package/build/commandUtils/context/contextUtils/getProjectIdAsync.d.ts +1 -0
  21. package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +5 -2
  22. package/build/commandUtils/workflow/referencedFiles.d.ts +6 -0
  23. package/build/commandUtils/workflow/referencedFiles.js +63 -0
  24. package/build/commandUtils/workflow/types.d.ts +1 -1
  25. package/build/commandUtils/workflow/utils.js +34 -5
  26. package/build/commands/account/login.js +6 -0
  27. package/build/commands/account/view.d.ts +0 -7
  28. package/build/commands/account/view.js +4 -74
  29. package/build/commands/browse.js +1 -1
  30. package/build/commands/build/dev.js +3 -3
  31. package/build/commands/channel/delete.js +1 -1
  32. package/build/commands/channel/rollout.js +1 -1
  33. package/build/commands/credentials/configure-build.js +1 -1
  34. package/build/commands/deploy/alias/delete.js +1 -1
  35. package/build/commands/deploy/alias/index.js +1 -1
  36. package/build/commands/deploy/delete.js +1 -1
  37. package/build/commands/go.js +1 -1
  38. package/build/commands/observe/event.js +1 -1
  39. package/build/commands/observe/events.js +1 -1
  40. package/build/commands/project/new.js +1 -1
  41. package/build/commands/simulator/control.js +42 -7
  42. package/build/commands/simulator/get.js +14 -1
  43. package/build/commands/simulator/index.js +12 -4
  44. package/build/commands/simulator/logs.d.ts +22 -0
  45. package/build/commands/simulator/logs.js +188 -0
  46. package/build/commands/workflow/cancel.js +9 -20
  47. package/build/commands/workflow/list.js +1 -1
  48. package/build/commands/workflow/logs.js +1 -1
  49. package/build/commands/workflow/run.js +10 -1
  50. package/build/commands/workflow/runs.js +1 -1
  51. package/build/commands/workflow/status.js +1 -1
  52. package/build/commands/workflow/view.js +1 -1
  53. package/build/graphql/generated.d.ts +438 -115
  54. package/build/graphql/generated.js +40 -9
  55. package/build/graphql/mutations/WorkflowRevisionMutation.d.ts +3 -2
  56. package/build/graphql/mutations/WorkflowRevisionMutation.js +12 -3
  57. package/build/graphql/queries/DeviceRunSessionQuery.d.ts +8 -1
  58. package/build/graphql/queries/DeviceRunSessionQuery.js +67 -0
  59. package/build/graphql/queries/WorkflowRunQuery.js +6 -0
  60. package/build/graphql/types/WorkflowRun.js +1 -0
  61. package/build/help.js +13 -6
  62. package/build/log.d.ts +2 -0
  63. package/build/log.js +10 -0
  64. package/build/project/projectStatus.js +1 -0
  65. package/build/simulator/artifacts.d.ts +9 -0
  66. package/build/simulator/artifacts.js +97 -0
  67. package/build/simulator/download.d.ts +2 -0
  68. package/build/simulator/download.js +57 -0
  69. package/build/simulator/events.js +2 -10
  70. package/build/simulator/jobRunErrors.d.ts +22 -0
  71. package/build/simulator/jobRunErrors.js +134 -0
  72. package/build/simulator/preview.d.ts +26 -0
  73. package/build/simulator/preview.js +156 -0
  74. package/build/simulator/utils.d.ts +5 -0
  75. package/build/simulator/utils.js +42 -0
  76. package/build/user/SessionManager.d.ts +10 -0
  77. package/build/user/SessionManager.js +12 -0
  78. package/build/user/accountPermissions.d.ts +11 -0
  79. package/build/user/accountPermissions.js +89 -0
  80. package/oclif.manifest.json +169 -21
  81. package/package.json +7 -7
@@ -17,6 +17,7 @@ const graphql_1 = require("./graphql");
17
17
  const local_1 = require("./local");
18
18
  const logs_1 = require("./logs");
19
19
  const metadata_1 = require("./metadata");
20
+ const expoTokenRole_1 = require("./utils/expoTokenRole");
20
21
  const printBuildInfo_1 = require("./utils/printBuildInfo");
21
22
  const repository_1 = require("./utils/repository");
22
23
  const url_1 = require("./utils/url");
@@ -44,6 +45,7 @@ function resolveBuildParamsInput(ctx, metadata) {
44
45
  resourceClass: ctx.resourceClass,
45
46
  sdkVersion: metadata.sdkVersion,
46
47
  reactNativeVersion: metadata.reactNativeVersion,
48
+ expoTokenRole: (0, expoTokenRole_1.resolveJobExpoTokenRole)(ctx.buildProfile),
47
49
  };
48
50
  }
49
51
  async function prepareBuildRequestForPlatformAsync(builder) {
@@ -166,6 +168,10 @@ async function handleBuildRequestErrorAsync(error, platform, accountName, freeTi
166
168
  else if (graphQLErrorCode === 'EAS_BUILD_TOO_MANY_PENDING_BUILDS') {
167
169
  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
170
  }
171
+ else if (graphQLErrorCode === 'UNAUTHORIZED') {
172
+ const requestId = graphQLErrors[0]?.extensions?.requestId;
173
+ 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.`);
174
+ }
169
175
  else if (Array.isArray(error?.graphQLErrors)) {
170
176
  const errorDetails = formatBuildRequestErrorDetails(error, graphQLErrors);
171
177
  throw new Error(`Build request failed. Make sure you are using the latest eas-cli version. If the problem persists, report the issue.${errorDetails}`);
@@ -1,17 +1,17 @@
1
+ import { ExpoConfig } from '@expo/config';
1
2
  import { Env, Platform } from '@expo/eas-build-job';
2
3
  import { BuildProfile, EasJson, ResourceClass } from '@expo/eas-json';
3
4
  import { LoggerLevel } from '@expo/logger';
4
5
  import { BuildContext } from './context';
5
6
  import { LocalBuildOptions } from './local';
6
7
  import { Analytics } from '../analytics/AnalyticsManager';
7
- import { DynamicConfigContextFn } from '../commandUtils/context/DynamicProjectConfigContextField';
8
8
  import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
9
9
  import { LazyExperimentationClient } from '../experimentation/LazyExperimentationClient';
10
10
  import { CustomBuildConfigMetadata } from '../project/customBuildConfig';
11
11
  import { LoggedInAuthenticationInfo } from '../user/SessionManager';
12
12
  import { Actor } from '../user/User';
13
13
  import { Client } from '../vcs/vcs';
14
- 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, authenticationInfo, }: {
14
+ export declare function createBuildContextAsync<T extends Platform>({ buildProfileName, buildProfile, easJsonCliConfig, clearCache, localBuildOptions, nonInteractive, noWait, platform, projectDir, resourceClassFlag, message, actor, graphqlClient, analytics, vcsClient, exp, projectId, customBuildConfigMetadata, buildLoggerLevel, freezeCredentials, refreshAdHocProvisioningProfile: refreshAdHocProvisioningProfileFlag, isVerboseLoggingEnabled, whatToTest, env, experimentation, authenticationInfo, }: {
15
15
  buildProfileName: string;
16
16
  buildProfile: BuildProfile<T>;
17
17
  easJsonCliConfig: EasJson['cli'];
@@ -27,7 +27,8 @@ export declare function createBuildContextAsync<T extends Platform>({ buildProfi
27
27
  graphqlClient: ExpoGraphqlClient;
28
28
  analytics: Analytics;
29
29
  vcsClient: Client;
30
- getDynamicPrivateProjectConfigAsync: DynamicConfigContextFn;
30
+ exp: ExpoConfig;
31
+ projectId: string;
31
32
  customBuildConfigMetadata?: CustomBuildConfigMetadata;
32
33
  buildLoggerLevel?: LoggerLevel;
33
34
  freezeCredentials: boolean;
@@ -16,10 +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, experimentation, authenticationInfo, }) {
20
- const { exp, projectId } = await getDynamicPrivateProjectConfigAsync({
21
- env,
22
- });
19
+ async function createBuildContextAsync({ buildProfileName, buildProfile, easJsonCliConfig, clearCache = false, localBuildOptions, nonInteractive, noWait, platform, projectDir, resourceClassFlag, message, actor, graphqlClient, analytics, vcsClient, exp, projectId, customBuildConfigMetadata, buildLoggerLevel, freezeCredentials, refreshAdHocProvisioningProfile: refreshAdHocProvisioningProfileFlag, isVerboseLoggingEnabled, whatToTest, env, experimentation, authenticationInfo, }) {
23
20
  const projectName = exp.slug;
24
21
  const [account, workflow] = await Promise.all([
25
22
  (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, projectId),
@@ -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
  }
@@ -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
- log_1.default.error(e);
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) {
@@ -1,3 +1,4 @@
1
+ import { ExpoConfig } from '@expo/config';
1
2
  import { Env } from '@expo/eas-build-job';
2
3
  import { ResourceClass } from '@expo/eas-json';
3
4
  import { LoggerLevel } from '@expo/logger';
@@ -32,7 +33,7 @@ export interface BuildFlags {
32
33
  whatToTest?: string;
33
34
  simulator?: SimulatorRunTarget;
34
35
  }
35
- export declare function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsClient, projectDir, flags, actor, getDynamicPrivateProjectConfigAsync, downloadSimBuildAutoConfirm, envOverride, experimentation, authenticationInfo, }: {
36
+ export declare function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsClient, projectDir, flags, actor, getDynamicPrivateProjectConfigAsync, downloadSimBuildAutoConfirm, evaluatedConfig, experimentation, authenticationInfo, }: {
36
37
  graphqlClient: ExpoGraphqlClient;
37
38
  analytics: Analytics;
38
39
  vcsClient: Client;
@@ -41,7 +42,11 @@ export declare function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsCl
41
42
  actor: Actor;
42
43
  getDynamicPrivateProjectConfigAsync: DynamicConfigContextFn;
43
44
  downloadSimBuildAutoConfirm?: boolean;
44
- envOverride?: Env;
45
+ evaluatedConfig?: {
46
+ env: Env;
47
+ exp: ExpoConfig;
48
+ projectId: string;
49
+ };
45
50
  /** Enables the Free plan limit experiments on the build request error path. */
46
51
  experimentation?: LazyExperimentationClient;
47
52
  /** Lets the Free plan limit checkout experiment create a checkout session. */
@@ -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, experimentation, authenticationInfo, }) {
52
+ async function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsClient, projectDir, flags, actor, getDynamicPrivateProjectConfigAsync, downloadSimBuildAutoConfirm, evaluatedConfig, experimentation, authenticationInfo, }) {
53
53
  await vcsClient.ensureRepoExistsAsync();
54
54
  await (0, repository_1.ensureRepoIsCleanAsync)(vcsClient, flags.nonInteractive);
55
55
  await (0, configure_1.ensureProjectConfiguredAsync)({
@@ -106,15 +106,14 @@ async function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsClient, pro
106
106
  const buildCtxByPlatform = {};
107
107
  for (const buildProfile of buildProfiles) {
108
108
  const platform = (0, AppPlatform_1.toAppPlatform)(buildProfile.platform);
109
- const { env } = !envOverride
110
- ? await (0, evaluateConfigWithEnvVarsAsync_1.evaluateConfigWithEnvVarsAsync)({
109
+ const { env, exp, projectId } = evaluatedConfig ??
110
+ (await (0, evaluateConfigWithEnvVarsAsync_1.evaluateConfigWithEnvVarsAsync)({
111
111
  buildProfile: buildProfile.profile,
112
112
  buildProfileName: buildProfile.profileName,
113
113
  graphqlClient,
114
114
  getProjectConfig: getDynamicPrivateProjectConfigAsync,
115
115
  opts: { env: buildProfile.profile.env },
116
- })
117
- : { env: envOverride };
116
+ }));
118
117
  const { build: maybeBuild, buildCtx } = await prepareAndStartBuildAsync({
119
118
  projectDir,
120
119
  flags,
@@ -125,7 +124,8 @@ async function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsClient, pro
125
124
  graphqlClient,
126
125
  analytics,
127
126
  vcsClient,
128
- getDynamicPrivateProjectConfigAsync,
127
+ exp,
128
+ projectId,
129
129
  customBuildConfigMetadata: customBuildConfigMetadataByPlatform[platform],
130
130
  env,
131
131
  easJsonAccessor,
@@ -224,7 +224,7 @@ async function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsClient, pro
224
224
  buildProfiles,
225
225
  };
226
226
  }
227
- async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildProfile, easJsonCliConfig, actor, graphqlClient, analytics, vcsClient, getDynamicPrivateProjectConfigAsync, customBuildConfigMetadata, env, easJsonAccessor, experimentation, authenticationInfo, }) {
227
+ async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildProfile, easJsonCliConfig, actor, graphqlClient, analytics, vcsClient, exp, projectId, customBuildConfigMetadata, env, easJsonAccessor, experimentation, authenticationInfo, }) {
228
228
  const buildCtx = await (0, createContext_1.createBuildContextAsync)({
229
229
  buildProfileName: buildProfile.profileName,
230
230
  resourceClassFlag: flags.resourceClass,
@@ -241,7 +241,8 @@ async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildP
241
241
  graphqlClient,
242
242
  analytics,
243
243
  vcsClient,
244
- getDynamicPrivateProjectConfigAsync,
244
+ exp,
245
+ projectId,
245
246
  customBuildConfigMetadata,
246
247
  buildLoggerLevel: flags.buildLoggerLevel ?? (log_1.default.isDebug ? logger_1.LoggerLevel.DEBUG : undefined),
247
248
  freezeCredentials: flags.freezeCredentials,
@@ -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.error(err.message);
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.error(cleanMessage);
230
+ log_1.default.errorToStderr(cleanMessage);
231
231
  baseMessage = BASE_GRAPHQL_ERROR_MESSAGE;
232
232
  }
233
233
  else {
234
- log_1.default.error(err.message);
234
+ log_1.default.errorToStderr(err.message);
235
235
  }
236
236
  log_1.default.debug(err);
237
237
  sentry_1.default.withScope(scope => {
@@ -7,8 +7,8 @@ export type DynamicConfigContextFn = (options?: ExpoConfigOptions) => Promise<{
7
7
  projectDir: string;
8
8
  }>;
9
9
  export declare class DynamicPublicProjectConfigContextField extends ContextField<DynamicConfigContextFn> {
10
- getValueAsync({ nonInteractive, sessionManager, withServerSideEnvironment, }: ContextOptions): Promise<DynamicConfigContextFn>;
10
+ getValueAsync(options: ContextOptions): Promise<DynamicConfigContextFn>;
11
11
  }
12
12
  export declare class DynamicPrivateProjectConfigContextField extends ContextField<DynamicConfigContextFn> {
13
- getValueAsync({ nonInteractive, sessionManager, withServerSideEnvironment, }: ContextOptions): Promise<DynamicConfigContextFn>;
13
+ getValueAsync(options: ContextOptions): Promise<DynamicConfigContextFn>;
14
14
  }
@@ -9,76 +9,55 @@ const getProjectIdAsync_1 = require("./contextUtils/getProjectIdAsync");
9
9
  const loadServerSideEnvironmentVariablesAsync_1 = require("./contextUtils/loadServerSideEnvironmentVariablesAsync");
10
10
  const expoConfig_1 = require("../../project/expoConfig");
11
11
  class DynamicPublicProjectConfigContextField extends ContextField_1.default {
12
- async getValueAsync({ nonInteractive, sessionManager, withServerSideEnvironment, }) {
13
- const projectDir = await (0, findProjectDirAndVerifyProjectSetupAsync_1.findProjectDirAndVerifyProjectSetupAsync)();
14
- return async (options) => {
15
- const expBefore = await (0, expoConfig_1.getPublicExpoConfigAsync)(projectDir, options);
16
- const projectId = await (0, getProjectIdAsync_1.getProjectIdAsync)(sessionManager, expBefore, {
17
- nonInteractive,
18
- env: options?.env,
19
- });
20
- if (withServerSideEnvironment) {
21
- const { authenticationInfo } = await sessionManager.ensureLoggedInAsync({
22
- nonInteractive,
23
- });
24
- const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo);
25
- const serverSideEnvironmentVariables = await (0, loadServerSideEnvironmentVariablesAsync_1.loadServerSideEnvironmentVariablesAsync)({
26
- environment: withServerSideEnvironment,
27
- projectId,
28
- graphqlClient,
29
- });
30
- options = {
31
- ...options,
32
- env: {
33
- ...options?.env,
34
- ...serverSideEnvironmentVariables,
35
- },
36
- };
37
- }
38
- const exp = await (0, expoConfig_1.getPublicExpoConfigAsync)(projectDir, options);
39
- return {
40
- exp,
41
- projectDir,
42
- projectId,
43
- };
44
- };
12
+ async getValueAsync(options) {
13
+ return await createDynamicConfigFnAsync(expoConfig_1.getPublicExpoConfigAsync, options);
45
14
  }
46
15
  }
47
16
  exports.DynamicPublicProjectConfigContextField = DynamicPublicProjectConfigContextField;
48
17
  class DynamicPrivateProjectConfigContextField extends ContextField_1.default {
49
- async getValueAsync({ nonInteractive, sessionManager, withServerSideEnvironment, }) {
50
- const projectDir = await (0, findProjectDirAndVerifyProjectSetupAsync_1.findProjectDirAndVerifyProjectSetupAsync)();
51
- return async (options) => {
52
- const expBefore = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir, options);
53
- const projectId = await (0, getProjectIdAsync_1.getProjectIdAsync)(sessionManager, expBefore, {
18
+ async getValueAsync(options) {
19
+ return await createDynamicConfigFnAsync(expoConfig_1.getPrivateExpoConfigAsync, options);
20
+ }
21
+ }
22
+ exports.DynamicPrivateProjectConfigContextField = DynamicPrivateProjectConfigContextField;
23
+ async function createDynamicConfigFnAsync(getExpoConfigAsync, { nonInteractive, sessionManager, withServerSideEnvironment }) {
24
+ const projectDir = await (0, findProjectDirAndVerifyProjectSetupAsync_1.findProjectDirAndVerifyProjectSetupAsync)();
25
+ return async (options) => {
26
+ const expBefore = await getExpoConfigAsync(projectDir, options);
27
+ const projectId = await (0, getProjectIdAsync_1.getProjectIdAsync)(sessionManager, expBefore, {
28
+ nonInteractive,
29
+ env: options?.env,
30
+ });
31
+ if (withServerSideEnvironment) {
32
+ const { authenticationInfo } = await sessionManager.ensureLoggedInAsync({
54
33
  nonInteractive,
55
- env: options?.env,
56
34
  });
57
- if (withServerSideEnvironment) {
58
- const { authenticationInfo } = await sessionManager.ensureLoggedInAsync({
59
- nonInteractive,
60
- });
61
- const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo);
62
- const serverSideEnvironmentVariables = await (0, loadServerSideEnvironmentVariablesAsync_1.loadServerSideEnvironmentVariablesAsync)({
63
- environment: withServerSideEnvironment,
64
- projectId,
65
- graphqlClient,
66
- });
67
- options = {
68
- ...options,
69
- env: {
70
- ...options?.env,
71
- ...serverSideEnvironmentVariables,
72
- },
73
- };
74
- }
75
- const exp = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir, options);
35
+ const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo);
36
+ const serverSideEnvironmentVariables = await (0, loadServerSideEnvironmentVariablesAsync_1.loadServerSideEnvironmentVariablesAsync)({
37
+ environment: withServerSideEnvironment,
38
+ projectId,
39
+ graphqlClient,
40
+ });
41
+ options = {
42
+ ...options,
43
+ env: {
44
+ ...options?.env,
45
+ ...serverSideEnvironmentVariables,
46
+ },
47
+ };
48
+ }
49
+ else if ((0, getProjectIdAsync_1.isProjectIdInAppConfig)(expBefore, projectId)) {
76
50
  return {
77
- exp,
51
+ exp: expBefore,
78
52
  projectDir,
79
53
  projectId,
80
54
  };
55
+ }
56
+ const exp = await getExpoConfigAsync(projectDir, options);
57
+ return {
58
+ exp,
59
+ projectDir,
60
+ projectId,
81
61
  };
82
- }
62
+ };
83
63
  }
84
- exports.DynamicPrivateProjectConfigContextField = DynamicPrivateProjectConfigContextField;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const ContextField_1 = tslib_1.__importDefault(require("./ContextField"));
5
- const createGraphqlClient_1 = require("./contextUtils/createGraphqlClient");
6
5
  const FeatureGateEnvOverrides_1 = tslib_1.__importDefault(require("../gating/FeatureGateEnvOverrides"));
7
6
  const FeatureGating_1 = tslib_1.__importDefault(require("../gating/FeatureGating"));
8
7
  class LoggedInContextField extends ContextField_1.default {
@@ -11,7 +10,7 @@ class LoggedInContextField extends ContextField_1.default {
11
10
  nonInteractive,
12
11
  });
13
12
  const featureGateServerValues = actor?.featureGates ?? {};
14
- const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo);
13
+ const graphqlClient = sessionManager.getGraphqlClient(authenticationInfo);
15
14
  return {
16
15
  actor,
17
16
  featureGating: new FeatureGating_1.default(featureGateServerValues, new FeatureGateEnvOverrides_1.default()),
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const ContextField_1 = tslib_1.__importDefault(require("./ContextField"));
5
- const createGraphqlClient_1 = require("./contextUtils/createGraphqlClient");
6
5
  const FeatureGateEnvOverrides_1 = tslib_1.__importDefault(require("../gating/FeatureGateEnvOverrides"));
7
6
  const FeatureGating_1 = tslib_1.__importDefault(require("../gating/FeatureGating"));
8
7
  class MaybeLoggedInContextField extends ContextField_1.default {
@@ -11,7 +10,7 @@ class MaybeLoggedInContextField extends ContextField_1.default {
11
10
  accessToken: sessionManager.getAccessToken(),
12
11
  sessionSecret: sessionManager.getSessionSecret(),
13
12
  };
14
- const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo);
13
+ const graphqlClient = sessionManager.getGraphqlClient(authenticationInfo);
15
14
  const actor = await sessionManager.getUserAsync();
16
15
  const featureGateServerValues = actor?.featureGates ?? {};
17
16
  return {
@@ -41,7 +41,9 @@ class OptionalPrivateProjectConfigContextField extends ContextField_1.default {
41
41
  });
42
42
  serverSideEnvVars = serverSideEnvironmentVariables;
43
43
  }
44
- const exp = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir, { env: serverSideEnvVars });
44
+ const exp = withServerSideEnvironment || !(0, getProjectIdAsync_1.isProjectIdInAppConfig)(expBefore, projectId)
45
+ ? await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir, { env: serverSideEnvVars })
46
+ : expBefore;
45
47
  return {
46
48
  exp,
47
49
  projectDir,
@@ -28,7 +28,9 @@ class PrivateProjectConfigContextField extends ContextField_1.default {
28
28
  });
29
29
  serverSideEnvVars = serverSideEnvironmentVariables;
30
30
  }
31
- const exp = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir, { env: serverSideEnvVars });
31
+ const exp = withServerSideEnvironment || !(0, getProjectIdAsync_1.isProjectIdInAppConfig)(expBefore, projectId)
32
+ ? await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir, { env: serverSideEnvVars })
33
+ : expBefore;
32
34
  return {
33
35
  projectId,
34
36
  exp,
@@ -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
- if (!ranEnsureEasCliIsNotInDependencies) {
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
  }
@@ -26,6 +26,7 @@ export declare function getProjectIdAsync(sessionManager: SessionManager, exp: E
26
26
  env?: Env;
27
27
  nonInteractive: boolean;
28
28
  }): Promise<string>;
29
+ export declare function isProjectIdInAppConfig(exp: Pick<ExpoConfig, 'extra'>, projectId: string): boolean;
29
30
  export declare function validateOrSetProjectIdAsync({ exp, graphqlClient, actor, options, cwd, }: {
30
31
  exp: ExpoConfig;
31
32
  graphqlClient: ExpoGraphqlClient;
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.saveProjectIdToAppConfigAsync = saveProjectIdToAppConfigAsync;
4
4
  exports.getProjectIdAsync = getProjectIdAsync;
5
+ exports.isProjectIdInAppConfig = isProjectIdInAppConfig;
5
6
  exports.validateOrSetProjectIdAsync = validateOrSetProjectIdAsync;
6
7
  const tslib_1 = require("tslib");
7
8
  const config_1 = require("@expo/config");
8
9
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
9
10
  const semver_1 = tslib_1.__importDefault(require("semver"));
10
- const createGraphqlClient_1 = require("./createGraphqlClient");
11
11
  const findProjectDirAndVerifyProjectSetupAsync_1 = require("./findProjectDirAndVerifyProjectSetupAsync");
12
12
  const AppQuery_1 = require("../../../graphql/queries/AppQuery");
13
13
  const log_1 = tslib_1.__importStar(require("../../../log"));
@@ -67,10 +67,13 @@ async function getProjectIdAsync(sessionManager, exp, options) {
67
67
  const { actor, authenticationInfo } = await sessionManager.ensureLoggedInAsync({
68
68
  nonInteractive: options.nonInteractive,
69
69
  });
70
- const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo);
70
+ const graphqlClient = sessionManager.getGraphqlClient(authenticationInfo);
71
71
  const projectId = await validateOrSetProjectIdAsync({ exp, graphqlClient, actor, options });
72
72
  return projectId;
73
73
  }
74
+ function isProjectIdInAppConfig(exp, projectId) {
75
+ return exp.extra?.eas?.projectId === projectId;
76
+ }
74
77
  async function validateOrSetProjectIdAsync({ exp, graphqlClient, actor, options, cwd, }) {
75
78
  const localProjectId = exp.extra?.eas?.projectId;
76
79
  if (localProjectId) {
@@ -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[]>;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.collectReferencedWorkflowFilesAsync = collectReferencedWorkflowFilesAsync;
4
+ const tslib_1 = require("tslib");
5
+ const fs_1 = tslib_1.__importDefault(require("fs"));
6
+ const path_1 = tslib_1.__importDefault(require("path"));
7
+ const parse_1 = require("./parse");
8
+ const WORKFLOW_CALL_USES_REGEX = /^\.\/\.eas\/workflows\/(?:(?!\$\{\{)[^/\\])+\.ya?ml$/;
9
+ async function collectReferencedWorkflowFilesAsync({ projectDir, rootFileName, rootYamlConfig, }) {
10
+ let rootYaml;
11
+ try {
12
+ rootYaml = (0, parse_1.parsedYamlFromWorkflowContents)({ yamlConfig: rootYamlConfig });
13
+ }
14
+ catch {
15
+ return [];
16
+ }
17
+ const collectedFileNames = new Set([rootFileName]);
18
+ const referencedFiles = [];
19
+ const pendingCalls = getWorkflowCalls(rootFileName, rootYaml);
20
+ for (const call of pendingCalls) {
21
+ const fileName = path_1.default.posix.basename(call.uses);
22
+ if (collectedFileNames.has(fileName)) {
23
+ continue;
24
+ }
25
+ collectedFileNames.add(fileName);
26
+ const { yamlConfig, parsedYaml } = await readReferencedWorkflowFileAsync(projectDir, fileName, call);
27
+ referencedFiles.push({ fileName, yamlConfig });
28
+ pendingCalls.push(...getWorkflowCalls(fileName, parsedYaml));
29
+ }
30
+ return referencedFiles;
31
+ }
32
+ function getWorkflowCalls(callerFileName, parsedYaml) {
33
+ const jobs = parsedYaml?.jobs;
34
+ if (!jobs || typeof jobs !== 'object') {
35
+ return [];
36
+ }
37
+ return Object.entries(jobs).flatMap(([callerJobKey, job]) => {
38
+ const uses = job?.uses;
39
+ return typeof uses === 'string' && WORKFLOW_CALL_USES_REGEX.test(uses)
40
+ ? [{ callerFileName, callerJobKey, uses }]
41
+ : [];
42
+ });
43
+ }
44
+ async function readReferencedWorkflowFileAsync(projectDir, fileName, { callerFileName, callerJobKey, uses }) {
45
+ const filePath = path_1.default.join(projectDir, '.eas', 'workflows', fileName);
46
+ const describeCall = `Job "${callerJobKey}" in ${callerFileName} uses ${uses}, but ${filePath}`;
47
+ let yamlConfig;
48
+ try {
49
+ yamlConfig = await fs_1.default.promises.readFile(filePath, 'utf8');
50
+ }
51
+ catch (error) {
52
+ if (error.code === 'ENOENT') {
53
+ throw new Error(`${describeCall} does not exist.`);
54
+ }
55
+ throw new Error(`${describeCall} could not be read: ${error.message}`);
56
+ }
57
+ try {
58
+ return { yamlConfig, parsedYaml: (0, parse_1.parsedYamlFromWorkflowContents)({ yamlConfig }) };
59
+ }
60
+ catch (error) {
61
+ throw new Error(`${describeCall} is not valid YAML: ${error.message}`);
62
+ }
63
+ }
@@ -13,7 +13,7 @@ export type WorkflowRunResult = {
13
13
  triggerType: WorkflowTriggerType;
14
14
  trigger: string | null;
15
15
  startedAt: string;
16
- finishedAt: string;
16
+ finishedAt: string | null;
17
17
  workflowId: string;
18
18
  workflowName: string | null;
19
19
  workflowFileName: string;