eas-cli 0.55.0 → 0.57.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 (78) hide show
  1. package/README.md +58 -49
  2. package/build/branch/queries.d.ts +5 -0
  3. package/build/branch/queries.js +87 -0
  4. package/build/build/android/version.d.ts +5 -0
  5. package/build/build/android/version.js +16 -9
  6. package/build/build/build.js +7 -2
  7. package/build/build/context.d.ts +3 -3
  8. package/build/build/createContext.d.ts +4 -2
  9. package/build/build/createContext.js +3 -1
  10. package/build/build/ios/build.js +1 -16
  11. package/build/build/ios/syncProjectConfiguration.d.ts +3 -3
  12. package/build/build/ios/syncProjectConfiguration.js +2 -2
  13. package/build/build/ios/version.d.ts +10 -3
  14. package/build/build/ios/version.js +57 -28
  15. package/build/build/metadata.d.ts +1 -0
  16. package/build/build/metadata.js +15 -5
  17. package/build/build/runBuildAndSubmit.d.ts +1 -0
  18. package/build/build/runBuildAndSubmit.js +8 -4
  19. package/build/commandUtils/pagination.d.ts +13 -0
  20. package/build/commandUtils/pagination.js +42 -0
  21. package/build/commands/branch/list.d.ts +3 -4
  22. package/build/commands/branch/list.js +6 -69
  23. package/build/commands/branch/view.d.ts +3 -0
  24. package/build/commands/branch/view.js +15 -63
  25. package/build/commands/build/index.d.ts +1 -0
  26. package/build/commands/build/index.js +9 -0
  27. package/build/commands/build/version/set.d.ts +10 -0
  28. package/build/commands/build/version/set.js +82 -0
  29. package/build/commands/build/version/sync.d.ts +12 -0
  30. package/build/commands/build/version/sync.js +124 -0
  31. package/build/commands/update/index.d.ts +2 -2
  32. package/build/commands/update/index.js +13 -5
  33. package/build/commands/update/list.js +13 -18
  34. package/build/credentials/ios/actions/SetUpAdhocProvisioningProfile.js +2 -2
  35. package/build/credentials/ios/types.d.ts +2 -0
  36. package/build/devices/actions/create/action.d.ts +5 -2
  37. package/build/devices/actions/create/action.js +12 -2
  38. package/build/devices/actions/create/developerPortalMethod.d.ts +6 -0
  39. package/build/devices/actions/create/developerPortalMethod.js +90 -0
  40. package/build/devices/manager.js +4 -4
  41. package/build/graphql/generated.d.ts +271 -59
  42. package/build/graphql/generated.js +8 -1
  43. package/build/graphql/mutations/AppVersionMutation.d.ts +11 -0
  44. package/build/graphql/mutations/AppVersionMutation.js +28 -0
  45. package/build/graphql/queries/AppVersionQuery.d.ts +4 -0
  46. package/build/graphql/queries/AppVersionQuery.js +37 -0
  47. package/build/graphql/queries/BranchQuery.d.ts +2 -1
  48. package/build/graphql/queries/BranchQuery.js +26 -0
  49. package/build/graphql/queries/UpdateQuery.d.ts +6 -8
  50. package/build/graphql/queries/UpdateQuery.js +27 -23
  51. package/build/platform.d.ts +1 -0
  52. package/build/platform.js +17 -1
  53. package/build/project/android/applicationId.js +2 -2
  54. package/build/project/android/versions.d.ts +3 -0
  55. package/build/project/android/versions.js +23 -0
  56. package/build/project/applicationIdentifier.d.ts +4 -0
  57. package/build/project/applicationIdentifier.js +37 -0
  58. package/build/project/ios/bundleIdentifier.js +2 -2
  59. package/build/project/ios/target.js +14 -1
  60. package/build/project/ios/versions.d.ts +3 -0
  61. package/build/project/ios/versions.js +17 -0
  62. package/build/project/publish.d.ts +1 -2
  63. package/build/project/publish.js +8 -12
  64. package/build/project/remoteVersionSource.d.ts +6 -0
  65. package/build/project/remoteVersionSource.js +52 -0
  66. package/build/submit/utils/files.js +1 -1
  67. package/build/update/queries.d.ts +3 -0
  68. package/build/update/queries.js +72 -0
  69. package/build/update/utils.d.ts +14 -0
  70. package/build/update/utils.js +26 -9
  71. package/build/uploads.d.ts +4 -3
  72. package/build/uploads.js +11 -9
  73. package/build/utils/expodash/chunk.d.ts +1 -0
  74. package/build/utils/expodash/chunk.js +16 -0
  75. package/build/utils/queries.d.ts +25 -0
  76. package/build/utils/queries.js +67 -0
  77. package/oclif.manifest.json +1 -1
  78. package/package.json +10 -5
@@ -1,78 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const core_1 = require("@oclif/core");
5
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
- const cli_table3_1 = tslib_1.__importDefault(require("cli-table3"));
4
+ const queries_1 = require("../../branch/queries");
7
5
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
8
- const UpdateQuery_1 = require("../../graphql/queries/UpdateQuery");
9
- const log_1 = tslib_1.__importDefault(require("../../log"));
6
+ const pagination_1 = require("../../commandUtils/pagination");
10
7
  const expoConfig_1 = require("../../project/expoConfig");
