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,15 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.evaluateTemplateString = exports.getInfoPlistPath = exports.maybeResolveVersionsAsync = exports.readBuildNumberAsync = exports.readShortVersionAsync = exports.bumpVersionInAppJsonAsync = exports.bumpVersionAsync = exports.BumpStrategy = void 0;
3
+ exports.resolveRemoteBuildNumberAsync = exports.evaluateTemplateString = exports.updateNativeVersionsAsync = exports.getInfoPlistPath = exports.maybeResolveVersionsAsync = exports.readBuildNumberAsync = exports.readShortVersionAsync = exports.bumpVersionInAppJsonAsync = exports.bumpVersionAsync = exports.BumpStrategy = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const config_1 = require("@expo/config");
6
5
  const config_plugins_1 = require("@expo/config-plugins");
7
6
  const eas_build_job_1 = require("@expo/eas-build-job");
8
7
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
9
8
  const path_1 = tslib_1.__importDefault(require("path"));
9
+ const generated_1 = require("../../graphql/generated");
10
+ const AppVersionMutation_1 = require("../../graphql/mutations/AppVersionMutation");
11
+ const AppVersionQuery_1 = require("../../graphql/queries/AppVersionQuery");
10
12
  const log_1 = tslib_1.__importDefault(require("../../log"));
13
+ const ora_1 = require("../../ora");
14
+ const target_1 = require("../../project/ios/target");
15
+ const versions_1 = require("../../project/ios/versions");
11
16
  const workflow_1 = require("../../project/workflow");
12
17
  const prompts_1 = require("../../prompts");
18
+ const uniqBy_1 = tslib_1.__importDefault(require("../../utils/expodash/uniqBy"));
13
19
  const plist_1 = require("../../utils/plist");
14
20
  const appJson_1 = require("../utils/appJson");
15
21
  const version_1 = require("../utils/version");
@@ -19,15 +25,20 @@ var BumpStrategy;
19
25
  BumpStrategy[BumpStrategy["BUILD_NUMBER"] = 1] = "BUILD_NUMBER";
20
26
  BumpStrategy[BumpStrategy["NOOP"] = 2] = "NOOP";
21
27
  })(BumpStrategy = exports.BumpStrategy || (exports.BumpStrategy = {}));
