eas-cli 0.55.1 → 0.58.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 (113) 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/build.js +17 -3
  5. package/build/build/android/graphql.js +2 -0
  6. package/build/build/android/prepareJob.js +5 -0
  7. package/build/build/android/syncProjectConfiguration.d.ts +3 -4
  8. package/build/build/android/syncProjectConfiguration.js +2 -3
  9. package/build/build/android/version.d.ts +16 -0
  10. package/build/build/android/version.js +86 -9
  11. package/build/build/build.js +8 -3
  12. package/build/build/context.d.ts +7 -3
  13. package/build/build/createContext.d.ts +5 -2
  14. package/build/build/createContext.js +9 -1
  15. package/build/build/ios/build.js +18 -17
  16. package/build/build/ios/graphql.js +2 -0
  17. package/build/build/ios/prepareJob.js +5 -0
  18. package/build/build/ios/syncProjectConfiguration.d.ts +5 -6
  19. package/build/build/ios/syncProjectConfiguration.js +3 -4
  20. package/build/build/ios/version.d.ts +23 -3
  21. package/build/build/ios/version.js +128 -28
  22. package/build/build/local.d.ts +2 -2
  23. package/build/build/local.js +7 -7
  24. package/build/build/metadata.d.ts +1 -0
  25. package/build/build/metadata.js +32 -6
  26. package/build/build/runBuildAndSubmit.d.ts +1 -0
  27. package/build/build/runBuildAndSubmit.js +29 -7
  28. package/build/build/utils/printBuildInfo.d.ts +1 -1
  29. package/build/build/utils/printBuildInfo.js +7 -13
  30. package/build/commandUtils/pagination.d.ts +13 -0
  31. package/build/commandUtils/pagination.js +42 -0
  32. package/build/commands/branch/list.d.ts +3 -4
  33. package/build/commands/branch/list.js +6 -69
  34. package/build/commands/branch/view.d.ts +3 -0
  35. package/build/commands/branch/view.js +15 -63
  36. package/build/commands/build/index.d.ts +1 -0
  37. package/build/commands/build/index.js +9 -0
  38. package/build/commands/build/version/set.d.ts +9 -0
  39. package/build/commands/build/version/set.js +81 -0
  40. package/build/commands/build/version/sync.d.ts +11 -0
  41. package/build/commands/build/version/sync.js +123 -0
  42. package/build/commands/submit.js +4 -1
  43. package/build/commands/update/index.d.ts +2 -2
  44. package/build/commands/update/index.js +24 -6
  45. package/build/commands/update/list.js +13 -18
  46. package/build/credentials/ios/actions/SetUpAdhocProvisioningProfile.js +2 -2
  47. package/build/credentials/ios/types.d.ts +2 -0
  48. package/build/devices/actions/create/action.d.ts +5 -2
  49. package/build/devices/actions/create/action.js +12 -2
  50. package/build/devices/actions/create/developerPortalMethod.d.ts +6 -0
  51. package/build/devices/actions/create/developerPortalMethod.js +90 -0
  52. package/build/devices/manager.js +4 -4
  53. package/build/graphql/generated.d.ts +501 -59
  54. package/build/graphql/generated.js +10 -1
  55. package/build/graphql/mutations/AppVersionMutation.d.ts +11 -0
  56. package/build/graphql/mutations/AppVersionMutation.js +28 -0
  57. package/build/graphql/mutations/PublishMutation.d.ts +2 -4
  58. package/build/graphql/queries/AppVersionQuery.d.ts +4 -0
  59. package/build/graphql/queries/AppVersionQuery.js +37 -0
  60. package/build/graphql/queries/BranchQuery.d.ts +2 -1
  61. package/build/graphql/queries/BranchQuery.js +26 -0
  62. package/build/graphql/queries/BuildQuery.d.ts +4 -1
  63. package/build/graphql/queries/BuildQuery.js +19 -0
  64. package/build/graphql/queries/PublishQuery.d.ts +2 -1
  65. package/build/graphql/queries/PublishQuery.js +16 -0
  66. package/build/graphql/queries/UpdateQuery.d.ts +6 -8
  67. package/build/graphql/queries/UpdateQuery.js +27 -23
  68. package/build/graphql/types/Build.d.ts +1 -0
  69. package/build/graphql/types/Build.js +16 -1
  70. package/build/metadata/apple/config/reader.d.ts +3 -2
  71. package/build/metadata/apple/config/reader.js +22 -5
  72. package/build/metadata/apple/config/writer.d.ts +3 -2
  73. package/build/metadata/apple/config/writer.js +22 -6
  74. package/build/metadata/apple/tasks/app-version.d.ts +5 -1
  75. package/build/metadata/apple/tasks/app-version.js +109 -8
  76. package/build/metadata/apple/tasks/index.d.ts +6 -1
  77. package/build/metadata/apple/tasks/index.js +7 -2
  78. package/build/metadata/apple/types.d.ts +3 -7
  79. package/build/metadata/upload.js +6 -1
  80. package/build/platform.d.ts +1 -0
  81. package/build/platform.js +17 -1
  82. package/build/project/android/applicationId.js +2 -2
  83. package/build/project/android/versions.d.ts +3 -0
  84. package/build/project/android/versions.js +23 -0
  85. package/build/project/applicationIdentifier.d.ts +4 -0
  86. package/build/project/applicationIdentifier.js +37 -0
  87. package/build/project/ios/bundleIdentifier.js +2 -2
  88. package/build/project/ios/target.js +14 -1
  89. package/build/project/ios/versions.d.ts +3 -0
  90. package/build/project/ios/versions.js +17 -0
  91. package/build/project/publish.d.ts +3 -2
  92. package/build/project/publish.js +23 -18
  93. package/build/project/remoteVersionSource.d.ts +8 -0
  94. package/build/project/remoteVersionSource.js +61 -0
  95. package/build/submit/submit.d.ts +2 -1
  96. package/build/submit/submit.js +3 -2
  97. package/build/submit/utils/files.d.ts +0 -6
  98. package/build/submit/utils/files.js +3 -16
  99. package/build/update/queries.d.ts +3 -0
  100. package/build/update/queries.js +72 -0
  101. package/build/update/utils.d.ts +14 -0
  102. package/build/update/utils.js +26 -9
  103. package/build/uploads.d.ts +8 -2
  104. package/build/uploads.js +19 -4
  105. package/build/utils/expodash/chunk.d.ts +1 -0
  106. package/build/utils/expodash/chunk.js +16 -0
  107. package/build/utils/queries.d.ts +25 -0
  108. package/build/utils/queries.js +67 -0
  109. package/build/vcs/clients/gitNoCommit.d.ts +1 -0
  110. package/build/vcs/clients/gitNoCommit.js +14 -0
  111. package/oclif.manifest.json +1 -1
  112. package/package.json +10 -5
  113. package/schema/metadata-0.json +38 -233