11
8
  const projectUtils_1 = require("../../project/projectUtils");
12
- const prompts_1 = require("../../prompts");
13
- const utils_1 = require("../../update/utils");
14
- const groupBy_1 = tslib_1.__importDefault(require("../../utils/expodash/groupBy"));
15
- const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields"));
9
+ const queries_2 = require("../../update/queries");
16
10
  const json_1 = require("../../utils/json");
17
11
  class BranchView extends EasCommand_1.default {
18
12
  async runAsync() {
19
- let { args: { name }, flags: { json: jsonFlag }, } = await this.parse(BranchView);
20
- if (jsonFlag) {
13
+ let { args: { name: branchName }, flags, } = await this.parse(BranchView);
14
+ const options = (0, pagination_1.getPaginatedQueryOptions)(flags);
15
+ if (options.json) {
21
16
  (0, json_1.enableJsonOutput)();
22
17
  }
23
18
  const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
24
19
  const exp = (0, expoConfig_1.getExpoConfig)(projectDir);
25
20
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
26
- if (!name) {
27
- const validationMessage = 'Branch name may not be empty.';
28
- if (jsonFlag) {
29
- throw new Error(validationMessage);
21
+ // provide help to a user if they ran the command with missing args
22
+ if (!branchName) {
23
+ if (options.nonInteractive) {
24
+ throw new Error('Branch name may not be empty.');
30
25
  }
31
- ({ name } = await (0, prompts_1.promptAsync)({
32
- type: 'text',
33
- name: 'name',
34
- message: 'Please enter the name of the branch to view:',
35
- validate: value => (value ? true : validationMessage),
36
- }));
37
- }
38
- const { app } = await UpdateQuery_1.UpdateQuery.viewBranchAsync({
39
- appId: projectId,
40
- name,
41
- });
42
- const UpdateBranch = app === null || app === void 0 ? void 0 : app.byId.updateBranchByName;
43
- if (!UpdateBranch) {
44
- throw new Error(`Could not find branch "${name}"`);
45
- }
46
- const updates = Object.values((0, groupBy_1.default)(UpdateBranch.updates, u => u.group)).map(group => group[0]);
47
- if (jsonFlag) {
48
- (0, json_1.printJsonOnlyOutput)({ ...UpdateBranch, updates });
49
- }
50
- else {
51
- const groupTable = new cli_table3_1.default({
52
- head: utils_1.UPDATE_COLUMNS,
53
- wordWrap: true,
54
- });
55
- for (const update of updates) {
56
- groupTable.push([
57
- (0, utils_1.formatUpdate)(update),
58
- update.runtimeVersion,
59
- update.group,
60
- (0, utils_1.getPlatformsForGroup)({
61
- updates: UpdateBranch.updates,
62
- group: update.group,
63
- }),
64
- ]);
65
- }
66
- log_1.default.addNewLineIfNone();
67
- log_1.default.log(chalk_1.default.bold('Branch:'));
68
- log_1.default.log((0, formatFields_1.default)([
69
- { label: 'Name', value: UpdateBranch.name },
70
- { label: 'ID', value: UpdateBranch.id },
71
- ]));
72
- log_1.default.addNewLineIfNone();
73
- log_1.default.log(chalk_1.default.bold('Recently published update groups:'));
74
- log_1.default.log(groupTable.toString());
26
+ ({ name: branchName } = await (0, queries_1.selectBranchFromPaginatedQueryAsync)(projectId, 'Which branch would you like to view?',
27
+ // discard limit and offset because this query is not those flag's intended target
28
+ { json: options.json, nonInteractive: options.nonInteractive, offset: 0 }));
75
29
  }
30
+ await (0, queries_2.listAndRenderUpdatesOnBranchByNameAsync)(projectId, branchName, options);
76
31
  }
77
32
  }
78
33
  exports.default = BranchView;
@@ -85,8 +40,5 @@ BranchView.args = [
85
40
  },
86
41
  ];
87
42
  BranchView.flags = {
88
- json: core_1.Flags.boolean({
89
- description: `return a json with the branch's ID name and recent update groups.`,
90
- default: false,
91
- }),
43
+ ...pagination_1.EasPaginatedQueryFlags,
92
44
  };
@@ -16,6 +16,7 @@ export default class Build extends EasCommand {
16
16
  'auto-submit': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
17
  'auto-submit-with-profile': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
18
18
  'resource-class': import("@oclif/core/lib/interfaces").OptionFlag<UserInputResourceClass>;
19
+ message: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
19
20
  };
20
21
  runAsync(): Promise<void>;
21
22
  private sanitizeFlagsAsync;
@@ -55,6 +55,10 @@ class Build extends EasCommand_1.default {
55
55
  log_1.default.warnDeprecatedFlag('skip-project-configuration', 'Automatic configuration of native code is no longer optional.');
56
56
  log_1.default.newLine();
57
57
  }
58
+ const message = flags['message'];
59
+ if (message && message.length > 1024) {
60
+ core_1.Errors.error('Message cannot be longer than 1024 characters.', { exit: 1 });
61
+ }
58
62
  const profile = flags['profile'];
59
63
  return {
60
64
  requestedPlatform,
@@ -75,6 +79,7 @@ class Build extends EasCommand_1.default {
75
79
  autoSubmit: flags['auto-submit'] || flags['auto-submit-with-profile'] !== undefined,
76
80
  submitProfile: (_a = flags['auto-submit-with-profile']) !== null && _a !== void 0 ? _a : profile,
77
81
  userInputResourceClass: (_b = flags['resource-class']) !== null && _b !== void 0 ? _b : types_1.UserInputResourceClass.DEFAULT,
82
+ message,
78
83
  };
79
84
  }
80
85
  }
@@ -136,4 +141,8 @@ Build.flags = {
136
141
  hidden: true,
137
142
  description: 'The instance type that will be used to run this build [experimental]',
138
143
  }),