22
- async function bumpVersionAsync({ bumpStrategy, projectDir, exp, buildSettings, }) {
28
+ async function bumpVersionAsync({ bumpStrategy, projectDir, exp, targets, }) {
29
+ var _a;
23
30
  if (bumpStrategy === BumpStrategy.NOOP) {
24
31
  return;
25
32
  }
26
- ensureStaticConfigExists(projectDir);
27
- const infoPlist = await readInfoPlistAsync(projectDir, buildSettings);
33
+ (0, version_1.ensureStaticConfigExists)(projectDir);
28
34
  await bumpVersionInAppJsonAsync({ bumpStrategy, projectDir, exp });
29
35
  log_1.default.log('Updated versions in app.json');
30
- await writeVersionsToInfoPlistAsync({ projectDir, exp, infoPlist, buildSettings });
36
+ await updateNativeVersionsAsync({
37
+ projectDir,
38
+ version: exp.version,
39
+ buildNumber: (_a = exp.ios) === null || _a === void 0 ? void 0 : _a.buildNumber,
40
+ targets,
41
+ });
31
42
  log_1.default.log('Synchronized versions with Info.plist');
32
43
  }
33
44
  exports.bumpVersionAsync = bumpVersionAsync;
@@ -35,7 +46,7 @@ async function bumpVersionInAppJsonAsync({ bumpStrategy, projectDir, exp, }) {
35
46
  if (bumpStrategy === BumpStrategy.NOOP) {
36
47
  return;
37
48
  }
38
- ensureStaticConfigExists(projectDir);
49
+ (0, version_1.ensureStaticConfigExists)(projectDir);
39
50
  log_1.default.addNewLineIfNone();
40
51
  if (bumpStrategy === BumpStrategy.APP_VERSION) {
41
52
  const appVersion = config_plugins_1.IOSConfig.Version.getVersion(exp);
@@ -43,10 +54,8 @@ async function bumpVersionInAppJsonAsync({ bumpStrategy, projectDir, exp, }) {
43
54
  }
44
55
  else {
45
56
  const buildNumber = config_plugins_1.IOSConfig.Version.getBuildNumber(exp);
46
- if (buildNumber.match(/^\d+(\.\d+)*$/)) {
47
- const comps = buildNumber.split('.');
48
- comps[comps.length - 1] = String(Number(comps[comps.length - 1]) + 1);
49
- const bumpedBuildNumber = comps.join('.');
57
+ if ((0, versions_1.isValidBuildNumber)(buildNumber)) {
58
+ const bumpedBuildNumber = (0, versions_1.getNextBuildNumber)(buildNumber);
50
59
  log_1.default.log(`Bumping ${chalk_1.default.bold('expo.ios.buildNumber')} from ${chalk_1.default.bold(buildNumber)} to ${chalk_1.default.bold(bumpedBuildNumber)}`);
51
60
  await (0, appJson_1.updateAppJsonConfigAsync)({ projectDir, exp }, config => {
52
61
  config.ios = { ...config.ios, buildNumber: String(bumpedBuildNumber) };
@@ -89,11 +98,13 @@ async function readBuildNumberAsync(projectDir, exp, buildSettings) {
89
98
  }
90
99
  }
91
100
  exports.readBuildNumberAsync = readBuildNumberAsync;
92
- async function maybeResolveVersionsAsync(projectDir, exp, buildSettings) {
101
+ async function maybeResolveVersionsAsync(projectDir, exp, targets) {
102
+ var _a, _b;
103
+ const applicationTarget = (0, target_1.findApplicationTarget)(targets);
93
104
  try {
94
105
  return {
95
- appBuildVersion: await readBuildNumberAsync(projectDir, exp, buildSettings),
96
- appVersion: await readShortVersionAsync(projectDir, exp, buildSettings),
106
+ appBuildVersion: await readBuildNumberAsync(projectDir, exp, (_a = applicationTarget.buildSettings) !== null && _a !== void 0 ? _a : {}),
107
+ appVersion: await readShortVersionAsync(projectDir, exp, (_b = applicationTarget.buildSettings) !== null && _b !== void 0 ? _b : {}),
97
108
  };
98
109
  }
99
110
  catch (err) {
@@ -105,12 +116,6 @@ async function maybeResolveVersionsAsync(projectDir, exp, buildSettings) {
105
116
  }
106
117
  }
107
118
  exports.maybeResolveVersionsAsync = maybeResolveVersionsAsync;
108
- async function writeVersionsToInfoPlistAsync({ projectDir, exp, infoPlist, buildSettings, }) {
109
- let updatedInfoPlist = config_plugins_1.IOSConfig.Version.setVersion(exp, infoPlist);
110
- updatedInfoPlist = config_plugins_1.IOSConfig.Version.setBuildNumber(exp, updatedInfoPlist);
111
- await writeInfoPlistAsync({ projectDir, infoPlist: updatedInfoPlist, buildSettings });
112
- return updatedInfoPlist;
113
- }
114
119
  function getInfoPlistPath(projectDir, buildSettings) {
115
120
  if (buildSettings.INFOPLIST_FILE) {
116
121
  const infoPlistFile = buildSettings.INFOPLIST_FILE.startsWith('"')
@@ -133,15 +138,43 @@ async function readInfoPlistAsync(projectDir, buildSettings) {
133
138
  const infoPlistPath = getInfoPlistPath(projectDir, buildSettings);
134
139
  return ((_a = (await (0, plist_1.readPlistAsync)(infoPlistPath))) !== null && _a !== void 0 ? _a : {});
135
140
  }
136
- async function writeInfoPlistAsync({ projectDir, infoPlist, buildSettings, }) {
137
- const infoPlistPath = getInfoPlistPath(projectDir, buildSettings);
138
- await (0, plist_1.writePlistAsync)(infoPlistPath, infoPlist);
139
- }
140
- function ensureStaticConfigExists(projectDir) {
141
- const paths = (0, config_1.getConfigFilePaths)(projectDir);
142
- if (!paths.staticConfigPath) {
143
- throw new Error('autoIncrement option is not supported when using app.config.js');
141
+ async function updateNativeVersionsAsync({ projectDir, version, buildNumber, targets, }) {
142
+ var _a;
143
+ const project = config_plugins_1.IOSConfig.XcodeUtils.getPbxproj(projectDir);
144
+ const iosDir = path_1.default.join(projectDir, 'ios');
145
+ const infoPlistFiles = [];
146
+ for (const target of targets) {
147
+ const { targetName, buildConfiguration } = target;
148
+ const xcBuildConfiguration = config_plugins_1.IOSConfig.Target.getXCBuildConfigurationFromPbxproj(project, {
149
+ targetName,
150
+ buildConfiguration,
151
+ });
152
+ const infoPlist = (_a = xcBuildConfiguration === null || xcBuildConfiguration === void 0 ? void 0 : xcBuildConfiguration.buildSettings) === null || _a === void 0 ? void 0 : _a.INFOPLIST_FILE;
153
+ if (infoPlist) {
154
+ const evaluatedInfoPlistPath = trimQuotes(evaluateTemplateString(infoPlist, {
155
+ SRCROOT: iosDir,
156
+ }));
157
+ const absolutePath = path_1.default.isAbsolute(evaluatedInfoPlistPath)
158
+ ? evaluatedInfoPlistPath
159
+ : path_1.default.join(iosDir, evaluatedInfoPlistPath);
160
+ infoPlistFiles.push(path_1.default.normalize(absolutePath));
161
+ }
144
162
  }
163
+ const uniqueInfoPlistPaths = (0, uniqBy_1.default)(infoPlistFiles, i => i);
164
+ for (const infoPlistPath of uniqueInfoPlistPaths) {
165
+ const infoPlist = (await (0, plist_1.readPlistAsync)(infoPlistPath));
166
+ if (buildNumber) {
167
+ infoPlist.CFBundleVersion = buildNumber;
168
+ }
169
+ if (version) {
170
+ infoPlist.CFBundleShortVersionString = version;
171
+ }
172
+ await (0, plist_1.writePlistAsync)(infoPlistPath, infoPlist);
173
+ }
174
+ }
175
+ exports.updateNativeVersionsAsync = updateNativeVersionsAsync;
176
+ function trimQuotes(s) {
177
+ return (s === null || s === void 0 ? void 0 : s.startsWith('"')) && s.endsWith('"') ? s.slice(1, -1) : s;
145
178
  }
146
179
  function evaluateTemplateString(s, buildSettings) {
147
180
  // necessary because XCBuildConfiguration['buildSettings'] is not a plain object
@@ -157,3 +190,70 @@ function evaluateTemplateString(s, buildSettings) {
157
190
  });
158
191
  }
159
192
  exports.evaluateTemplateString = evaluateTemplateString;
193
+ /**
194
+ * Returns buildNumber that will be used for the next build. If current build profile
195
+ * has an 'autoIncrement' option set, it increments the version on server.
196
+ */
197
+ async function resolveRemoteBuildNumberAsync({ projectDir, projectId, exp, applicationTarget, buildProfile, }) {
198
+ var _a, _b, _c, _d;
199
+ const remoteVersions = await AppVersionQuery_1.AppVersionQuery.latestVersionAsync(projectId, generated_1.AppPlatform.Ios, applicationTarget.bundleIdentifier);
200
+ const localBuildNumber = await readBuildNumberAsync(projectDir, exp, (_a = applicationTarget.buildSettings) !== null && _a !== void 0 ? _a : {});
201
+ const localShortVersion = await readShortVersionAsync(projectDir, exp, (_b = applicationTarget.buildSettings) !== null && _b !== void 0 ? _b : {});
202
+ let currentBuildVersion;
203
+ if (remoteVersions === null || remoteVersions === void 0 ? void 0 : remoteVersions.buildVersion) {
204
+ currentBuildVersion = remoteVersions.buildVersion;
205
+ }
206
+ else {
207
+ if (localBuildNumber) {
208
+ log_1.default.warn('No remote versions are configured for this project, buildNumber will be initialized based on the value from the local project.');
209
+ currentBuildVersion = localBuildNumber;
210
+ }
211
+ else {
212
+ log_1.default.error(`Remote versions are not configured and EAS CLI was not able to read the current version from your project. Use "eas build:version:set" to initialize remote versions.`);
213
+ throw new Error('Remote versions are not configured.');
214
+ }
215
+ }
216
+ if (!buildProfile.autoIncrement && (remoteVersions === null || remoteVersions === void 0 ? void 0 : remoteVersions.buildVersion)) {
217
+ return currentBuildVersion;
218
+ }
219
+ else if (!buildProfile.autoIncrement && !(remoteVersions === null || remoteVersions === void 0 ? void 0 : remoteVersions.buildVersion)) {
220
+ const spinner = (0, ora_1.ora)(`Initializing the buildNumber with ${currentBuildVersion}.`).start();
221
+ try {
222
+ await AppVersionMutation_1.AppVersionMutation.createAppVersionAsync({
223
+ appId: projectId,
224
+ platform: generated_1.AppPlatform.Ios,
225
+ applicationIdentifier: applicationTarget.bundleIdentifier,
226
+ storeVersion: localShortVersion !== null && localShortVersion !== void 0 ? localShortVersion : '1.0.0',
227
+ buildVersion: currentBuildVersion,
228
+ runtimeVersion: (_c = config_plugins_1.Updates.getRuntimeVersionNullable(exp, eas_build_job_1.Platform.IOS)) !== null && _c !== void 0 ? _c : undefined,
229
+ });
230
+ spinner.succeed(`Initialized the buildNumber with ${currentBuildVersion}.`);
231
+ }
232
+ catch (err) {
233
+ spinner.fail(`Failed to initialize the buildNumber with ${currentBuildVersion}.`);
234
+ throw err;
235
+ }
236
+ return currentBuildVersion;
237
+ }
238
+ else {
239
+ const nextBuildVersion = (0, versions_1.getNextBuildNumber)(currentBuildVersion);
240
+ const spinner = (0, ora_1.ora)(`Incrementing buildNumber ${currentBuildVersion} -> ${nextBuildVersion}.`).start();
241
+ try {
242
+ await AppVersionMutation_1.AppVersionMutation.createAppVersionAsync({
243
+ appId: projectId,
244
+ platform: generated_1.AppPlatform.Ios,
245
+ applicationIdentifier: applicationTarget.bundleIdentifier,
246
+ storeVersion: localShortVersion !== null && localShortVersion !== void 0 ? localShortVersion : '1.0.0',
247
+ buildVersion: nextBuildVersion,
248
+ runtimeVersion: (_d = config_plugins_1.Updates.getRuntimeVersionNullable(exp, eas_build_job_1.Platform.IOS)) !== null && _d !== void 0 ? _d : undefined,
249
+ });
250
+ spinner.succeed(`Incremented buildNumber ${currentBuildVersion} -> ${nextBuildVersion}.`);
251
+ }
252
+ catch (err) {
253
+ spinner.fail(`Failed to increment buildNumber ${currentBuildVersion} -> ${nextBuildVersion}.`);
254
+ throw err;
255
+ }
256
+ return nextBuildVersion;
257
+ }
258
+ }
259
+ exports.resolveRemoteBuildNumberAsync = resolveRemoteBuildNumberAsync;
@@ -1,4 +1,4 @@
1
- import { Job } from '@expo/eas-build-job';
1
+ import { Job, Metadata } from '@expo/eas-build-job';
2
2
  export interface LocalBuildOptions {
3
3
  enable: boolean;
4
4
  skipCleanup?: boolean;
@@ -8,4 +8,4 @@ export interface LocalBuildOptions {
8
8
  workingdir?: string;
9
9
  verbose?: boolean;
10
10
  }
11
- export declare function runLocalBuildAsync(job: Job, options: LocalBuildOptions): Promise<void>;
11
+ export declare function runLocalBuildAsync(job: Job, metadata: Metadata, options: LocalBuildOptions): Promise<void>;
@@ -6,10 +6,10 @@ const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
6
6
  const semver_1 = tslib_1.__importDefault(require("semver"));
7
7
  const ora_1 = require("../ora");
8
8
  const PLUGIN_PACKAGE_NAME = 'eas-cli-local-build-plugin';
9
- const PLUGIN_PACKAGE_VERSION = '0.0.85';
10
- async function runLocalBuildAsync(job, options) {
9
+ const PLUGIN_PACKAGE_VERSION = '0.0.98';
10
+ async function runLocalBuildAsync(job, metadata, options) {
11
11
  var _a;
12
- const { command, args } = await getCommandAndArgsAsync(job);
12
+ const { command, args } = await getCommandAndArgsAsync(job, metadata);
13
13
  let spinner;
14
14
  if (!options.verbose) {
15
15
  spinner = (0, ora_1.ora)().start(options.skipNativeBuild ? 'Preparing project' : 'Building project');
@@ -44,16 +44,16 @@ async function runLocalBuildAsync(job, options) {
44
44
  }
45
45
  }
46
46
  exports.runLocalBuildAsync = runLocalBuildAsync;
47
- async function getCommandAndArgsAsync(job) {
48
- const jobBase64 = Buffer.from(JSON.stringify({ job })).toString('base64');
47
+ async function getCommandAndArgsAsync(job, metadata) {
48
+ const jobAndMetadataBase64 = Buffer.from(JSON.stringify({ job, metadata })).toString('base64');
49
49
  if (process.env.EAS_LOCAL_BUILD_PLUGIN_PATH) {
50
50
  return {
51
51
  command: process.env.EAS_LOCAL_BUILD_PLUGIN_PATH,
52
- args: [jobBase64],
52
+ args: [jobAndMetadataBase64],
53
53
  };
54
54
  }
55
55
  else {
56
- const args = [`${PLUGIN_PACKAGE_NAME}@${PLUGIN_PACKAGE_VERSION}`, jobBase64];
56
+ const args = [`${PLUGIN_PACKAGE_NAME}@${PLUGIN_PACKAGE_VERSION}`, jobAndMetadataBase64];
57
57
  if (await isAtLeastNpm7Async()) {
58
58
  // npx shipped with npm >= 7.0.0 requires the "-y" flag to run commands without
59
59
  // prompting the user to install a package that is used for the first time
@@ -1,3 +1,4 @@
1
1
  import { Metadata, Platform } from '@expo/eas-build-job';
2
2
  import { BuildContext } from './context';
3
3
  export declare function collectMetadataAsync<T extends Platform>(ctx: BuildContext<T>): Promise<Metadata>;
4
+ export declare function truncateGitCommitMessage(msg: string | undefined, maxLength?: number): string | undefined;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.collectMetadataAsync = void 0;
3
+ exports.truncateGitCommitMessage = exports.collectMetadataAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const config_plugins_1 = require("@expo/config-plugins");
6
6
  const eas_build_job_1 = require("@expo/eas-build-job");
@@ -16,7 +16,8 @@ const vcs_1 = require("../vcs");
16
16
  const version_1 = require("./android/version");
17
17
  const version_2 = require("./ios/version");
18
18
  async function collectMetadataAsync(ctx) {
19
- var _a, _b;
19
+ var _a, _b, _c;
20
+ const vcsClient = (0, vcs_1.getVcsClient)();
20
21
  const channelOrReleaseChannel = await resolveChannelOrReleaseChannelAsync(ctx);
21
22
  const distribution = (_a = ('simulator' in ctx.buildProfile && ctx.buildProfile.simulator
22
23
  ? 'simulator'
@@ -35,12 +36,16 @@ async function collectMetadataAsync(ctx) {
35
36
  appName: ctx.exp.name,
36
37
  appIdentifier: resolveAppIdentifier(ctx),
37
38
  buildProfile: ctx.buildProfileName,
38
- gitCommitHash: await (0, vcs_1.getVcsClient)().getCommitHashAsync(),
39
- isGitWorkingTreeDirty: await (0, vcs_1.getVcsClient)().hasUncommittedChangesAsync(),
39
+ gitCommitHash: await vcsClient.getCommitHashAsync(),
40
+ gitCommitMessage: truncateGitCommitMessage((_c = (await vcsClient.getLastCommitMessageAsync())) !== null && _c !== void 0 ? _c : undefined),
41
+ isGitWorkingTreeDirty: await vcsClient.hasUncommittedChangesAsync(),
40
42
  username: (0, projectUtils_1.getUsername)(ctx.exp, await (0, actions_1.ensureLoggedInAsync)()),
43
+ message: ctx.message,
41
44
  ...(ctx.platform === eas_build_job_1.Platform.IOS && {
42
45
  iosEnterpriseProvisioning: resolveIosEnterpriseProvisioning(ctx),
43
46
  }),
47
+ runWithNoWaitFlag: ctx.noWait,
48
+ runFromCI: ctx.runFromCI,
44
49
  };
45
50
  return (0, eas_build_job_1.sanitizeMetadata)(metadata);
46
51
  }
@@ -48,11 +53,25 @@ exports.collectMetadataAsync = collectMetadataAsync;
48
53
  async function maybeResolveVersionsAsync(ctx) {
49
54
  if (ctx.platform === eas_build_job_1.Platform.IOS) {
50
55
  const iosContext = ctx;
51
- return await (0, version_2.maybeResolveVersionsAsync)(ctx.projectDir, ctx.exp, iosContext.ios.applicationTargetBuildSettings);
56
+ const resolvedVersion = await (0, version_2.maybeResolveVersionsAsync)(ctx.projectDir, ctx.exp, iosContext.ios.targets);
57
+ if (iosContext.ios.buildNumberOverride) {
58
+ return {
59
+ ...resolvedVersion,
60
+ appBuildVersion: iosContext.ios.buildNumberOverride,
61
+ };
62
+ }
63
+ return resolvedVersion;
52
64
  }
53
65
  else if (ctx.platform === eas_build_job_1.Platform.ANDROID) {
54
66
  const androidCtx = ctx;
55
- return await (0, version_1.maybeResolveVersionsAsync)(ctx.projectDir, ctx.exp, androidCtx.buildProfile);
67
+ const resolvedVersion = await (0, version_1.maybeResolveVersionsAsync)(ctx.projectDir, ctx.exp, androidCtx.buildProfile);
68
+ if (androidCtx.android.versionCodeOverride) {
69
+ return {
70
+ ...resolvedVersion,
71
+ appBuildVersion: androidCtx.android.versionCodeOverride,
72
+ };
73
+ }
74
+ return resolvedVersion;
56
75
  }
57
76
  else {
58
77
  throw new Error(`Unsupported platform ${ctx.platform}`);
@@ -122,3 +141,10 @@ async function getReactNativeVersionAsync(ctx) {
122
141
  function resolveIosEnterpriseProvisioning(ctx) {
123
142
  return ctx.buildProfile.enterpriseProvisioning;
124
143
  }
144
+ function truncateGitCommitMessage(msg, maxLength = 4096) {
145
+ if (msg === undefined) {
146
+ return undefined;
147
+ }
148
+ return msg.length > maxLength ? `${msg.substring(0, maxLength - 3)}...` : msg;
149
+ }
150
+ exports.truncateGitCommitMessage = truncateGitCommitMessage;
@@ -12,5 +12,6 @@ export interface BuildFlags {
12
12
  submitProfile?: string;
13
13
  localBuildOptions: LocalBuildOptions;
14
14
  userInputResourceClass?: UserInputResourceClass;
15
+ message?: string;
15
16
  }
16
17
  export declare function runBuildAndSubmitAsync(projectDir: string, flags: BuildFlags): Promise<void>;
@@ -7,11 +7,13 @@ const eas_json_1 = require("@expo/eas-json");
7
7
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
8
8
  const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
9
9
  const generated_1 = require("../graphql/generated");
10
+ const BuildQuery_1 = require("../graphql/queries/BuildQuery");
10
11
  const AppPlatform_1 = require("../graphql/types/AppPlatform");
11
12
  const log_1 = tslib_1.__importDefault(require("../log"));
12
13
  const platform_1 = require("../platform");
13
14
  const expoSdk_1 = require("../project/expoSdk");
14
15
  const metroConfig_1 = require("../project/metroConfig");
16
+ const remoteVersionSource_1 = require("../project/remoteVersionSource");
15
17
  const context_1 = require("../submit/context");
16
18
  const submit_1 = require("../submit/submit");
17
19
  const urls_1 = require("../submit/utils/urls");
@@ -40,7 +42,7 @@ const platformToGraphQLResourceClassMapping = {
40
42
  },
41
43
  };
42
44
  async function runBuildAndSubmitAsync(projectDir, flags) {
43
- var _a, _b;
45
+ var _a, _b, _c;
44
46
  await (0, vcs_1.getVcsClient)().ensureRepoExistsAsync();
45
47
  await (0, repository_1.ensureRepoIsCleanAsync)(flags.nonInteractive);
46
48
  await (0, configure_1.ensureProjectConfiguredAsync)({
@@ -48,18 +50,22 @@ async function runBuildAndSubmitAsync(projectDir, flags) {
48
50
  nonInteractive: flags.nonInteractive,
49
51
  });
50
52
  const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
53
+ const easJsonCliConfig = (_a = (await easJsonReader.getCliConfigAsync())) !== null && _a !== void 0 ? _a : {};
51
54
  const platforms = (0, platform_1.toPlatforms)(flags.requestedPlatform);
52
55
  const buildProfiles = await (0, profiles_1.getProfilesAsync)({
53
56
  type: 'build',
54
57
  easJsonReader,
55
58
  platforms,
56
- profileName: (_a = flags.profile) !== null && _a !== void 0 ? _a : undefined,
59
+ profileName: (_b = flags.profile) !== null && _b !== void 0 ? _b : undefined,
57
60
  });
58
61
  await (0, devClient_1.ensureExpoDevClientInstalledForDevClientBuildsAsync)({
59
62
  projectDir,
60
63
  nonInteractive: flags.nonInteractive,
61
64
  buildProfiles,
62
65
  });
66
+ for (const buildProfile of buildProfiles) {
67
+ (0, remoteVersionSource_1.validateBuildProfileVersionSettings)(buildProfile, easJsonCliConfig);
68
+ }
63
69
  const startedBuilds = [];
64
70
  const buildCtxByPlatform = {};
65
71
  for (const buildProfile of buildProfiles) {
@@ -68,7 +74,8 @@ async function runBuildAndSubmitAsync(projectDir, flags) {
68
74
  flags,
69
75
  moreBuilds: platforms.length > 1,
70
76
  buildProfile,
71
- resourceClass: platformToGraphQLResourceClassMapping[buildProfile.platform][(_b = flags.userInputResourceClass) !== null && _b !== void 0 ? _b : types_1.UserInputResourceClass.DEFAULT],
77
+ resourceClass: platformToGraphQLResourceClassMapping[buildProfile.platform][(_c = flags.userInputResourceClass) !== null && _c !== void 0 ? _c : types_1.UserInputResourceClass.DEFAULT],
78
+ easJsonCliConfig,
72
79
  });
73
80
  if (maybeBuild) {
74
81
  startedBuilds.push({ build: maybeBuild, buildProfile });
@@ -100,6 +107,7 @@ async function runBuildAndSubmitAsync(projectDir, flags) {
100
107
  submitProfile,
101
108
  nonInteractive: flags.nonInteractive,
102
109
  });
110
+ startedBuild.build = await BuildQuery_1.BuildQuery.withSubmissionsByIdAsync(startedBuild.build.id);
103
111
  submissions.push(submission);
104
112
  }
105
113
  log_1.default.newLine();
@@ -117,33 +125,47 @@ async function runBuildAndSubmitAsync(projectDir, flags) {
117
125
  buildIds: startedBuilds.map(({ build }) => build.id),
118
126
  accountName,
119
127
  });
120
- (0, printBuildInfo_1.printBuildResults)(builds, flags.json);
128
+ if (!flags.json) {
129
+ (0, printBuildInfo_1.printBuildResults)(builds);
130
+ }
121
131
  const haveAllBuildsFailedOrCanceled = builds.every(build => (build === null || build === void 0 ? void 0 : build.status) && [generated_1.BuildStatus.Errored, generated_1.BuildStatus.Canceled].includes(build === null || build === void 0 ? void 0 : build.status));
122
132
  if (haveAllBuildsFailedOrCanceled || !flags.autoSubmit) {
133
+ if (flags.json) {
134
+ (0, json_1.printJsonOnlyOutput)(builds);
135
+ }
123
136
  exitWithNonZeroCodeIfSomeBuildsFailed(builds);
124
137
  }
125
138
  else {
126
- // the following function also exits with non zero code if any of the submissions failed
127
- await (0, submit_1.waitToCompleteAsync)(submissions);
139
+ const completedSubmissions = await (0, submit_1.waitToCompleteAsync)(submissions);
140
+ if (flags.json) {
141
+ (0, json_1.printJsonOnlyOutput)(await Promise.all(builds
142
+ .filter((i) => !!i)
143
+ .map(build => BuildQuery_1.BuildQuery.withSubmissionsByIdAsync(build.id))));
144
+ }
145
+ (0, submit_1.exitWithNonZeroCodeIfSomeSubmissionsDidntFinish)(completedSubmissions);
128
146
  }
129
147
  }
130
148
  exports.runBuildAndSubmitAsync = runBuildAndSubmitAsync;
131
- async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildProfile, resourceClass, }) {
149
+ async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildProfile, resourceClass, easJsonCliConfig, }) {
132
150
  const buildCtx = await (0, createContext_1.createBuildContextAsync)({
133
151
  buildProfileName: buildProfile.profileName,
134
152
  resourceClass,
135
153
  clearCache: flags.clearCache,
136
154
  buildProfile: buildProfile.profile,
137
155
  nonInteractive: flags.nonInteractive,
156
+ noWait: !flags.wait,
138
157
  platform: buildProfile.platform,
139
158
  projectDir,
140
159
  localBuildOptions: flags.localBuildOptions,
160
+ easJsonCliConfig,
161
+ message: flags.message,
141
162
  });
142
163
  if (moreBuilds) {
143
164
  log_1.default.newLine();
144
165
  const appPlatform = (0, AppPlatform_1.toAppPlatform)(buildProfile.platform);
145
166
  log_1.default.log(`${platform_1.appPlatformEmojis[appPlatform]} ${chalk_1.default.bold(`${platform_1.appPlatformDisplayNames[appPlatform]} build`)}`);
146
167
  }
168
+ (0, remoteVersionSource_1.validateAppConfigForRemoteVersionSource)(buildCtx.exp, buildProfile.platform);
147
169
  if (buildCtx.workflow === eas_build_job_1.Workflow.MANAGED) {
148
170
  if (!sdkVersionChecked) {
149
171
  await (0, expoSdk_1.checkExpoSdkIsSupportedAsync)(buildCtx);
@@ -1,5 +1,5 @@
1
1
  import { BuildError, BuildFragment, EasBuildDeprecationInfo } from '../../graphql/generated';
2
2
  export declare function printLogsUrls(builds: BuildFragment[]): void;
3
- export declare function printBuildResults(builds: (BuildFragment | null)[], json: boolean): void;
3
+ export declare function printBuildResults(builds: (BuildFragment | null)[]): void;
4
4
  export declare function printDeprecationWarnings(deprecationInfo?: EasBuildDeprecationInfo | null): void;
5
5
  export declare function printUserError(error: BuildError): void;
@@ -9,7 +9,6 @@ const qrcode_terminal_1 = tslib_1.__importDefault(require("qrcode-terminal"));
9
9
  const generated_1 = require("../../graphql/generated");
10
10
  const log_1 = tslib_1.__importStar(require("../../log"));
11
11
  const platform_1 = require("../../platform");
12
- const json_1 = require("../../utils/json");
13
12
  const url_1 = require("./url");
14
13
  function printLogsUrls(builds) {
15
14
  if (builds.length === 1) {
@@ -23,20 +22,15 @@ function printLogsUrls(builds) {
23
22
  }
24
23
  }
25
24
  exports.printLogsUrls = printLogsUrls;
26
- function printBuildResults(builds, json) {
27
- if (json) {
28
- (0, json_1.printJsonOnlyOutput)(builds);
25
+ function printBuildResults(builds) {
26
+ log_1.default.newLine();
27
+ if (builds.length === 1) {
28
+ const [build] = builds;
29
+ (0, assert_1.default)(build, 'Build should be defined');
30
+ printBuildResult(build);
29
31
  }
30
32
  else {
31
- log_1.default.newLine();
32
- if (builds.length === 1) {
33
- const [build] = builds;
34
- (0, assert_1.default)(build, 'Build should be defined');
35
- printBuildResult(build);
36
- }
37
- else {
38
- builds.filter(i => i).forEach(build => printBuildResult(build));
39
- }
33
+ builds.filter(i => i).forEach(build => printBuildResult(build));
40
34
  }
41
35
  }
42
36
  exports.printBuildResults = printBuildResults;
@@ -0,0 +1,13 @@
1
+ export declare const getPaginatedQueryOptions: (flags: Record<keyof typeof EasPaginatedQueryFlags, any>) => PaginatedQueryOptions;
2
+ export declare const EasPaginatedQueryFlags: {
3
+ offset: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
4
+ limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
5
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ };
8
+ export declare type PaginatedQueryOptions = {
9
+ nonInteractive: boolean;
10
+ json: boolean;
11
+ limit?: number;
12
+ offset: number;
13
+ };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EasPaginatedQueryFlags = exports.getPaginatedQueryOptions = void 0;
4
+ const core_1 = require("@oclif/core");
5
+ const getPaginatedQueryOptions = (flags) => {
6
+ var _a, _b, _c;
7
+ return {
8
+ json: (_a = flags.json) !== null && _a !== void 0 ? _a : false,
9
+ offset: (_b = flags.offset) !== null && _b !== void 0 ? _b : 0,
10
+ nonInteractive: (_c = flags['non-interactive']) !== null && _c !== void 0 ? _c : false,
11
+ ...('limit' in flags && { limit: flags.limit }),
12
+ };
13
+ };
14
+ exports.getPaginatedQueryOptions = getPaginatedQueryOptions;
15
+ const parseFlagInputStringAsInteger = (input, flagName, lowerLimit, upperLimit) => {
16
+ const inputAsNumber = Number(input);
17
+ if (isNaN(inputAsNumber)) {
18
+ throw new Error(`Unable to parse ${input} as a number`);
19
+ }
20
+ if (inputAsNumber < lowerLimit || inputAsNumber > upperLimit) {
21
+ throw new Error(`--${flagName} must be between ${lowerLimit} and ${upperLimit}`);
22
+ }
23
+ return inputAsNumber;
24
+ };
25
+ exports.EasPaginatedQueryFlags = {
26
+ offset: core_1.Flags.integer({
27
+ description: 'Start queries from specified index. Use for paginating results. Defaults to 0.',
28
+ // eslint-disable-next-line async-protect/async-suffix
29
+ parse: async (input) => parseFlagInputStringAsInteger(input, 'offset', 0, Number.MAX_SAFE_INTEGER),
30
+ }),
31
+ limit: core_1.Flags.integer({
32
+ description: 'The number of query items to list at once. The default value is 50 (the maximum is 100). Using a lower value may help increase command speed.',
33
+ // eslint-disable-next-line async-protect/async-suffix
34
+ parse: async (input) => parseFlagInputStringAsInteger(input, 'limit', 1, 100),
35
+ }),
36
+ json: core_1.Flags.boolean({
37
+ description: 'Enable JSON output, non-JSON messages will be printed to stderr.',
38
+ }),
39
+ 'non-interactive': core_1.Flags.boolean({
40
+ description: 'Run the command in non-interactive mode.',
41
+ }),
42
+ };
@@ -1,12 +1,11 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
- import { UpdateBranchFragment } from '../../graphql/generated';
3
- export declare function listBranchesAsync({ projectId, }: {
4
- projectId: string;
5
- }): Promise<UpdateBranchFragment[]>;
6
2
  export default class BranchList extends EasCommand {
7
3
  static description: string;
8
4
  static flags: {
5
+ offset: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
6
+ limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
9
7
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
9
  };
11
10
  runAsync(): Promise<void>;
12
11
  }