eas-cli 0.31.1 → 0.34.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 (128) hide show
  1. package/README.md +29 -28
  2. package/build/analytics.js +3 -9
  3. package/build/build/android/UpdatesModule.js +4 -15
  4. package/build/build/android/configure.js +3 -3
  5. package/build/build/android/graphql.js +2 -4
  6. package/build/build/android/prepareJob.js +4 -3
  7. package/build/build/build.js +2 -2
  8. package/build/build/configure.js +26 -13
  9. package/build/build/ios/UpdatesModule.js +6 -18
  10. package/build/build/ios/configure.js +1 -1
  11. package/build/build/ios/graphql.js +2 -23
  12. package/build/build/ios/prepareJob.js +4 -6
  13. package/build/build/metadata.js +5 -10
  14. package/build/build/utils/appJson.d.ts +1 -0
  15. package/build/build/utils/appJson.js +13 -4
  16. package/build/build/utils/devClient.d.ts +4 -4
  17. package/build/build/utils/devClient.js +10 -18
  18. package/build/build/utils/repository.js +10 -7
  19. package/build/build/validate.js +4 -4
  20. package/build/commandUtils/EasCommand.d.ts +1 -0
  21. package/build/commandUtils/EasCommand.js +21 -0
  22. package/build/commands/branch/create.js +3 -2
  23. package/build/commands/branch/delete.js +1 -1
  24. package/build/commands/branch/list.js +1 -1
  25. package/build/commands/branch/publish.js +20 -48
  26. package/build/commands/branch/view.js +1 -1
  27. package/build/commands/build/index.d.ts +1 -1
  28. package/build/commands/build/index.js +64 -49
  29. package/build/commands/channel/edit.js +1 -1
  30. package/build/commands/channel/list.js +1 -1
  31. package/build/commands/channel/view.js +1 -1
  32. package/build/commands/diagnostics.js +2 -2
  33. package/build/commands/project/info.js +1 -1
  34. package/build/commands/submit.js +16 -11
  35. package/build/commands/update/view.js +1 -1
  36. package/build/credentials/android/api/graphql/queries/GoogleServiceAccountKeyQuery.js +2 -0
  37. package/build/credentials/context.d.ts +1 -1
  38. package/build/credentials/context.js +5 -5
  39. package/build/credentials/credentialsJson/update.js +5 -4
  40. package/build/credentials/errors.d.ts +3 -0
  41. package/build/credentials/errors.js +7 -1
  42. package/build/credentials/ios/IosCredentialsProvider.js +1 -1
  43. package/build/credentials/ios/actions/AscApiKeyUtils.d.ts +5 -0
  44. package/build/credentials/ios/actions/AscApiKeyUtils.js +63 -0
  45. package/build/credentials/ios/actions/CreateDistributionCertificate.js +1 -1
  46. package/build/credentials/ios/actions/CreatePushKey.js +1 -1
  47. package/build/credentials/ios/actions/DistributionCertificateUtils.d.ts +1 -1
  48. package/build/credentials/ios/actions/DistributionCertificateUtils.js +10 -12
  49. package/build/credentials/ios/actions/PushKeyUtils.d.ts +1 -1
  50. package/build/credentials/ios/actions/PushKeyUtils.js +5 -5
  51. package/build/credentials/ios/actions/SetupTargetBuildCredentials.js +1 -1
  52. package/build/credentials/ios/api/graphql/queries/AppQuery.js +3 -1
  53. package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.js +6 -2
  54. package/build/credentials/ios/api/graphql/queries/AppleDistributionCertificateQuery.js +7 -1
  55. package/build/credentials/ios/api/graphql/queries/AppleProvisioningProfileQuery.js +5 -1
  56. package/build/credentials/ios/api/graphql/queries/ApplePushKeyQuery.js +2 -0
  57. package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.js +5 -1
  58. package/build/credentials/ios/appstore/AppStoreApi.d.ts +7 -1
  59. package/build/credentials/ios/appstore/AppStoreApi.js +17 -0
  60. package/build/credentials/ios/appstore/Credentials.js +3 -3
  61. package/build/credentials/ios/appstore/Credentials.types.d.ts +13 -0
  62. package/build/credentials/ios/appstore/ascApiKey.d.ts +9 -0
  63. package/build/credentials/ios/appstore/ascApiKey.js +99 -0
  64. package/build/credentials/ios/credentials.d.ts +17 -0
  65. package/build/credentials/ios/credentials.js +16 -1
  66. package/build/credentials/manager/Actions.d.ts +47 -0
  67. package/build/credentials/manager/Actions.js +48 -0
  68. package/build/credentials/manager/AndroidActions.d.ts +6 -0
  69. package/build/credentials/manager/AndroidActions.js +114 -0
  70. package/build/credentials/manager/IosActions.d.ts +6 -0
  71. package/build/credentials/manager/IosActions.js +110 -0
  72. package/build/credentials/manager/ManageAndroid.d.ts +1 -29
  73. package/build/credentials/manager/ManageAndroid.js +26 -159
  74. package/build/credentials/manager/ManageIos.d.ts +1 -29
  75. package/build/credentials/manager/ManageIos.js +28 -155
  76. package/build/graphql/client.d.ts +8 -2
  77. package/build/graphql/generated.d.ts +134 -121
  78. package/build/graphql/generated.js +46 -28
  79. package/build/graphql/queries/BuildQuery.js +4 -1
  80. package/build/graphql/queries/EnvironmentSecretsQuery.js +4 -2
  81. package/build/graphql/queries/ProjectQuery.js +3 -1
  82. package/build/graphql/queries/PublishQuery.js +4 -1
  83. package/build/graphql/queries/SubmissionQuery.js +5 -2
  84. package/build/graphql/queries/UserQuery.js +4 -1
  85. package/build/graphql/queries/WebhookQuery.js +6 -2
  86. package/build/log.d.ts +11 -3
  87. package/build/log.js +23 -22
  88. package/build/project/android/applicationId.d.ts +1 -1
  89. package/build/project/android/applicationId.js +7 -6
  90. package/build/project/ios/bundleIdentifier.d.ts +1 -1
  91. package/build/project/ios/bundleIdentifier.js +7 -6
  92. package/build/project/projectUtils.js +1 -1
  93. package/build/project/publish.js +2 -2
  94. package/build/project/workflow.js +2 -2
  95. package/build/submit/ArchiveSource.d.ts +7 -2
  96. package/build/submit/ArchiveSource.js +94 -11
  97. package/build/submit/ios/AscApiKeySource.d.ts +28 -0
  98. package/build/submit/ios/AscApiKeySource.js +51 -0
  99. package/build/submit/ios/IosSubmitCommand.d.ts +2 -0
  100. package/build/submit/ios/IosSubmitCommand.js +55 -3
  101. package/build/submit/ios/IosSubmitter.d.ts +3 -1
  102. package/build/submit/ios/IosSubmitter.js +49 -5
  103. package/build/submit/submit.js +1 -1
  104. package/build/submit/utils/builds.d.ts +3 -1
  105. package/build/submit/utils/builds.js +6 -6
  106. package/build/user/User.js +1 -0
  107. package/build/utils/easCli.d.ts +1 -0
  108. package/build/utils/easCli.js +5 -0
  109. package/build/utils/{expoCommand.d.ts → expoCli.d.ts} +0 -0
  110. package/build/utils/{expoCommand.js → expoCli.js} +0 -0
  111. package/build/utils/profiles.d.ts +11 -0
  112. package/build/utils/profiles.js +46 -0
  113. package/build/vcs/clients/git.d.ts +26 -0
  114. package/build/vcs/clients/git.js +184 -0
  115. package/build/vcs/clients/gitNoCommit.d.ts +7 -0
  116. package/build/vcs/clients/gitNoCommit.js +27 -0
  117. package/build/vcs/clients/noVcs.d.ts +6 -0
  118. package/build/vcs/clients/noVcs.js +19 -0
  119. package/build/vcs/git.d.ts +10 -17
  120. package/build/vcs/git.js +7 -175
  121. package/build/vcs/index.d.ts +2 -2
  122. package/build/vcs/index.js +15 -6
  123. package/build/vcs/local.d.ts +18 -5
  124. package/build/vcs/local.js +61 -32
  125. package/build/vcs/vcs.d.ts +2 -1
  126. package/build/vcs/vcs.js +8 -4
  127. package/oclif.manifest.json +1 -1
  128. package/package.json +7 -7