@@ -1,90 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.listBranchesAsync = void 0;
4
3
  const tslib_1 = require("tslib");
5
- const core_1 = require("@oclif/core");
6
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
- const cli_table3_1 = tslib_1.__importDefault(require("cli-table3"));
8
- const graphql_1 = require("graphql");
9
- const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
4
+ const queries_1 = require("../../branch/queries");
10
5
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
11
- const client_1 = require("../../graphql/client");
12
- const UpdateBranch_1 = require("../../graphql/types/UpdateBranch");
13
- const log_1 = tslib_1.__importDefault(require("../../log"));
6
+ const pagination_1 = require("../../commandUtils/pagination");
14
7
  const expoConfig_1 = require("../../project/expoConfig");
15
8
  const projectUtils_1 = require("../../project/projectUtils");
16
- const utils_1 = require("../../update/utils");
17
9
  const json_1 = require("../../utils/json");
18
- const BRANCHES_LIMIT = 10000;
19
- async function listBranchesAsync({ projectId, }) {
20
- var _a, _b;
21
- const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
22
- .query((0, graphql_tag_1.default) `
23
- query BranchesByAppQuery($appId: String!, $limit: Int!) {
24
- app {
25
- byId(appId: $appId) {
26
- id
27
- updateBranches(offset: 0, limit: $limit) {
28
- id
29
- ...UpdateBranchFragment
30
- }
31
- }
32
- }
33
- }
34
- ${(0, graphql_1.print)(UpdateBranch_1.UpdateBranchFragmentNode)}
35
- `, {
36
- appId: projectId,
37
- limit: BRANCHES_LIMIT,
38
- }, { additionalTypenames: ['UpdateBranch'] })
39
- .toPromise());
40
- 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 : [];
41
- }
42
- exports.listBranchesAsync = listBranchesAsync;
43
10
  class BranchList extends EasCommand_1.default {
44
11
  async runAsync() {
45
12
  const { flags } = await this.parse(BranchList);
46
- if (flags.json) {
13
+ const options = (0, pagination_1.getPaginatedQueryOptions)(flags);
14
+ if (options.json) {
47
15
  (0, json_1.enableJsonOutput)();
48
16
  }
49
17
  const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
50
18
  const exp = (0, expoConfig_1.getExpoConfig)(projectDir);
51
19
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
52
- const branches = await listBranchesAsync({ projectId });
53
- if (flags.json) {
54
- (0, json_1.printJsonOnlyOutput)(branches);
55
- }
56
- else {
57
- const table = new cli_table3_1.default({
58
- head: ['Branch', ...utils_1.UPDATE_COLUMNS],
59
- wordWrap: true,
60
- });
61
- table.push(...branches.map(branch => {
62
- var _a, _b, _c, _d, _e;
63
- return [
64
- branch.name,
65
- (0, utils_1.formatUpdate)(branch.updates[0]),
66
- (_b = (_a = branch.updates[0]) === null || _a === void 0 ? void 0 : _a.runtimeVersion) !== null && _b !== void 0 ? _b : 'N/A',
67
- (_d = (_c = branch.updates[0]) === null || _c === void 0 ? void 0 : _c.group) !== null && _d !== void 0 ? _d : 'N/A',
68
- (0, utils_1.getPlatformsForGroup)({
69
- updates: branch.updates,
70
- group: (_e = branch.updates[0]) === null || _e === void 0 ? void 0 : _e.group,
71
- }),
72
- ];
73
- }));
74
- log_1.default.addNewLineIfNone();
75
- log_1.default.log(chalk_1.default.bold('Branches with their most recent update group:'));
76
- log_1.default.log(table.toString());
77
- if (branches.length >= BRANCHES_LIMIT) {
78
- log_1.default.warn(`Showing first ${BRANCHES_LIMIT} branches, some results might be omitted.`);
79
- }
80
- }
20
+ await (0, queries_1.listAndRenderPaginatedBranchesAsync)(projectId, options);
81
21
  }
82
22
  }
83
23
  exports.default = BranchList;
84
24
  BranchList.description = 'list all branches';
85
25
  BranchList.flags = {
86
- json: core_1.Flags.boolean({
87
- description: 'return output as JSON',
88
- default: false,
89
- }),
26
+ ...pagination_1.EasPaginatedQueryFlags,
90
27
  };
@@ -7,7 +7,10 @@ export default class BranchView extends EasCommand {
7
7
  description: string;
8
8
  }[];
9
9
  static flags: {
10
+ offset: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
11
+ limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
10
12
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
14
  };
12
15
  runAsync(): Promise<void>;
13
16
  }