144
+ message: core_1.Flags.string({
145
+ char: 'm',
146
+ description: 'A short message describing the build',
147
+ }),
139
148
  };
@@ -0,0 +1,10 @@
1
+ import EasCommand from '../../../commandUtils/EasCommand';
2
+ export default class BuildVersionSetView extends EasCommand {
3
+ static description: string;
4
+ static hidden: boolean;
5
+ static flags: {
6
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
7
+ profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
8
+ };
9
+ runAsync(): Promise<void>;
10
+ }
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const Updates_1 = require("@expo/config-plugins/build/utils/Updates");
5
+ const eas_build_job_1 = require("@expo/eas-build-job");
6
+ const eas_json_1 = require("@expo/eas-json");
7
+ const core_1 = require("@oclif/core");
8
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
9
+ const EasCommand_1 = tslib_1.__importDefault(require("../../../commandUtils/EasCommand"));
10
+ const AppVersionMutation_1 = require("../../../graphql/mutations/AppVersionMutation");
11
+ const AppVersionQuery_1 = require("../../../graphql/queries/AppVersionQuery");
12
+ const AppPlatform_1 = require("../../../graphql/types/AppPlatform");
13
+ const log_1 = tslib_1.__importDefault(require("../../../log"));
14
+ const platform_1 = require("../../../platform");
15
+ const versions_1 = require("../../../project/android/versions");
16
+ const applicationIdentifier_1 = require("../../../project/applicationIdentifier");
17
+ const expoConfig_1 = require("../../../project/expoConfig");
18
+ const versions_2 = require("../../../project/ios/versions");
19
+ const projectUtils_1 = require("../../../project/projectUtils");
20
+ const remoteVersionSource_1 = require("../../../project/remoteVersionSource");
21
+ const prompts_1 = require("../../../prompts");
22
+ class BuildVersionSetView extends EasCommand_1.default {
23
+ async runAsync() {
24
+ var _a, _b, _c;
25
+ const { flags } = await this.parse(BuildVersionSetView);
26
+ const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
27
+ const platform = await (0, platform_1.selectPlatformAsync)(flags.platform);
28
+ const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
29
+ await (0, remoteVersionSource_1.ensureRemoteVersionPolicyAsync)(projectDir, easJsonReader);
30
+ const profile = await easJsonReader.getBuildProfileAsync(platform, (_a = flags.profile) !== null && _a !== void 0 ? _a : undefined);
31
+ const exp = (0, expoConfig_1.getExpoConfig)(projectDir, { env: profile.env });
32
+ const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
33
+ const projectFullName = await (0, projectUtils_1.getProjectFullNameAsync)(exp);
34
+ await (0, remoteVersionSource_1.validateAppConfigForRemoteVersionPolicyAsync)(exp);
35
+ const applicationIdentifier = await (0, applicationIdentifier_1.getApplicationIdentifierAsync)(projectDir, exp, profile, platform);
36
+ const remoteVersions = await AppVersionQuery_1.AppVersionQuery.latestVersionAsync(projectId, (0, AppPlatform_1.toAppPlatform)(platform), applicationIdentifier);
37
+ const currentStateMessage = (remoteVersions === null || remoteVersions === void 0 ? void 0 : remoteVersions.buildVersion)
38
+ ? `Project ${chalk_1.default.bold(projectFullName)} with ${getApplicationIdentifierName(platform)} "${applicationIdentifier}" is configured with ${(0, remoteVersionSource_1.getBuildVersionName)(platform)} ${remoteVersions.buildVersion}.`
39
+ : `Project ${chalk_1.default.bold(projectFullName)} with ${getApplicationIdentifierName(platform)} "${applicationIdentifier}" does not have any ${(0, remoteVersionSource_1.getBuildVersionName)(platform)} configured.`;
40
+ const versionPromptMessage = (remoteVersions === null || remoteVersions === void 0 ? void 0 : remoteVersions.buildVersion)
41
+ ? `What version would you like to set?`
42
+ : `What version would you like to initialize it with?`;
43
+ log_1.default.log(currentStateMessage);
44
+ const { version } = await (0, prompts_1.promptAsync)({
45
+ type: platform === eas_build_job_1.Platform.ANDROID ? 'number' : 'text',
46
+ name: 'version',
47
+ message: versionPromptMessage,
48
+ validate: platform === eas_build_job_1.Platform.ANDROID
49
+ ? value => (0, versions_1.isValidVersionCode)(value) || `Invalid value: ${versions_1.VERSION_CODE_REQUIREMENTS}.`
50
+ : value => (0, versions_2.isValidBuildNumber)(value) || `Invalid value: ${versions_2.BUILD_NUMBER_REQUIREMENTS}.`,
51
+ });
52
+ await AppVersionMutation_1.AppVersionMutation.createAppVersionAsync({
53
+ appId: projectId,
54
+ platform: (0, AppPlatform_1.toAppPlatform)(platform),
55
+ applicationIdentifier,
56
+ storeVersion: (_b = exp.version) !== null && _b !== void 0 ? _b : '1.0.0',
57
+ buildVersion: String(version),
58
+ runtimeVersion: (_c = (0, Updates_1.getRuntimeVersionNullable)(exp, platform)) !== null && _c !== void 0 ? _c : undefined,
59
+ });
60
+ }
61
+ }
62
+ exports.default = BuildVersionSetView;
63
+ BuildVersionSetView.description = 'Update version of an app.';
64
+ BuildVersionSetView.hidden = true;
65
+ BuildVersionSetView.flags = {
66
+ platform: core_1.Flags.enum({
67
+ char: 'p',
68
+ options: ['android', 'ios'],
69
+ }),
70
+ profile: core_1.Flags.string({
71
+ description: 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
72
+ helpValue: 'PROFILE_NAME',
73
+ }),
74
+ };
75
+ function getApplicationIdentifierName(platform) {
76
+ if (platform === eas_build_job_1.Platform.ANDROID) {
77
+ return 'application ID';
78
+ }
79
+ else {
80
+ return 'bundle identifier';
81
+ }
82
+ }
@@ -0,0 +1,12 @@
1
+ import EasCommand from '../../../commandUtils/EasCommand';
2
+ export default class BuildVersionSyncView extends EasCommand {
3
+ static description: string;
4
+ static hidden: boolean;
5
+ static flags: {
6
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
7
+ profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
8
+ };
9
+ runAsync(): Promise<void>;
10
+ private syncIosAsync;
11
+ private syncAndroidAsync;
12
+ }
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const eas_build_job_1 = require("@expo/eas-build-job");
5
+ const eas_json_1 = require("@expo/eas-json");
6
+ const core_1 = require("@oclif/core");
7
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
8
+ const version_1 = require("../../../build/android/version");
9
+ const version_2 = require("../../../build/ios/version");
10
+ const EasCommand_1 = tslib_1.__importDefault(require("../../../commandUtils/EasCommand"));
11
+ const AppVersionQuery_1 = require("../../../graphql/queries/AppVersionQuery");
12
+ const AppPlatform_1 = require("../../../graphql/types/AppPlatform");
13
+ const log_1 = tslib_1.__importDefault(require("../../../log"));
14
+ const platform_1 = require("../../../platform");
15
+ const gradleUtils_1 = require("../../../project/android/gradleUtils");
16
+ const versions_1 = require("../../../project/android/versions");
17
+ const applicationIdentifier_1 = require("../../../project/applicationIdentifier");
18
+ const expoConfig_1 = require("../../../project/expoConfig");
19
+ const scheme_1 = require("../../../project/ios/scheme");
20
+ const target_1 = require("../../../project/ios/target");
21
+ const versions_2 = require("../../../project/ios/versions");
22
+ const projectUtils_1 = require("../../../project/projectUtils");
23
+ const remoteVersionSource_1 = require("../../../project/remoteVersionSource");
24
+ const workflow_1 = require("../../../project/workflow");
25
+ const profiles_1 = require("../../../utils/profiles");
26
+ class BuildVersionSyncView extends EasCommand_1.default {
27
+ async runAsync() {
28
+ var _a;
29
+ const { flags } = await this.parse(BuildVersionSyncView);
30
+ const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
31
+ const requestedPlatform = await (0, platform_1.selectRequestedPlatformAsync)(flags.platform);
32
+ const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
33
+ await (0, remoteVersionSource_1.ensureRemoteVersionPolicyAsync)(projectDir, easJsonReader);
34
+ const platforms = (0, platform_1.toPlatforms)(requestedPlatform);
35
+ const buildProfiles = await (0, profiles_1.getProfilesAsync)({
36
+ type: 'build',
37
+ easJsonReader,
38
+ platforms,
39
+ profileName: (_a = flags.profile) !== null && _a !== void 0 ? _a : undefined,
40
+ });
41
+ for (const profileInfo of buildProfiles) {
42
+ const exp = (0, expoConfig_1.getExpoConfig)(projectDir, { env: profileInfo.profile.env });
43
+ const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
44
+ await (0, remoteVersionSource_1.validateAppConfigForRemoteVersionPolicyAsync)(exp);
45
+ const platformDisplayName = platform_1.appPlatformDisplayNames[(0, AppPlatform_1.toAppPlatform)(profileInfo.platform)];
46
+ const applicationIdentifier = await (0, applicationIdentifier_1.getApplicationIdentifierAsync)(projectDir, exp, profileInfo.profile, profileInfo.platform);
47
+ const remoteVersions = await AppVersionQuery_1.AppVersionQuery.latestVersionAsync(projectId, (0, AppPlatform_1.toAppPlatform)(profileInfo.platform), applicationIdentifier);
48
+ const workflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, profileInfo.platform);
49
+ if (!(remoteVersions === null || remoteVersions === void 0 ? void 0 : remoteVersions.buildVersion)) {
50
+ log_1.default.warn(`Skipping versions sync for ${platformDisplayName}. There are no versions configured on Expo servers, use "eas build:version:set" or run a build to initialize it.`);
51
+ continue;
52
+ }
53
+ if (workflow === eas_build_job_1.Workflow.MANAGED) {
54
+ log_1.default.warn(`The remote value for the ${platformDisplayName} ${(0, remoteVersionSource_1.getBuildVersionName)(profileInfo.platform)} is ${chalk_1.default.bold(remoteVersions === null || remoteVersions === void 0 ? void 0 : remoteVersions.buildVersion)}, but it was not synced to the local project. This command has no effect on projects using managed workflow.`);
55
+ continue;
56
+ }
57
+ if (profileInfo.platform === eas_build_job_1.Platform.ANDROID) {
58
+ this.syncAndroidAsync({
59
+ projectDir,
60
+ exp,
61
+ profile: profileInfo.profile,
62
+ workflow,
63
+ buildVersion: remoteVersions.buildVersion,
64
+ });
65
+ }
66
+ else {
67
+ this.syncIosAsync({
68
+ projectDir,
69
+ exp,
70
+ profile: profileInfo.profile,
71
+ workflow,
72
+ buildVersion: remoteVersions.buildVersion,
73
+ });
74
+ }
75
+ log_1.default.withTick(`Successfully updated the ${platformDisplayName} ${(0, remoteVersionSource_1.getBuildVersionName)(profileInfo.platform)} in native code to ${chalk_1.default.bold(remoteVersions === null || remoteVersions === void 0 ? void 0 : remoteVersions.buildVersion)}.`);
76
+ }
77
+ }
78
+ async syncIosAsync({ workflow, projectDir, exp, profile, buildVersion, }) {
79
+ const xcodeBuildContext = await (0, scheme_1.resolveXcodeBuildContextAsync)({ exp, projectDir, nonInteractive: false }, profile);
80
+ const targets = await (0, target_1.resolveTargetsAsync)({
81
+ projectDir,
82
+ exp,
83
+ xcodeBuildContext,
84
+ env: profile.env,
85
+ });
86
+ if (!(0, versions_2.isValidBuildNumber)(buildVersion)) {
87
+ throw new Error(`Invalid buildNumber (${buildVersion}), ${versions_2.BUILD_NUMBER_REQUIREMENTS}.`);
88
+ }
89
+ if (workflow === eas_build_job_1.Workflow.GENERIC) {
90
+ await (0, version_2.updateNativeVersionsAsync)({
91
+ projectDir,
92
+ buildNumber: buildVersion,
93
+ targets,
94
+ });
95
+ }
96
+ }
97
+ async syncAndroidAsync({ projectDir, workflow, buildVersion, }) {
98
+ var _a, _b;
99
+ if (!(0, versions_1.isValidVersionCode)(buildVersion)) {
100
+ throw new Error(`Invalid versionCode (${buildVersion}), ${versions_1.VERSION_CODE_REQUIREMENTS}.`);
101
+ }
102
+ if (workflow === eas_build_job_1.Workflow.GENERIC) {
103
+ const buildGradle = await (0, gradleUtils_1.getAppBuildGradleAsync)(projectDir);
104
+ const isMultiFlavor = ((_a = buildGradle.android) === null || _a === void 0 ? void 0 : _a.productFlavors) || ((_b = buildGradle.android) === null || _b === void 0 ? void 0 : _b.flavorDimensions);
105
+ if (isMultiFlavor) {
106
+ throw new Error("Versions in native code can't be automatically synced in multi-flavor Android projects. If you are using EAS Build with app version source set to remote, the correct values will be injected at the build time.");
107
+ }
108
+ await (0, version_1.updateNativeVersionsAsync)({ projectDir, versionCode: Number(buildVersion) });
109
+ }
110
+ }
111
+ }
112
+ exports.default = BuildVersionSyncView;
113
+ BuildVersionSyncView.description = 'Update a version in native code with a value stored on EAS servers';
114
+ BuildVersionSyncView.hidden = true;
115
+ BuildVersionSyncView.flags = {
116
+ platform: core_1.Flags.enum({
117
+ char: 'p',
118
+ options: ['android', 'ios', 'all'],
119
+ }),
120
+ profile: core_1.Flags.string({
121
+ description: 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
122
+ helpValue: 'PROFILE_NAME',
123
+ }),
124
+ };
@@ -6,8 +6,8 @@ export declare type PublishPlatformFlag = PublishPlatform | 'all';
6
6
  export declare function ensureBranchExistsAsync({ appId, name: branchName, limit, offset, }: {
7
7
  appId: string;
8
8
  name: string;
9
- limit?: number;
10
- offset?: number;
9
+ limit: number;
10
+ offset: number;
11
11
  }): Promise<{
12
12
  id: string;
13
13
  updates: Exclude<Exclude<ViewBranchUpdatesQuery['app'], null | undefined>['byId']['updateBranchByName'], null | undefined>['updates'];
@@ -11,11 +11,13 @@ const dateformat_1 = tslib_1.__importDefault(require("dateformat"));
11
11
  const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
12
12
  const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
13
13
  const api_1 = require("../../api");
14
+ const queries_1 = require("../../branch/queries");
14
15
  const url_1 = require("../../build/utils/url");
15
16
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
16
17
  const fetch_1 = tslib_1.__importDefault(require("../../fetch"));
17
18
  const client_1 = require("../../graphql/client");
18
19
  const PublishMutation_1 = require("../../graphql/mutations/PublishMutation");
20
+ const BranchQuery_1 = require("../../graphql/queries/BranchQuery");
19
21
  const UpdateQuery_1 = require("../../graphql/queries/UpdateQuery");
20
22
  const log_1 = tslib_1.__importStar(require("../../log"));
21
23
  const ora_1 = require("../../ora");
@@ -32,7 +34,6 @@ const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields
32
34
  const json_1 = require("../../utils/json");
33
35
  const vcs_1 = require("../../vcs");
34
36
  const create_1 = require("../branch/create");
35
- const list_1 = require("../branch/list");
36
37
  const create_2 = require("../channel/create");
37
38
  exports.defaultPublishPlatforms = ['android', 'ios'];
38
39
  async function getUpdateGroupAsync({ group, }) {
@@ -143,7 +144,11 @@ class UpdatePublish extends EasCommand_1.default {
143
144
  if (jsonFlag) {
144
145
  throw new Error(validationMessage);
145
146
  }
146
- const branches = await (0, list_1.listBranchesAsync)({ projectId });
147
+ const branches = await BranchQuery_1.BranchQuery.listBranchesAsync({
148
+ appId: projectId,
149
+ limit: queries_1.BRANCHES_LIMIT,
150
+ offset: 0,
151
+ });
147
152
  if (branches.length === 0) {
148
153
  ({ name: branchName } = await (0, prompts_1.promptAsync)({
149
154
  type: 'text',
@@ -265,7 +270,9 @@ class UpdatePublish extends EasCommand_1.default {
265
270
  try {
266
271
  const platforms = platformFlag === 'all' ? exports.defaultPublishPlatforms : [platformFlag];
267
272
  const assets = await (0, publish_1.collectAssetsAsync)({ inputDir: inputDir, platforms });
268
- const { uniqueUploadedAssetCount } = await (0, publish_1.uploadAssetsAsync)(assets, spinnerText => (assetSpinner.text = `Uploading assets... ${spinnerText}`));
273
+ const { uniqueUploadedAssetCount } = await (0, publish_1.uploadAssetsAsync)(assets, (totalAssets, missingAssets) => {
274
+ assetSpinner.text = `Uploading assets. Finished (${totalAssets - missingAssets}/${totalAssets})`;
275
+ });
269
276
  uploadedAssetCount = uniqueUploadedAssetCount;
270
277
  unsortedUpdateInfoGroups = await (0, publish_1.buildUnsortedUpdateInfoGroupAsync)(assets, exp);
271
278
  const uploadAssetSuccessMessage = uploadedAssetCount
@@ -289,6 +296,7 @@ class UpdatePublish extends EasCommand_1.default {
289
296
  appId: projectId,
290
297
  name: branchName,
291
298
  limit: 0,
299
+ offset: 0,
292
300
  });
293
301
  // Sort the updates into different groups based on their platform specific runtime versions
294
302
  const updateGroups = Object.entries(runtimeToPlatformMapping).map(([runtime, platforms]) => {
@@ -355,7 +363,7 @@ class UpdatePublish extends EasCommand_1.default {
355
363
  log_1.default.addNewLineIfNone();
356
364
  for (const runtime of new Set(Object.values(runtimeVersions))) {
357
365
  const newUpdatesForRuntimeVersion = newUpdates.filter(update => update.runtimeVersion === runtime);
358
- if (!newUpdatesForRuntimeVersion.length) {
366
+ if (newUpdatesForRuntimeVersion.length === 0) {
359
367
  throw new Error(`Publish response is missing updates with runtime ${runtime}.`);
360
368
  }
361
369
  const platforms = newUpdatesForRuntimeVersion.map(update => update.platform);
@@ -457,7 +465,7 @@ async function getUpdatesToRepublishInteractiveAsync(projectId, branchName, plat
457
465
  title: formatUpdateTitle(update),
458
466
  value: update.group,
459
467
  }));
460
- if (!updateGroups.length) {
468
+ if (updateGroups.length === 0) {
461
469
  throw new Error(`There are no updates on branch "${branchName}" published for the platform(s) ${platformFlag}. Did you mean to publish a new update instead?`);
462
470
  }
463
471
  if (updates.length > pageSize) {
@@ -11,8 +11,8 @@ const log_1 = tslib_1.__importDefault(require("../../log"));
11
11
  const expoConfig_1 = require("../../project/expoConfig");
12
12
  const projectUtils_1 = require("../../project/projectUtils");
13
13
  const prompts_1 = require("../../prompts");
14
+ const queries_1 = require("../../update/queries");
14
15
  const utils_1 = require("../../update/utils");
15
- const groupBy_1 = tslib_1.__importDefault(require("../../utils/expodash/groupBy"));
16
16
  const json_1 = require("../../utils/json");
17
17
  const vcs_1 = require("../../vcs");
18
18
  class BranchView extends EasCommand_1.default {
@@ -27,8 +27,15 @@ class BranchView extends EasCommand_1.default {
27
27
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
28
28
  let updateGroupDescriptions;
29
29
  if (all) {
30
- const branchesAndUpdates = await UpdateQuery_1.UpdateQuery.viewAllAsync({ appId: projectId });
31
- updateGroupDescriptions = getUpdateGroupDescriptions(branchesAndUpdates.app.byId.updateBranches);
30
+ const branchesAndUpdates = await UpdateQuery_1.UpdateQuery.viewAllAsync({
31
+ appId: projectId,
32
+ limit: queries_1.UPDATES_LIMIT,
33
+ offset: 0,
34
+ });
35
+ updateGroupDescriptions = (0, utils_1.getUpdateGroupsWithPlatforms)(branchesAndUpdates.app.byId.updates.map(update => ({
36
+ ...update,
37
+ branch: update.branch.name,
38
+ }))).sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
32
39
  }
33
40
  else {
34
41
  let branchInteractive;
@@ -50,12 +57,14 @@ class BranchView extends EasCommand_1.default {
50
57
  const branchesAndUpdates = await UpdateQuery_1.UpdateQuery.viewBranchAsync({
51
58
  appId: projectId,
52
59
  name: branch,
60
+ limit: queries_1.UPDATES_LIMIT,
61
+ offset: 0,
53
62
  });
54
63
  const UpdateBranch = (_b = branchesAndUpdates.app) === null || _b === void 0 ? void 0 : _b.byId.updateBranchByName;
55
64
  if (!UpdateBranch) {
56
65
  throw new Error(`Could not find branch "${branch}"`);
57
66
  }
58
- updateGroupDescriptions = getUpdateGroupDescriptions([UpdateBranch]);
67
+ updateGroupDescriptions = (0, utils_1.getUpdateGroupsWithPlatforms)(UpdateBranch.updates.map(update => ({ ...update, branch }))).sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
59
68
  }
60
69
  if (jsonFlag) {
61
70
  (0, json_1.printJsonOnlyOutput)(updateGroupDescriptions);
@@ -82,20 +91,6 @@ BranchView.flags = {
82
91
  default: false,
83
92
  }),
84
93
  };
85
- function getUpdateGroupDescriptions(branchesAndUpdates) {
86
- const flattenedBranchesAndUpdates = branchesAndUpdates.flatMap(branch => branch.updates.map(update => {
87
- return { branch: branch.name, ...update };
88
- }));
89
- const updateGroupDescriptions = Object.values((0, groupBy_1.default)(flattenedBranchesAndUpdates, update => update.group)).map(updateGroup => {
90
- const platforms = updateGroup
91
- .map(update => update.platform)
92
- .sort()
93
- .join(', ');
94
- return { ...updateGroup[0], platforms };
95
- });
96
- updateGroupDescriptions.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
97
- return updateGroupDescriptions;
98
- }
99
94
  function logAsTable(updateGroupDescriptions) {
100
95
  const table = new cli_table3_1.default({
101
96
  head: ['Branch', ...utils_1.UPDATE_COLUMNS],
@@ -170,10 +170,10 @@ class SetUpAdhocProvisioningProfile {
170
170
  return selected;
171
171
  }
172
172
  async registerDevicesAsync(ctx, appleTeam) {
173
- const action = new action_1.default(this.app.account, appleTeam);
173
+ const action = new action_1.default(ctx.appStore, this.app.account, appleTeam);
174
174
  const method = await action.runAsync();
175
175
  while (true) {
176
- if (method !== action_1.RegistrationMethod.INPUT) {
176
+ if (method === action_1.RegistrationMethod.WEBSITE) {
177
177
  log_1.default.newLine();
178
178
  log_1.default.log(chalk_1.default.bold("Press any key if you've already finished device registration."));
179
179
  await (0, prompts_1.pressAnyKeyToContinueAsync)();
@@ -1,4 +1,5 @@
1
1
  import { JSONObject } from '@expo/json-file';
2
+ import type { XCBuildConfiguration } from 'xcode';
2
3
  import { CommonIosAppCredentialsFragment, IosAppBuildCredentialsFragment } from '../../graphql/generated';
3
4
  import { Account } from '../../user/Account';
4
5
  export interface App {
@@ -11,6 +12,7 @@ export interface Target {
11
12
  bundleIdentifier: string;
12
13
  parentBundleIdentifier?: string;
13
14
  entitlements: JSONObject;
15
+ buildSettings?: XCBuildConfiguration['buildSettings'];
14
16
  }
15
17
  export interface TargetCredentials {
16
18
  distributionCertificate: {
@@ -1,14 +1,17 @@
1
+ import AppStoreApi from '../../../credentials/ios/appstore/AppStoreApi';
1
2
  import { AppleTeam } from '../../../graphql/generated';
2
3
  import { Account } from '../../../user/Account';
3
4
  export declare enum RegistrationMethod {
4
5
  WEBSITE = 0,
5
6
  INPUT = 1,
6
- EXIT = 2
7
+ DEVELOPER_PORTAL = 2,
8
+ EXIT = 3
7
9
  }
8
10
  export default class DeviceCreateAction {
11
+ private appStoreApi;
9
12
  private account;
10
13
  private appleTeam;
11
- constructor(account: Account, appleTeam: Pick<AppleTeam, 'appleTeamIdentifier' | 'appleTeamName' | 'id'>);
14
+ constructor(appStoreApi: AppStoreApi, account: Account, appleTeam: Pick<AppleTeam, 'appleTeamIdentifier' | 'appleTeamName' | 'id'>);
12
15
  runAsync(): Promise<RegistrationMethod>;
13
16
  private askForRegistrationMethodAsync;
14
17
  }
@@ -5,16 +5,19 @@ const tslib_1 = require("tslib");
5
5
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
6
  const log_1 = tslib_1.__importDefault(require("../../../log"));
7
7
  const prompts_1 = require("../../../prompts");
8
+ const developerPortalMethod_1 = require("./developerPortalMethod");
8
9
  const inputMethod_1 = require("./inputMethod");
9
10
  const registrationUrlMethod_1 = require("./registrationUrlMethod");
10
11
  var RegistrationMethod;
11
12
  (function (RegistrationMethod) {
12
13
  RegistrationMethod[RegistrationMethod["WEBSITE"] = 0] = "WEBSITE";
13
14
  RegistrationMethod[RegistrationMethod["INPUT"] = 1] = "INPUT";
14
- RegistrationMethod[RegistrationMethod["EXIT"] = 2] = "EXIT";
15
+ RegistrationMethod[RegistrationMethod["DEVELOPER_PORTAL"] = 2] = "DEVELOPER_PORTAL";
16
+ RegistrationMethod[RegistrationMethod["EXIT"] = 3] = "EXIT";
15
17
  })(RegistrationMethod = exports.RegistrationMethod || (exports.RegistrationMethod = {}));
16
18
  class DeviceCreateAction {
17
- constructor(account, appleTeam) {
19
+ constructor(appStoreApi, account, appleTeam) {
20
+ this.appStoreApi = appStoreApi;
18
21
  this.account = account;
19
22
  this.appleTeam = appleTeam;
20
23
  }
@@ -23,6 +26,9 @@ class DeviceCreateAction {
23
26
  if (method === RegistrationMethod.WEBSITE) {
24
27
  await (0, registrationUrlMethod_1.runRegistrationUrlMethodAsync)(this.account.id, this.appleTeam);
25
28
  }
29
+ else if (method === RegistrationMethod.DEVELOPER_PORTAL) {
30
+ await (0, developerPortalMethod_1.runDeveloperPortalMethodAsync)(this.appStoreApi, this.account.id, this.appleTeam);
31
+ }
26
32
  else if (method === RegistrationMethod.INPUT) {
27
33
  await (0, inputMethod_1.runInputMethodAsync)(this.account.id, this.appleTeam);
28
34
  }
@@ -42,6 +48,10 @@ class DeviceCreateAction {
42
48
  title: `${chalk_1.default.bold('Website')} - generates a registration URL to be opened on your devices`,
43
49
  value: RegistrationMethod.WEBSITE,
44
50
  },
51
+ {
52
+ title: `${chalk_1.default.bold('Developer Portal')} - import devices already registered on Apple Developer Portal`,
53
+ value: RegistrationMethod.DEVELOPER_PORTAL,
54
+ },
45
55
  {
46
56
  title: `${chalk_1.default.bold('Input')} - allows you to type in UDIDs (advanced option)`,
47
57
  value: RegistrationMethod.INPUT,
@@ -0,0 +1,6 @@
1
+ /// <reference types="@expo/apple-utils/ts-declarations/expo__app-store" />
2
+ import { Device } from '@expo/apple-utils';
3
+ import AppStoreApi from '../../../credentials/ios/appstore/AppStoreApi';
4
+ import { AppleTeam } from '../../../graphql/generated';
5
+ export declare function runDeveloperPortalMethodAsync(appStoreApi: AppStoreApi, accountId: string, appleTeam: Pick<AppleTeam, 'appleTeamIdentifier' | 'appleTeamName' | 'id'>): Promise<void>;
6
+ export declare function formatDeviceLabel(device: Device): string;