@@ -7,14 +7,14 @@ const path_1 = (0, tslib_1.__importDefault)(require("path"));
7
7
  const slash_1 = (0, tslib_1.__importDefault)(require("slash"));
8
8
  const projectUtils_1 = require("../../project/projectUtils");
9
9
  const actions_1 = require("../../user/actions");
10
- const vcs_1 = (0, tslib_1.__importDefault)(require("../../vcs"));
10
+ const vcs_1 = require("../../vcs");
11
11
  const cacheDefaults = {
12
12
  disabled: false,
13
13
  customPaths: [],
14
14
  cacheDefaultPaths: true,
15
15
  };
16
16
  async function prepareJobAsync(ctx, jobData) {
17
- const projectRootDirectory = (0, slash_1.default)(path_1.default.relative(await vcs_1.default.getRootPathAsync(), ctx.projectDir)) || '.';
17
+ const projectRootDirectory = (0, slash_1.default)(path_1.default.relative(await (0, vcs_1.getVcsClient)().getRootPathAsync(), ctx.projectDir)) || '.';
18
18
  const username = (0, projectUtils_1.getUsername)(ctx.exp, await (0, actions_1.ensureLoggedInAsync)());
19
19
  const buildCredentials = {};
20
20
  if (jobData.credentials) {
@@ -28,7 +28,6 @@ async function prepareJobAsync(ctx, jobData) {
28
28
  platform: eas_build_job_1.Platform.IOS,
29
29
  projectArchive: jobData.projectArchive,
30
30
  projectRootDirectory,
31
- distribution: ctx.buildProfile.simulator ? 'simulator' : ctx.buildProfile.distribution,
32
31
  builderEnvironment: {
33
32
  image: ctx.buildProfile.image,
34
33
  node: ctx.buildProfile.node,
@@ -49,12 +48,11 @@ async function prepareJobAsync(ctx, jobData) {
49
48
  },
50
49
  releaseChannel: ctx.buildProfile.releaseChannel,
51
50
  updates: { channel: ctx.buildProfile.channel },
51
+ developmentClient: ctx.buildProfile.developmentClient,
52
+ simulator: ctx.buildProfile.simulator,
52
53
  scheme: jobData.buildScheme,
53
54
  buildConfiguration: ctx.buildProfile.buildConfiguration,
54
55
  artifactPath: ctx.buildProfile.artifactPath,
55
- buildType: ctx.buildProfile.developmentClient
56
- ? eas_build_job_1.Ios.BuildType.DEVELOPMENT_CLIENT
57
- : eas_build_job_1.Ios.BuildType.RELEASE,
58
56
  username,
59
57
  };
60
58
  return (0, eas_build_job_1.sanitizeJob)(job);
@@ -1,24 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.collectMetadataAsync = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const eas_build_job_1 = require("@expo/eas-build-job");
6
5
  const applicationId_1 = require("../project/android/applicationId");
7
6
  const bundleIdentifier_1 = require("../project/ios/bundleIdentifier");
8
7
  const projectUtils_1 = require("../project/projectUtils");
9
8
  const actions_1 = require("../user/actions");
10
- const vcs_1 = (0, tslib_1.__importDefault)(require("../vcs"));
9
+ const easCli_1 = require("../utils/easCli");
10
+ const vcs_1 = require("../vcs");
11
11
  const UpdatesModule_1 = require("./android/UpdatesModule");
12
12
  const version_1 = require("./android/version");
13
13
  const UpdatesModule_2 = require("./ios/UpdatesModule");
14
14
  const version_2 = require("./ios/version");
15
15
  const updates_1 = require("./utils/updates");
16
- /**
17
- * We use require() to exclude package.json from TypeScript's analysis since it lives outside
18
- * the src directory and would change the directory structure of the emitted files
19
- * under the build directory
20
- */
21
- const packageJSON = require('../../package.json');
22
16
  async function collectMetadataAsync(ctx, platformContext) {
23
17
  var _a;
24
18
  const channelOrReleaseChannel = await resolveChannelOrReleaseChannelAsync(ctx);
@@ -28,7 +22,7 @@ async function collectMetadataAsync(ctx, platformContext) {
28
22
  const metadata = {
29
23
  trackingContext: ctx.trackingCtx,
30
24
  ...(await maybeResolveVersionsAsync(ctx, platformContext)),
31
- cliVersion: packageJSON.version,
25
+ cliVersion: easCli_1.easCliVersion,
32
26
  workflow: ctx.workflow,
33
27
  credentialsSource: ctx.buildProfile.credentialsSource,
34
28
  sdkVersion: ctx.exp.sdkVersion,
@@ -38,7 +32,8 @@ async function collectMetadataAsync(ctx, platformContext) {
38
32
  appName: ctx.exp.name,
39
33
  appIdentifier: await resolveAppIdentifierAsync(ctx, platformContext),
40
34
  buildProfile: ctx.buildProfileName,
41
- gitCommitHash: await vcs_1.default.getCommitHashAsync(),
35
+ gitCommitHash: await (0, vcs_1.getVcsClient)().getCommitHashAsync(),
36
+ isGitWorkingTreeDirty: await (0, vcs_1.getVcsClient)().hasUncommittedChangesAsync(),
42
37
  username: (0, projectUtils_1.getUsername)(ctx.exp, await (0, actions_1.ensureLoggedInAsync)()),
43
38
  ...(ctx.platform === eas_build_job_1.Platform.IOS && {
44
39
  iosEnterpriseProvisioning: resolveIosEnterpriseProvisioning(ctx),
@@ -3,3 +3,4 @@ export declare function updateAppJsonConfigAsync({ projectDir, exp, }: {
3
3
  projectDir: string;
4
4
  exp: ExpoConfig.ExpoConfig;
5
5
  }, modifyConfig: (config: any) => void): Promise<void>;
6
+ export declare function readAppJson(appJsonPath: string): any;
@@ -1,18 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateAppJsonConfigAsync = void 0;
3
+ exports.readAppJson = exports.updateAppJsonConfigAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ExpoConfig = (0, tslib_1.__importStar)(require("@expo/config"));
6
+ const json_file_1 = (0, tslib_1.__importDefault)(require("@expo/json-file"));
6
7
  const assert_1 = (0, tslib_1.__importDefault)(require("assert"));
7
- const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
8
8
  async function updateAppJsonConfigAsync({ projectDir, exp, }, modifyConfig) {
9
9
  var _a;
10
10
  const paths = ExpoConfig.getConfigFilePaths(projectDir);
11
11
  (0, assert_1.default)(paths.staticConfigPath, "can't update dynamic config");
12
- const rawStaticConfig = await fs_extra_1.default.readJSON(paths.staticConfigPath);
12
+ const rawStaticConfig = readAppJson(paths.staticConfigPath);
13
13
  rawStaticConfig.expo = (_a = rawStaticConfig.expo) !== null && _a !== void 0 ? _a : {};
14
14
  modifyConfig(rawStaticConfig.expo);
15
- await fs_extra_1.default.writeJson(paths.staticConfigPath, rawStaticConfig, { spaces: 2 });
15
+ await json_file_1.default.writeAsync(paths.staticConfigPath, rawStaticConfig, { json5: false });
16
16
  modifyConfig(exp);
17
17
  }
18
18
  exports.updateAppJsonConfigAsync = updateAppJsonConfigAsync;
19
+ // TODO: remove this once @expo/config exports getStaticConfig
20
+ function readAppJson(appJsonPath) {
21
+ const config = json_file_1.default.read(appJsonPath, { json5: true });
22
+ if (config) {
23
+ return config;
24
+ }
25
+ throw new Error(`Failed to read app.json`);
26
+ }
27
+ exports.readAppJson = readAppJson;
@@ -1,7 +1,7 @@
1
- import { Platform } from '@expo/eas-build-job';
2
- export declare function ensureExpoDevClientInstalledForDevClientBuildsAsync({ projectDir, platforms, profile, nonInteractive, }: {
1
+ import { BuildProfile } from '@expo/eas-json';
2
+ import { ProfileData } from '../../utils/profiles';
3
+ export declare function ensureExpoDevClientInstalledForDevClientBuildsAsync({ projectDir, nonInteractive, buildProfiles, }: {
3
4
  projectDir: string;
4
- platforms: Platform[];
5
- profile: string;
6
5
  nonInteractive?: boolean;
6
+ buildProfiles?: ProfileData<BuildProfile>[];
7
7
  }): Promise<void>;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ensureExpoDevClientInstalledForDevClientBuildsAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const eas_build_job_1 = require("@expo/eas-build-job");
6
- const eas_json_1 = require("@expo/eas-json");
7
6
  const errors_1 = require("@oclif/errors");
8
7
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
9
8
  const resolve_from_1 = (0, tslib_1.__importDefault)(require("resolve-from"));
@@ -12,25 +11,18 @@ const log_1 = (0, tslib_1.__importStar)(require("../../log"));
12
11
  const platform_1 = require("../../platform");
13
12
  const workflow_1 = require("../../project/workflow");
14
13
  const prompts_1 = require("../../prompts");
15
- const expoCommand_1 = require("../../utils/expoCommand");
16
- const zipObject_1 = (0, tslib_1.__importDefault)(require("../../utils/expodash/zipObject"));
14
+ const expoCli_1 = require("../../utils/expoCli");
17
15
  const repository_1 = require("./repository");
18
- async function ensureExpoDevClientInstalledForDevClientBuildsAsync({ projectDir, platforms, profile, nonInteractive = false, }) {
16
+ async function ensureExpoDevClientInstalledForDevClientBuildsAsync({ projectDir, nonInteractive = false, buildProfiles = [], }) {
19
17
  if (await isExpoDevClientInstalledAsync(projectDir)) {
20
18
  return;
21
19
  }
22
- const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
23
- const devClientPerPlatformList = await Promise.all(platforms.map(async (platform) => {
24
- var _a;
25
- const buildProfile = await easJsonReader.readBuildProfileAsync(platform, profile);
26
- return (_a = buildProfile.developmentClient) !== null && _a !== void 0 ? _a : false;
27
- }));
28
- const isDevClientRequired = devClientPerPlatformList.some(i => i);
29
- if (!isDevClientRequired) {
20
+ const buildProfilesWithDevelopmentClientRequired = buildProfiles.filter(buildProfile => buildProfile.profile.developmentClient);
21
+ const isDevelopmentClientRequired = buildProfilesWithDevelopmentClientRequired.some(Boolean);
22
+ if (!isDevelopmentClientRequired) {
30
23
  return;
31
24
  }
32
- const devClientPerPlatform = (0, zipObject_1.default)(platforms, devClientPerPlatformList);
33
- const platformsToCheck = platforms.filter(platform => devClientPerPlatform[platform]);
25
+ const platformsToCheck = buildProfilesWithDevelopmentClientRequired.map(({ platform }) => platform);
34
26
  const workflowPerPlatformList = await Promise.all(platformsToCheck.map(platform => (0, workflow_1.resolveWorkflowAsync)(projectDir, platform)));
35
27
  log_1.default.newLine();
36
28
  log_1.default.error(`You want to build a development client build for platforms: ${platformsToCheck
@@ -47,15 +39,15 @@ async function ensureExpoDevClientInstalledForDevClientBuildsAsync({ projectDir,
47
39
  await installExpoDevClientAsync(projectDir, { nonInteractive });
48
40
  }
49
41
  else {
50
- (0, errors_1.error)(`Install ${chalk_1.default.bold('expo-dev-client')} on your own and come back later.`, {
42
+ (0, errors_1.error)(`Install ${chalk_1.default.bold('expo-dev-client')} manually and come back later.`, {
51
43
  exit: 1,
52
44
  });
53
45
  }
54
46
  }
55
47
  else {
56
- log_1.default.warn(`Unfortunately, you need to install ${chalk_1.default.bold('expo-dev-client')} on your own.`);
48
+ log_1.default.warn(`You'll need to install ${chalk_1.default.bold('expo-dev-client')} manually.`);
57
49
  log_1.default.warn((0, log_1.learnMore)('https://docs.expo.dev/clients/installation/', {
58
- learnMoreMessage: 'See installation instructions on how to do it',
50
+ learnMoreMessage: 'See installation instructions on how to do it.',
59
51
  dim: false,
60
52
  }));
61
53
  log_1.default.warn('If you proceed anyway, you might not get the build you want.');
@@ -84,7 +76,7 @@ async function installExpoDevClientAsync(projectDir, { nonInteractive }) {
84
76
  log_1.default.newLine();
85
77
  log_1.default.log(`Running ${chalk_1.default.bold('expo install expo-dev-client')}`);
86
78
  log_1.default.newLine();
87
- await (0, expoCommand_1.expoCommandAsync)(projectDir, ['install', 'expo-dev-client']);
79
+ await (0, expoCli_1.expoCommandAsync)(projectDir, ['install', 'expo-dev-client']);
88
80
  log_1.default.newLine();
89
81
  await (0, repository_1.reviewAndCommitChangesAsync)('Install expo-dev-client', {
90
82
  nonInteractive,
@@ -13,9 +13,9 @@ const prompts_1 = require("../../prompts");
13
13
  const files_1 = require("../../utils/files");
14
14
  const paths_1 = require("../../utils/paths");
15
15
  const timer_1 = require("../../utils/timer");
16
- const vcs_1 = (0, tslib_1.__importDefault)(require("../../vcs"));
16
+ const vcs_1 = require("../../vcs");
17
17
  async function maybeBailOnRepoStatusAsync() {
18
- if (!(await vcs_1.default.hasUncommittedChangesAsync())) {
18
+ if (!(await (0, vcs_1.getVcsClient)().isCommitRequiredAsync())) {
19
19
  return;
20
20
  }
21
21
  log_1.default.addNewLineIfNone();
@@ -30,7 +30,7 @@ async function maybeBailOnRepoStatusAsync() {
30
30
  }
31
31
  exports.maybeBailOnRepoStatusAsync = maybeBailOnRepoStatusAsync;
32
32
  async function ensureRepoIsCleanAsync(nonInteractive = false) {
33
- if (!(await vcs_1.default.hasUncommittedChangesAsync())) {
33
+ if (!(await (0, vcs_1.getVcsClient)().isCommitRequiredAsync())) {
34
34
  return;
35
35
  }
36
36
  log_1.default.addNewLineIfNone();
@@ -58,7 +58,7 @@ async function commitPromptAsync({ initialCommitMessage, commitAllFiles, } = {})
58
58
  initial: initialCommitMessage,
59
59
  validate: (input) => input !== '',
60
60
  });
61
- await vcs_1.default.commitAsync({ commitAllFiles, commitMessage: message });
61
+ await (0, vcs_1.getVcsClient)().commitAsync({ commitAllFiles, commitMessage: message });
62
62
  }
63
63
  exports.commitPromptAsync = commitPromptAsync;
64
64
  async function makeProjectTarballAsync() {
@@ -77,7 +77,7 @@ async function makeProjectTarballAsync() {
77
77
  const compressTimerLabel = 'makeProjectTarballAsync';
78
78
  (0, timer_1.startTimer)(compressTimerLabel);
79
79
  try {
80
- await vcs_1.default.makeShallowCopyAsync(shallowClonePath);
80
+ await (0, vcs_1.getVcsClient)().makeShallowCopyAsync(shallowClonePath);
81
81
  await tar_1.default.create({ cwd: shallowClonePath, file: tarPath, prefix: 'project', gzip: true }, [
82
82
  '.',
83
83
  ]);
@@ -110,7 +110,10 @@ var ShouldCommitChanges;
110
110
  })(ShouldCommitChanges || (ShouldCommitChanges = {}));
111
111
  async function reviewAndCommitChangesAsync(initialCommitMessage, { nonInteractive, askedFirstTime = true }) {
112
112
  if (process.env.EAS_BUILD_AUTOCOMMIT) {
113
- await vcs_1.default.commitAsync({ commitMessage: initialCommitMessage, commitAllFiles: false });
113
+ await (0, vcs_1.getVcsClient)().commitAsync({
114
+ commitMessage: initialCommitMessage,
115
+ commitAllFiles: false,
116
+ });
114
117
  log_1.default.withTick('Committed changes.');
115
118
  return;
116
119
  }
@@ -140,7 +143,7 @@ async function reviewAndCommitChangesAsync(initialCommitMessage, { nonInteractiv
140
143
  log_1.default.withTick('Committed changes.');
141
144
  }
142
145
  else if (selected === ShouldCommitChanges.ShowDiffFirst) {
143
- await vcs_1.default.showDiffAsync();
146
+ await (0, vcs_1.getVcsClient)().showDiffAsync();
144
147
  await reviewAndCommitChangesAsync(initialCommitMessage, {
145
148
  nonInteractive,
146
149
  askedFirstTime: false,
@@ -6,7 +6,7 @@ const eas_build_job_1 = require("@expo/eas-build-job");
6
6
  const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
7
7
  const path_1 = (0, tslib_1.__importDefault)(require("path"));
8
8
  const log_1 = (0, tslib_1.__importStar)(require("../log"));
9
- const vcs_1 = (0, tslib_1.__importDefault)(require("../vcs"));
9
+ const vcs_1 = require("../vcs");
10
10
  function checkNodeEnvVariable(ctx) {
11
11
  var _a;
12
12
  if (((_a = ctx.buildProfile.env) === null || _a === void 0 ? void 0 : _a.NODE_ENV) === 'production') {
@@ -24,14 +24,14 @@ async function checkGoogleServicesFileAsync(ctx) {
24
24
  if (!googleServicesFilePath) {
25
25
  return;
26
26
  }
27
- const rootDir = path_1.default.normalize(await vcs_1.default.getRootPathAsync());
27
+ const rootDir = path_1.default.normalize(await (0, vcs_1.getVcsClient)().getRootPathAsync());
28
28
  const absGoogleServicesFilePath = path_1.default.resolve(ctx.projectDir, googleServicesFilePath);
29
29
  if ((await fs_extra_1.default.pathExists(absGoogleServicesFilePath)) &&
30
30
  (!isInsideDirectory(absGoogleServicesFilePath, rootDir) ||
31
- (await vcs_1.default.isFileIgnoredAsync(path_1.default.relative(rootDir, absGoogleServicesFilePath))))) {
31
+ (await (0, vcs_1.getVcsClient)().isFileIgnoredAsync(path_1.default.relative(rootDir, absGoogleServicesFilePath))))) {
32
32
  log_1.default.warn(`File specified via "${ctx.platform}.googleServicesFile" field in your app.json is not checked in to your repository and won't be uploaded to the builder.`);
33
33
  log_1.default.warn(`Use EAS Secret to pass all values that you don't want to include in your version control. ${(0, log_1.learnMore)('https://docs.expo.dev/build-reference/variables/#using-secrets-in-environment-variables')}`);
34
- log_1.default.warn('If you are using that file for compatibility with the classic build service (expo build) you can silence this warning by setting GOOGLE_SERVICES_FILE in your build profile in eas.json to any non-falsy value.');
34
+ log_1.default.warn(`If you are using that file for compatibility with the classic build service (expo build) you can silence this warning by setting your build profile's env.GOOGLE_SERVICES_FILE in eas.json to any non-empty string.`);
35
35
  log_1.default.newLine();
36
36
  }
37
37
  }
@@ -8,4 +8,5 @@ export default abstract class EasCommand extends Command {
8
8
  protected abstract runAsync(): Promise<any>;
9
9
  run(): Promise<any>;
10
10
  finally(err: Error): Promise<any>;
11
+ private applyCliConfigAsync;
11
12
  }
@@ -1,9 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const eas_json_1 = require("@expo/eas-json");
3
5
  const command_1 = require("@oclif/command");
6
+ const semver_1 = (0, tslib_1.__importDefault)(require("semver"));
4
7
  const analytics_1 = require("../analytics");
8
+ const log_1 = (0, tslib_1.__importDefault)(require("../log"));
9
+ const projectUtils_1 = require("../project/projectUtils");
5
10
  const User_1 = require("../user/User");
6
11
  const actions_1 = require("../user/actions");
12
+ const easCli_1 = require("../utils/easCli");
13
+ const vcs_1 = require("../vcs");
14
+ const git_1 = (0, tslib_1.__importDefault)(require("../vcs/clients/git"));
7
15
  class EasCommand extends command_1.Command {
8
16
  constructor() {
9
17
  super(...arguments);
@@ -16,7 +24,9 @@ class EasCommand extends command_1.Command {
16
24
  // eslint-disable-next-line async-protect/async-suffix
17
25
  async run() {
18
26
  var _a;
27
+ eas_json_1.EasJsonReader.setLog(log_1.default);
19
28
  await (0, analytics_1.initAsync)();
29
+ await this.applyCliConfigAsync();
20
30
  if (this.requiresAuthentication) {
21
31
  const { flags } = this.parse();
22
32
  const nonInteractive = (_a = flags['non-interactive']) !== null && _a !== void 0 ? _a : false;
@@ -37,5 +47,16 @@ class EasCommand extends command_1.Command {
37
47
  await (0, analytics_1.flushAsync)();
38
48
  return super.finally(err);
39
49
  }
50
+ async applyCliConfigAsync() {
51
+ const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
52
+ const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
53
+ const config = await easJsonReader.getCliConfigAsync();
54
+ if ((config === null || config === void 0 ? void 0 : config.version) && !semver_1.default.satisfies(easCli_1.easCliVersion, config.version)) {
55
+ throw new Error(`You are on eas-cli@${easCli_1.easCliVersion} which does not satisfy the CLI version constraint in eas.json (${config.version})`);
56
+ }
57
+ if (config === null || config === void 0 ? void 0 : config.requireCommit) {
58
+ (0, vcs_1.setVcsClient)(new git_1.default());
59
+ }
60
+ }
40
61
  }
41
62
  exports.default = EasCommand;
@@ -11,7 +11,7 @@ const client_1 = require("../../graphql/client");
11
11
  const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
12
12
  const projectUtils_1 = require("../../project/projectUtils");
13
13
  const prompts_1 = require("../../prompts");
14
- const vcs_1 = (0, tslib_1.__importDefault)(require("../../vcs"));
14
+ const vcs_1 = require("../../vcs");
15
15
  async function createUpdateBranchOnAppAsync({ appId, name, }) {
16
16
  const result = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
17
17
  .mutation((0, graphql_tag_1.default) `
@@ -51,7 +51,8 @@ class BranchCreate extends EasCommand_1.default {
51
51
  type: 'text',
52
52
  name: 'name',
53
53
  message: 'Please name the branch:',
54
- initial: (await vcs_1.default.getBranchNameAsync()) || `branch-${Math.random().toString(36).substr(2, 4)}`,
54
+ initial: (await (0, vcs_1.getVcsClient)().getBranchNameAsync()) ||
55
+ `branch-${Math.random().toString(36).substr(2, 4)}`,
55
56
  validate: value => (value ? true : validationMessage),
56
57
  }));
57
58
  }
@@ -27,7 +27,7 @@ async function getBranchInfoAsync({ appId, name, }) {
27
27
  `, {
28
28
  appId,
29
29
  name,
30
- })
30
+ }, { additionalTypenames: ['UpdateBranch'] })
31
31
  .toPromise());
32
32
  return data;
33
33
  }
@@ -34,7 +34,7 @@ async function listBranchesAsync({ projectId, }) {
34
34
  `, {
35
35
  appId: projectId,
36
36
  limit: BRANCHES_LIMIT,
37
- })
37
+ }, { additionalTypenames: ['UpdateBranch'] })
38
38
  .toPromise());
39
39
  return (_b = (_a = data === null || data === void 0 ? void 0 : data.app) === null || _a === void 0 ? void 0 : _a.byId.updateBranches) !== null && _b !== void 0 ? _b : [];
40
40
  }
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaultPublishPlatforms = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const config_1 = require("@expo/config");
6
- const sdk_runtime_versions_1 = require("@expo/sdk-runtime-versions");
6
+ const config_plugins_1 = require("@expo/config-plugins");
7
+ const eas_build_job_1 = require("@expo/eas-build-job");
7
8
  const command_1 = require("@oclif/command");
8
9
  const assert_1 = (0, tslib_1.__importDefault)(require("assert"));
9
10
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
@@ -16,11 +17,12 @@ const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
16
17
  const ora_1 = require("../../ora");
17
18
  const projectUtils_1 = require("../../project/projectUtils");
18
19
  const publish_1 = require("../../project/publish");
20
+ const workflow_1 = require("../../project/workflow");
19
21
  const prompts_1 = require("../../prompts");
20
22
  const utils_1 = require("../../update/utils");
21
23
  const uniqBy_1 = (0, tslib_1.__importDefault)(require("../../utils/expodash/uniqBy"));
22
24
  const formatFields_1 = (0, tslib_1.__importDefault)(require("../../utils/formatFields"));
23
- const vcs_1 = (0, tslib_1.__importDefault)(require("../../vcs"));
25
+ const vcs_1 = require("../../vcs");
24
26
  const create_1 = require("./create");
25
27
  const list_1 = require("./list");
26
28
  const view_1 = require("./view");
@@ -40,7 +42,7 @@ async function getUpdateGroupAsync({ group, }) {
40
42
  }
41
43
  `, {
42
44
  group,
43
- })
45
+ }, { additionalTypenames: ['Update'] })
44
46
  .toPromise());
45
47
  return updatesByGroup;
46
48
  }
@@ -69,11 +71,12 @@ class BranchPublish extends EasCommand_1.default {
69
71
  skipSDKVersionRequirement: true,
70
72
  isPublicConfig: true,
71
73
  });
72
- const runtimeVersions = getRuntimeVersionObject(exp, platformFlag, projectDir);
74
+ const runtimeVersions = await getRuntimeVersionObjectAsync(exp, platformFlag, projectDir);
73
75
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
74
76
  if (!branchName && autoFlag) {
75
77
  branchName =
76
- (await vcs_1.default.getBranchNameAsync()) || `branch-${Math.random().toString(36).substr(2, 4)}`;
78
+ (await (0, vcs_1.getVcsClient)().getBranchNameAsync()) ||
79
+ `branch-${Math.random().toString(36).substr(2, 4)}`;
77
80
  }
78
81
  if (!branchName) {
79
82
  const validationMessage = 'branch name may not be empty.';
@@ -170,7 +173,7 @@ class BranchPublish extends EasCommand_1.default {
170
173
  }
171
174
  }
172
175
  if (!message && autoFlag) {
173
- message = (_b = (await vcs_1.default.getLastCommitMessageAsync())) === null || _b === void 0 ? void 0 : _b.trim();
176
+ message = (_b = (await (0, vcs_1.getVcsClient)().getLastCommitMessageAsync())) === null || _b === void 0 ? void 0 : _b.trim();
174
177
  }
175
178
  if (!message) {
176
179
  const validationMessage = 'publish message may not be empty.';
@@ -183,7 +186,7 @@ class BranchPublish extends EasCommand_1.default {
183
186
  message: `Please enter a publication message.`,
184
187
  initial: republish
185
188
  ? `Republish "${oldMessage}" - group: ${group}`
186
- : (_c = (await vcs_1.default.getLastCommitMessageAsync())) === null || _c === void 0 ? void 0 : _c.trim(),
189
+ : (_c = (await (0, vcs_1.getVcsClient)().getLastCommitMessageAsync())) === null || _c === void 0 ? void 0 : _c.trim(),
187
190
  validate: value => (value ? true : validationMessage),
188
191
  }));
189
192
  }
@@ -295,50 +298,19 @@ BranchPublish.flags = {
295
298
  default: false,
296
299
  }),
297
300
  };
298
- function getRuntimeVersionObject(exp, platformFlag, projectDir) {
301
+ async function getRuntimeVersionObjectAsync(exp, platformFlag, projectDir) {
299
302
  var _a, _b;
300
- let { runtimeVersion: defaultRuntimeVersion, sdkVersion } = exp;
301
- // When a SDK version is supplied instead of a runtime version and we're in the managed workflow
302
- // construct the runtimeVersion with special meaning indicating that the runtime is an
303
- // Expo SDK preset runtime that can be launched in Expo Go.
304
- const isManagedProject = (0, config_1.getDefaultTarget)(projectDir) === 'managed';
305
- if (!defaultRuntimeVersion && sdkVersion && isManagedProject) {
306
- log_1.default.withTick('Generating runtime version from sdk version');
307
- defaultRuntimeVersion = (0, sdk_runtime_versions_1.getRuntimeVersionForSDKVersion)(sdkVersion);
308
- }
309
- const iOSRuntimeVersion = (_a = exp.ios) === null || _a === void 0 ? void 0 : _a.runtimeVersion; // TODO-JJ remove cast to any
310
- const androidRuntimeVersion = (_b = exp.android) === null || _b === void 0 ? void 0 : _b.runtimeVersion; // TODO-JJ remove cast to any
311
- let runtimeVersions;
312
- switch (platformFlag) {
313
- case 'ios': {
314
- runtimeVersions = {
315
- ios: iOSRuntimeVersion !== null && iOSRuntimeVersion !== void 0 ? iOSRuntimeVersion : defaultRuntimeVersion,
316
- };
317
- break;
318
- }
319
- case 'android': {
320
- runtimeVersions = {
321
- android: androidRuntimeVersion !== null && androidRuntimeVersion !== void 0 ? androidRuntimeVersion : defaultRuntimeVersion,
322
- };
323
- break;
324
- }
325
- case 'all': {
326
- runtimeVersions = {
327
- ios: iOSRuntimeVersion !== null && iOSRuntimeVersion !== void 0 ? iOSRuntimeVersion : defaultRuntimeVersion,
328
- android: androidRuntimeVersion !== null && androidRuntimeVersion !== void 0 ? androidRuntimeVersion : defaultRuntimeVersion,
329
- };
330
- break;
303
+ const platforms = (platformFlag === 'all' ? ['android', 'ios'] : [platformFlag]);
304
+ for (const platform of platforms) {
305
+ const isPolicy = typeof ((_b = (_a = exp[platform]) === null || _a === void 0 ? void 0 : _a.runtimeVersion) !== null && _b !== void 0 ? _b : exp.runtimeVersion) === 'object';
306
+ if (isPolicy) {
307
+ const isManaged = (await (0, workflow_1.resolveWorkflowAsync)(projectDir, platform)) === eas_build_job_1.Workflow.MANAGED;
308
+ if (!isManaged) {
309
+ throw new Error('Runtime version policies are only supported in the managed workflow.');
310
+ }
331
311
  }
332
- default:
333
- throw new Error('Platform flag must be "ios", "android", or "all"');
334
- }
335
- if (Object.values(runtimeVersions).some(runtime => !runtime)) {
336
- throw new Error("Couldn't find a 'runtimeVersion' for every platform. Please specify it under the 'expo' key in 'app.json'");
337
- }
338
- if (Object.values(runtimeVersions).some(runtime => typeof runtime !== 'string')) {
339
- throw new Error(`Please ensure that all of the runtime versions defined in the app.json are strings.`);
340
312
  }
341
- return runtimeVersions;
313
+ return Object.fromEntries(platforms.map(platform => [platform, config_plugins_1.Updates.getRuntimeVersion(exp, platform)]));
342
314
  }
343
315
  function formatUpdateTitle(update) {
344
316
  const { message, createdAt, actor, runtimeVersion } = update;
@@ -52,7 +52,7 @@ async function viewUpdateBranchAsync({ appId, name, }) {
52
52
  appId,
53
53
  name,
54
54
  limit: PAGE_LIMIT,
55
- })
55
+ }, { additionalTypenames: ['UpdateBranch', 'Update'] })
56
56
  .toPromise());
57
57
  return data;
58
58
  }
@@ -7,7 +7,7 @@ export default class Build extends EasCommand {
7
7
  'skip-credentials-check': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
8
8
  json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
9
9
  'skip-project-configuration': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
10
- profile: flags.IOptionFlag<string>;
10
+ profile: flags.IOptionFlag<string | undefined>;
11
11
  'non-interactive': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
12
12
  local: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
13
13
  wait: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;