@@ -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,9 @@
1
+ import EasCommand from '../../../commandUtils/EasCommand';
2
+ export default class BuildVersionSetView extends EasCommand {
3
+ static description: string;
4
+ static flags: {
5
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
6
+ profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
7
+ };
8
+ runAsync(): Promise<void>;
9
+ }
@@ -0,0 +1,81 @@
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.ensureVersionSourceIsRemoteAsync)(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
+ (0, remoteVersionSource_1.validateAppConfigForRemoteVersionSource)(exp, platform);
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.flags = {
65
+ platform: core_1.Flags.enum({
66
+ char: 'p',
67
+ options: ['android', 'ios'],
68
+ }),
69
+ profile: core_1.Flags.string({
70
+ description: 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
71
+ helpValue: 'PROFILE_NAME',
72
+ }),
73
+ };
74
+ function getApplicationIdentifierName(platform) {
75
+ if (platform === eas_build_job_1.Platform.ANDROID) {
76
+ return 'application ID';
77
+ }
78
+ else {
79
+ return 'bundle identifier';
80
+ }
81
+ }
@@ -0,0 +1,11 @@
1
+ import EasCommand from '../../../commandUtils/EasCommand';
2
+ export default class BuildVersionSyncView extends EasCommand {
3
+ static description: string;
4
+ static flags: {
5
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
6
+ profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
7
+ };
8
+ runAsync(): Promise<void>;
9
+ private syncIosAsync;
10
+ private syncAndroidAsync;
11
+ }
@@ -0,0 +1,123 @@
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.ensureVersionSourceIsRemoteAsync)(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
+ (0, remoteVersionSource_1.validateAppConfigForRemoteVersionSource)(exp, profileInfo.platform);
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.flags = {
115
+ platform: core_1.Flags.enum({
116
+ char: 'p',
117
+ options: ['android', 'ios', 'all'],
118
+ }),
119
+ profile: core_1.Flags.string({
120
+ description: 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
121
+ helpValue: 'PROFILE_NAME',
122
+ }),
123
+ };
@@ -49,7 +49,10 @@ class Submit extends EasCommand_1.default {
49
49
  log_1.default.newLine();
50
50
  (0, urls_1.printSubmissionDetailsUrls)(submissions);
51
51
  if (flags.wait) {
52
- await (0, submit_1.waitToCompleteAsync)(submissions, { verbose: flags.verbose });
52
+ const completedSubmissions = await (0, submit_1.waitToCompleteAsync)(submissions, {
53
+ verbose: flags.verbose,
54
+ });
55
+ (0, submit_1.exitWithNonZeroCodeIfSomeSubmissionsDidntFinish)(completedSubmissions);
53
56
  }
54
57
  }
55
58
  async sanitizeFlagsAsync(flags) {
@@ -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',
@@ -167,6 +172,7 @@ class UpdatePublish extends EasCommand_1.default {
167
172
  let unsortedUpdateInfoGroups = {};
168
173
  let oldMessage, oldRuntimeVersion;
169
174
  let uploadedAssetCount = 0;
175
+ let assetLimitPerUpdateGroup = 0;
170
176
  if (republish) {
171
177
  // If we are republishing, we don't need to worry about building the bundle or uploading the assets.
172
178
  // Instead we get the `updateInfoGroup` from the update we wish to republish.
@@ -265,8 +271,11 @@ class UpdatePublish extends EasCommand_1.default {
265
271
  try {
266
272
  const platforms = platformFlag === 'all' ? exports.defaultPublishPlatforms : [platformFlag];
267
273
  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}`));
269
- uploadedAssetCount = uniqueUploadedAssetCount;
274
+ const uploadResults = await (0, publish_1.uploadAssetsAsync)(assets, projectId, (totalAssets, missingAssets) => {
275
+ assetSpinner.text = `Uploading assets. Finished (${totalAssets - missingAssets}/${totalAssets})`;
276
+ });
277
+ uploadedAssetCount = uploadResults.uniqueUploadedAssetCount;
278
+ assetLimitPerUpdateGroup = uploadResults.assetLimitPerUpdateGroup;
270
279
  unsortedUpdateInfoGroups = await (0, publish_1.buildUnsortedUpdateInfoGroupAsync)(assets, exp);
271
280
  const uploadAssetSuccessMessage = uploadedAssetCount
272
281
  ? `Uploaded ${uploadedAssetCount} ${uploadedAssetCount === 1 ? 'asset' : 'assets'}!`
@@ -289,6 +298,7 @@ class UpdatePublish extends EasCommand_1.default {
289
298
  appId: projectId,
290
299
  name: branchName,
291
300
  limit: 0,
301
+ offset: 0,
292
302
  });
293
303
  // Sort the updates into different groups based on their platform specific runtime versions
294
304
  const updateGroups = Object.entries(runtimeToPlatformMapping).map(([runtime, platforms]) => {
@@ -355,7 +365,7 @@ class UpdatePublish extends EasCommand_1.default {
355
365
  log_1.default.addNewLineIfNone();
356
366
  for (const runtime of new Set(Object.values(runtimeVersions))) {
357
367
  const newUpdatesForRuntimeVersion = newUpdates.filter(update => update.runtimeVersion === runtime);
358
- if (!newUpdatesForRuntimeVersion.length) {
368
+ if (newUpdatesForRuntimeVersion.length === 0) {
359
369
  throw new Error(`Publish response is missing updates with runtime ${runtime}.`);
360
370
  }
361
371
  const platforms = newUpdatesForRuntimeVersion.map(update => update.platform);
@@ -379,6 +389,14 @@ class UpdatePublish extends EasCommand_1.default {
379
389
  { label: 'Website link', value: updateGroupLink },
380
390
  ]));
381
391
  log_1.default.addNewLineIfNone();
392
+ if ((0, publish_1.isUploadedAssetCountAboveWarningThreshold)(uploadedAssetCount, assetLimitPerUpdateGroup)) {
393
+ log_1.default.warn(`This update group contains ${uploadedAssetCount} assets and is nearing the server cap of ${assetLimitPerUpdateGroup}.\n` +
394
+ `${(0, log_1.learnMore)('https://docs.expo.dev/eas-update/optimize-assets/', {
395
+ learnMoreMessage: 'Consider optimizing your usage of assets',
396
+ dim: false,
397
+ })}.`);
398
+ log_1.default.addNewLineIfNone();
399
+ }
382
400
  }
383
401
  }
384
402
  }
@@ -457,7 +475,7 @@ async function getUpdatesToRepublishInteractiveAsync(projectId, branchName, plat
457
475
  title: formatUpdateTitle(update),
458
476
  value: update.group,
459
477
  }));
460
- if (!updateGroups.length) {
478
+ if (updateGroups.length === 0) {
461
479
  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
480
  }
463
481
  if (updates.length > pageSize) {