eas-cli 0.60.0 → 1.1.1

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 (62) hide show
  1. package/README.md +80 -47
  2. package/build/analytics/events.d.ts +4 -1
  3. package/build/analytics/events.js +3 -0
  4. package/build/build/android/build.js +1 -1
  5. package/build/build/build.d.ts +1 -2
  6. package/build/build/build.js +6 -11
  7. package/build/build/utils/printBuildInfo.js +2 -2
  8. package/build/build/utils/repository.js +4 -4
  9. package/build/commands/branch/create.js +1 -1
  10. package/build/commands/branch/delete.js +1 -1
  11. package/build/commands/branch/rename.js +2 -2
  12. package/build/commands/channel/create.js +1 -1
  13. package/build/commands/channel/delete.js +1 -1
  14. package/build/commands/channel/edit.js +3 -3
  15. package/build/commands/channel/rollout.js +3 -3
  16. package/build/commands/channel/view.js +1 -1
  17. package/build/commands/credentials.d.ts +3 -0
  18. package/build/commands/credentials.js +6 -1
  19. package/build/commands/metadata/pull.js +2 -2
  20. package/build/commands/project/init.js +3 -1
  21. package/build/commands/secret/list.js +1 -1
  22. package/build/commands/update/index.js +4 -4
  23. package/build/commands/update/list.js +1 -1
  24. package/build/credentials/android/actions/RemoveKeystore.js +1 -1
  25. package/build/credentials/errors.js +1 -1
  26. package/build/credentials/ios/actions/DistributionCertificateUtils.js +2 -2
  27. package/build/credentials/ios/actions/SetUpAdhocProvisioningProfile.js +1 -1
  28. package/build/credentials/ios/actions/SetUpInternalProvisioningProfile.js +2 -2
  29. package/build/credentials/ios/actions/SetUpProvisioningProfile.js +1 -1
  30. package/build/credentials/ios/actions/SetUpSubmissionCredentials.js +1 -1
  31. package/build/credentials/ios/appstore/ascApiKey.d.ts +11 -0
  32. package/build/credentials/ios/appstore/ascApiKey.js +53 -3
  33. package/build/credentials/ios/appstore/contractMessages.js +1 -1
  34. package/build/credentials/ios/appstore/ensureAppExists.js +3 -3
  35. package/build/credentials/ios/appstore/pushKey.js +2 -2
  36. package/build/credentials/manager/SelectIosDistributionTypeGraphqlFromBuildProfile.js +1 -1
  37. package/build/credentials/manager/SelectPlatform.d.ts +2 -0
  38. package/build/credentials/manager/SelectPlatform.js +7 -12
  39. package/build/credentials/utils/promptForCredentials.js +1 -1
  40. package/build/devices/manager.js +1 -1
  41. package/build/graphql/client.js +1 -1
  42. package/build/graphql/generated.d.ts +35 -0
  43. package/build/metadata/config.d.ts +19 -0
  44. package/build/metadata/config.js +45 -1
  45. package/build/metadata/download.js +6 -5
  46. package/build/metadata/errors.js +2 -2
  47. package/build/metadata/upload.js +18 -21
  48. package/build/ora.js +1 -1
  49. package/build/project/metroConfig.js +1 -1
  50. package/build/project/projectUtils.d.ts +19 -2
  51. package/build/project/projectUtils.js +41 -32
  52. package/build/project/publish.js +8 -2
  53. package/build/submit/utils/errors.js +9 -9
  54. package/build/submit/utils/wait.js +1 -7
  55. package/build/update/utils.js +1 -1
  56. package/build/uploads.d.ts +1 -1
  57. package/build/uploads.js +64 -25
  58. package/build/vcs/clients/git.js +6 -2
  59. package/build/vcs/local.d.ts +1 -0
  60. package/build/vcs/local.js +11 -2
  61. package/oclif.manifest.json +1 -1
  62. package/package.json +11 -10
@@ -1,11 +1,55 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAppleWriter = exports.createAppleReader = exports.validateConfig = void 0;
3
+ exports.createAppleWriter = exports.createAppleReader = exports.validateConfig = exports.loadConfigAsync = exports.getStaticConfigFilePath = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ajv_1 = tslib_1.__importDefault(require("ajv"));
6
6
  const assert_1 = tslib_1.__importDefault(require("assert"));
7
+ const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
8
+ const path_1 = tslib_1.__importDefault(require("path"));
7
9
  const reader_1 = require("./apple/config/reader");
8
10
  const writer_1 = require("./apple/config/writer");
11
+ const errors_1 = require("./errors");
12
+ /**
13
+ * Resolve the dynamic config from the user.
14
+ * It supports methods, async methods, or objects (json).
15
+ */
16
+ async function resolveDynamicConfigAsync(configFile) {
17
+ const userConfigOrFunction = await Promise.resolve().then(() => tslib_1.__importStar(require(configFile))).then(file => { var _a; return (_a = file.default) !== null && _a !== void 0 ? _a : file; });
18
+ return typeof userConfigOrFunction === 'function'
19
+ ? await userConfigOrFunction()
20
+ : userConfigOrFunction;
21
+ }
22
+ /**
23
+ * Get the static configuration file path, based on the metadata context.
24
+ * This uses any custom name provided, but swaps out the extension for `.json`.
25
+ */
26
+ function getStaticConfigFilePath({ projectDir, metadataPath, }) {
27
+ const configFile = path_1.default.join(projectDir, metadataPath);
28
+ const configExtension = path_1.default.extname(configFile);
29
+ return path_1.default.join(projectDir, `${path_1.default.basename(configFile, configExtension)}.json`);
30
+ }
31
+ exports.getStaticConfigFilePath = getStaticConfigFilePath;
32
+ /**
33
+ * Load the store configuration from a metadata context.
34
+ * This can load `.json` and `.js` config files, using `require`.
35
+ * It throws MetadataValidationErrors when the file doesn't exist, or contains errors.
36
+ * The user is prompted to try anyway when errors are found.
37
+ */
38
+ async function loadConfigAsync({ projectDir, metadataPath, skipValidation = false, }) {
39
+ const configFile = path_1.default.join(projectDir, metadataPath);
40
+ if (!(await fs_extra_1.default.pathExists(configFile))) {
41
+ throw new errors_1.MetadataValidationError(`Metadata store config file not found: "${configFile}"`);
42
+ }
43
+ const configData = await resolveDynamicConfigAsync(configFile);
44
+ if (!skipValidation) {
45
+ const { valid, errors: validationErrors } = validateConfig(configData);
46
+ if (!valid) {
47
+ throw new errors_1.MetadataValidationError(`Metadata store config errors found`, validationErrors);
48
+ }
49
+ }
50
+ return configData;
51
+ }
52
+ exports.loadConfigAsync = loadConfigAsync;
9
53
  /**
10
54
  * Run the JSON Schema validation to normalize defaults and flag early config errors.
11
55
  * This includes validating the known store limitations for every configurable property.
@@ -17,20 +17,21 @@ const telemetry_1 = require("./utils/telemetry");
17
17
  * Note, only App Store is supported at this time.
18
18
  */
19
19
  async function downloadMetadataAsync(metadataCtx) {
20
- const filePath = path_1.default.resolve(metadataCtx.projectDir, metadataCtx.metadataPath);
20
+ const filePath = (0, config_1.getStaticConfigFilePath)(metadataCtx);
21
21
  const fileExists = await fs_extra_1.default.pathExists(filePath);
22
22
  if (fileExists) {
23
+ const filePathRelative = path_1.default.relative(metadataCtx.projectDir, filePath);
23
24
  const overwrite = await (0, prompts_1.confirmAsync)({
24
- message: `Do you want to overwrite the existing store configuration "${metadataCtx.metadataPath}"?`,
25
+ message: `Do you want to overwrite the existing "${filePathRelative}"?`,
25
26
  });
26
27
  if (!overwrite) {
27
- throw new errors_1.MetadataValidationError(`Store configuration already exists at "${filePath}"`);
28
+ throw new errors_1.MetadataValidationError(`Store config already exists at "${filePath}"`);
28
29
  }
29
30
  }
30
31
  const { app, auth } = await (0, context_1.ensureMetadataAppStoreAuthenticatedAsync)(metadataCtx);
31
32
  const { unsubscribeTelemetry, executionId } = (0, telemetry_1.subscribeTelemetry)(events_1.MetadataEvent.APPLE_METADATA_DOWNLOAD, { app, auth });
32
33
  log_1.default.addNewLineIfNone();
33
- log_1.default.log('Downloading App Store configuration...');
34
+ log_1.default.log('Downloading App Store config...');
34
35
  const errors = [];
35
36
  const config = (0, config_1.createAppleWriter)();
36
37
  const tasks = (0, tasks_1.createAppleTasks)(metadataCtx);
@@ -52,7 +53,7 @@ async function downloadMetadataAsync(metadataCtx) {
52
53
  }
53
54
  }
54
55
  try {
55
- await fs_extra_1.default.writeJson(filePath, config.toSchema(), { spaces: 2 });
56
+ await fs_extra_1.default.writeJSON(filePath, config.toSchema(), { spaces: 2 });
56
57
  }
57
58
  finally {
58
59
  unsubscribeTelemetry();
@@ -75,8 +75,8 @@ function handleMetadataError(error) {
75
75
  log_1.default.error(error.errors.map(err => err.message).join('\n\n'));
76
76
  }
77
77
  log_1.default.newLine();
78
- log_1.default.log('Please check the logs for any configuration issues.');
79
- log_1.default.log('If this issue persists, please open a new issue at:');
78
+ log_1.default.log('Check the logs for any configuration issues.');
79
+ log_1.default.log('If this issue persists, open a new issue at:');
80
80
  // TODO: add execution ID to the issue template link
81
81
  log_1.default.log((0, log_1.link)('https://github.com/expo/eas-cli'));
82
82
  return;
@@ -2,8 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.uploadMetadataAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
6
- const path_1 = tslib_1.__importDefault(require("path"));
7
5
  const events_1 = require("../analytics/events");
8
6
  const log_1 = tslib_1.__importDefault(require("../log"));
9
7
  const prompts_1 = require("../prompts");
@@ -18,30 +16,13 @@ const telemetry_1 = require("./utils/telemetry");
18
16
  */
19
17
  async function uploadMetadataAsync(metadataCtx) {
20
18
  var _a;
21
- const filePath = path_1.default.resolve(metadataCtx.projectDir, metadataCtx.metadataPath);
22
- if (!(await fs_extra_1.default.pathExists(filePath))) {
23
- throw new errors_1.MetadataValidationError(`Store configuration file not found "${filePath}"`);
24
- }
25
- const fileData = await fs_extra_1.default.readJson(filePath);
26
- const { valid, errors: validationErrors } = (0, config_1.validateConfig)(fileData);
27
- if (!valid) {
28
- const error = new errors_1.MetadataValidationError(`Store configuration errors found`, validationErrors);
29
- (0, errors_1.logMetadataValidationError)(error);
30
- log_1.default.newLine();
31
- log_1.default.warn('Without further updates, the current store configuration may fail to be synchronized with the App Store or pass App Store review.');
32
- const attempt = await (0, prompts_1.confirmAsync)({
33
- message: 'Do you still want to push the store configuration?',
34
- });
35
- if (!attempt) {
36
- throw error;
37
- }
38
- }
19
+ const storeConfig = await loadConfigWithValidationPromptAsync(metadataCtx);
39
20
  const { app, auth } = await (0, context_1.ensureMetadataAppStoreAuthenticatedAsync)(metadataCtx);
40
21
  const { unsubscribeTelemetry, executionId } = (0, telemetry_1.subscribeTelemetry)(events_1.MetadataEvent.APPLE_METADATA_UPLOAD, { app, auth });
41
22
  log_1.default.addNewLineIfNone();
42
23
  log_1.default.log('Uploading App Store configuration...');
43
24
  const errors = [];
44
- const config = (0, config_1.createAppleReader)(fileData);
25
+ const config = (0, config_1.createAppleReader)(storeConfig);
45
26
  const tasks = (0, tasks_1.createAppleTasks)(metadataCtx, {
46
27
  // We need to resolve a different version as soon as possible.
47
28
  // This version is the parent model of all changes we are going to push.
@@ -71,3 +52,19 @@ async function uploadMetadataAsync(metadataCtx) {
71
52
  return { appleLink: `https://appstoreconnect.apple.com/apps/${app.id}/appstore` };
72
53
  }
73
54
  exports.uploadMetadataAsync = uploadMetadataAsync;
55
+ async function loadConfigWithValidationPromptAsync(metadataCtx) {
56
+ try {
57
+ return await (0, config_1.loadConfigAsync)(metadataCtx);
58
+ }
59
+ catch (error) {
60
+ if (error instanceof errors_1.MetadataValidationError) {
61
+ (0, errors_1.logMetadataValidationError)(error);
62
+ log_1.default.newLine();
63
+ log_1.default.warn('Without further updates, the current store configuration can fail to be synchronized with the App Store or pass App Store review.');
64
+ if (await (0, prompts_1.confirmAsync)({ message: 'Do you still want to push the store configuration?' })) {
65
+ return await (0, config_1.loadConfigAsync)({ ...metadataCtx, skipValidation: true });
66
+ }
67
+ }
68
+ throw error;
69
+ }
70
+ }
package/build/ora.js CHANGED
@@ -51,7 +51,7 @@ function ora(options) {
51
51
  // eslint-disable-next-line no-console
52
52
  console.log = logReal;
53
53
  // eslint-disable-next-line no-console
54
- console.info = logReal;
54
+ console.info = infoReal;
55
55
  // eslint-disable-next-line no-console
56
56
  console.warn = warnReal;
57
57
  // eslint-disable-next-line no-console
@@ -42,7 +42,7 @@ function importMetroConfigFromProject(projectDir) {
42
42
  if (!resolvedPath) {
43
43
  throw new MetroConfigPackageMissingError('Missing package "metro-config" in the project. ' +
44
44
  'This usually means `react-native` is not installed. ' +
45
- 'Please verify that dependencies in package.json include "react-native" ' +
45
+ 'Verify that dependencies in package.json include "react-native" ' +
46
46
  'and run `yarn` or `npm install`.');
47
47
  }
48
48
  return require(resolvedPath);
@@ -8,11 +8,28 @@ export declare function findProjectRootAsync({ cwd, defaultToProcessCwd, }?: {
8
8
  cwd?: string;
9
9
  defaultToProcessCwd?: boolean;
10
10
  }): Promise<string>;
11
- export declare function setProjectIdAsync(projectDir: string, options?: {
11
+ /**
12
+ * Save an EAS project ID to the appropriate field in the app config.
13
+ */
14
+ export declare function saveProjectIdToAppConfigAsync(projectDir: string, projectId: string, options?: {
12
15
  env?: Env;
13
- }): Promise<ExpoConfig | undefined>;
16
+ }): Promise<void>;
17
+ /**
18
+ * Use the owner/slug to identify an EAS project on the server.
19
+ *
20
+ * @returns the EAS project ID from the server
21
+ */
22
+ export declare function fetchProjectIdFromServerAsync(exp: ExpoConfig): Promise<string>;
23
+ /**
24
+ * Get the EAS project ID from the app config. If the project ID is not set in the config.
25
+ * use the owner/slug to identify an EAS project on the server, and attempt to save the
26
+ * EAS project ID to the appropriate field in the app config.
27
+ */
14
28
  export declare function getProjectIdAsync(exp: ExpoConfig, options?: {
15
29
  env?: Env;
30
+ }, findProjectRootOptions?: {
31
+ cwd?: string;
32
+ defaultToProcessCwd?: boolean;
16
33
  }): Promise<string>;
17
34
  export declare function getProjectFullNameAsync(exp: ExpoConfig): Promise<string>;
18
35
  /**
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.installExpoUpdatesAsync = exports.validateAppVersionRuntimePolicySupportAsync = exports.isExpoUpdatesInstalledOrAvailable = exports.isExpoUpdatesInstalled = exports.promptToCreateProjectIfNotExistsAsync = exports.getProjectConfigDescription = exports.getProjectFullNameAsync = exports.getProjectIdAsync = exports.setProjectIdAsync = exports.findProjectRootAsync = exports.getProjectAccountNameAsync = exports.getUsername = exports.getProjectAccountName = void 0;
3
+ exports.installExpoUpdatesAsync = exports.validateAppVersionRuntimePolicySupportAsync = exports.isExpoUpdatesInstalledOrAvailable = exports.isExpoUpdatesInstalled = exports.promptToCreateProjectIfNotExistsAsync = exports.getProjectConfigDescription = exports.getProjectFullNameAsync = exports.getProjectIdAsync = exports.fetchProjectIdFromServerAsync = exports.saveProjectIdToAppConfigAsync = exports.findProjectRootAsync = exports.getProjectAccountNameAsync = exports.getUsername = exports.getProjectAccountName = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const config_1 = require("@expo/config");
6
6
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
@@ -52,7 +52,7 @@ async function findProjectRootAsync({ cwd, defaultToProcessCwd = false, } = {})
52
52
  const projectRootDir = await (0, pkg_dir_1.default)(cwd);
53
53
  if (!projectRootDir) {
54
54
  if (!defaultToProcessCwd) {
55
- throw new Error('Please run this command inside a project directory.');
55
+ throw new Error('Run this command inside a project directory.');
56
56
  }
57
57
  else {
58
58
  return process.cwd();
@@ -71,15 +71,12 @@ async function findProjectRootAsync({ cwd, defaultToProcessCwd = false, } = {})
71
71
  }
72
72
  }
73
73
  exports.findProjectRootAsync = findProjectRootAsync;
74
- async function setProjectIdAsync(projectDir, options = {}) {
75
- var _a, _b;
74
+ /**
75
+ * Save an EAS project ID to the appropriate field in the app config.
76
+ */
77
+ async function saveProjectIdToAppConfigAsync(projectDir, projectId, options = {}) {
78
+ var _a;
76
79
  const exp = (0, expoConfig_1.getExpoConfig)(projectDir, options);
77
- const privacy = toAppPrivacy(exp.privacy);
78
- const projectId = await (0, ensureProjectExists_1.ensureProjectExistsAsync)({
79
- accountName: getProjectAccountName(exp, await (0, actions_1.ensureLoggedInAsync)()),
80
- projectName: exp.slug,
81
- privacy,
82
- });
83
80
  const result = await (0, config_1.modifyConfigAsync)(projectDir, {
84
81
  extra: { ...exp.extra, eas: { ...(_a = exp.extra) === null || _a === void 0 ? void 0 : _a.eas, projectId } },
85
82
  });
@@ -99,36 +96,48 @@ async function setProjectIdAsync(projectDir, options = {}) {
99
96
  default:
100
97
  throw new Error('Unexpected result type from modifyConfigAsync');
101
98
  }
102
- log_1.default.withTick(`Linked app.json to project with ID ${chalk_1.default.bold(projectId)}`);
103
- return (_b = result.config) === null || _b === void 0 ? void 0 : _b.expo;
104
99
  }
105
- exports.setProjectIdAsync = setProjectIdAsync;
106
- async function getProjectIdAsync(exp, options = {}) {
107
- var _a, _b, _c, _d;
108
- if (!process.env.EAS_ENABLE_PROJECT_ID) {
109
- const privacy = toAppPrivacy(exp.privacy);
110
- return await (0, ensureProjectExists_1.ensureProjectExistsAsync)({
111
- accountName: getProjectAccountName(exp, await (0, actions_1.ensureLoggedInAsync)()),
112
- projectName: exp.slug,
113
- privacy,
114
- });
115
- }
100
+ exports.saveProjectIdToAppConfigAsync = saveProjectIdToAppConfigAsync;
101
+ /**
102
+ * Use the owner/slug to identify an EAS project on the server.
103
+ *
104
+ * @returns the EAS project ID from the server
105
+ */
106
+ async function fetchProjectIdFromServerAsync(exp) {
107
+ const privacy = toAppPrivacy(exp.privacy);
108
+ return await (0, ensureProjectExists_1.ensureProjectExistsAsync)({
109
+ accountName: getProjectAccountName(exp, await (0, actions_1.ensureLoggedInAsync)()),
110
+ projectName: exp.slug,
111
+ privacy,
112
+ });
113
+ }
114
+ exports.fetchProjectIdFromServerAsync = fetchProjectIdFromServerAsync;
115
+ /**
116
+ * Get the EAS project ID from the app config. If the project ID is not set in the config.
117
+ * use the owner/slug to identify an EAS project on the server, and attempt to save the
118
+ * EAS project ID to the appropriate field in the app config.
119
+ */
120
+ async function getProjectIdAsync(exp, options = {}, findProjectRootOptions = {}) {
121
+ var _a, _b;
116
122
  const localProjectId = (_b = (_a = exp.extra) === null || _a === void 0 ? void 0 : _a.eas) === null || _b === void 0 ? void 0 : _b.projectId;
117
123
  if (localProjectId) {
118
124
  return localProjectId;
119
125
  }
120
- // Set the project ID if it is missing.
121
- const projectDir = await findProjectRootAsync();
126
+ const projectDir = await findProjectRootAsync(findProjectRootOptions);
122
127
  if (!projectDir) {
123
- throw new Error('Please run this command inside a project directory.');
128
+ throw new Error('Run this command inside a project directory.');
129
+ }
130
+ const projectId = await fetchProjectIdFromServerAsync(exp);
131
+ try {
132
+ await saveProjectIdToAppConfigAsync(projectDir, projectId, options);
124
133
  }
125
- const newExp = await setProjectIdAsync(projectDir, options);
126
- const newLocalProjectId = (_d = (_c = newExp === null || newExp === void 0 ? void 0 : newExp.extra) === null || _c === void 0 ? void 0 : _c.eas) === null || _d === void 0 ? void 0 : _d.projectId;
127
- if (!newLocalProjectId) {
128
- // throw if we still can't locate the projectId
129
- throw new Error('Could not retrieve project ID from app.json');
134
+ catch (e) {
135
+ // saveProjectIdToAppConfigAsync already printed out a set of detailed errors and
136
+ // instructions on how to fix it. To mimic throwing the error but not halting
137
+ // execution, just warn here with the error message.
138
+ log_1.default.warn(e.message);
130
139
  }
131
- return newLocalProjectId;
140
+ return projectId;
132
141
  }
133
142
  exports.getProjectIdAsync = getProjectIdAsync;
134
143
  const toAppPrivacy = (privacy) => {
@@ -14,6 +14,7 @@ const PublishMutation_1 = require("../graphql/mutations/PublishMutation");
14
14
  const PublishQuery_1 = require("../graphql/queries/PublishQuery");
15
15
  const uploads_1 = require("../uploads");
16
16
  const expoCli_1 = require("../utils/expoCli");
17
+ const chunk_1 = tslib_1.__importDefault(require("../utils/expodash/chunk"));
17
18
  const uniqBy_1 = tslib_1.__importDefault(require("../utils/expodash/uniqBy"));
18
19
  const fileMetadataJoi = joi_1.default.object({
19
20
  assets: joi_1.default.array()
@@ -205,7 +206,12 @@ async function uploadAssetsAsync(assetsForUpdateInfoGroup, projectId, updateSpin
205
206
  updateSpinnerText === null || updateSpinnerText === void 0 ? void 0 : updateSpinnerText(totalAssets, totalAssets);
206
207
  let missingAssets = await filterOutAssetsThatAlreadyExistAsync(uniqueAssets);
207
208
  const uniqueUploadedAssetCount = missingAssets.length;
208
- const { specifications } = await PublishMutation_1.PublishMutation.getUploadURLsAsync(missingAssets.map(ma => ma.contentType));
209
+ const missingAssetChunks = (0, chunk_1.default)(missingAssets, 100);
210
+ const specifications = [];
211
+ for (const missingAssets of missingAssetChunks) {
212
+ const { specifications: chunkSpecifications } = await PublishMutation_1.PublishMutation.getUploadURLsAsync(missingAssets.map(ma => ma.contentType));
213
+ specifications.push(...chunkSpecifications);
214
+ }
209
215
  updateSpinnerText === null || updateSpinnerText === void 0 ? void 0 : updateSpinnerText(totalAssets, missingAssets.length);
210
216
  const assetUploadPromiseLimit = (0, promise_limit_1.default)(15);
211
217
  const [assetLimitPerUpdateGroup] = await Promise.all([
@@ -213,7 +219,7 @@ async function uploadAssetsAsync(assetsForUpdateInfoGroup, projectId, updateSpin
213
219
  missingAssets.map((missingAsset, i) => {
214
220
  assetUploadPromiseLimit(async () => {
215
221
  const presignedPost = JSON.parse(specifications[i]);
216
- await (0, uploads_1.uploadWithPresignedPostAsync)(missingAsset.path, presignedPost);
222
+ await (0, uploads_1.uploadWithPresignedPostWithRetryAsync)(missingAsset.path, presignedPost);
217
223
  });
218
224
  }),
219
225
  ]);
@@ -24,12 +24,12 @@ var SubmissionErrorCode;
24
24
  SubmissionErrorCode["IOS_INVALID_PROVISIONING_PROFILE_SIGNATURE"] = "SUBMISSION_SERVICE_IOS_INVALID_PROVISIONING_PROFILE_SIGNATURE";
25
25
  })(SubmissionErrorCode || (SubmissionErrorCode = {}));
26
26
  const SubmissionErrorMessages = {
27
- [SubmissionErrorCode.ARCHIVE_DOWNLOAD_NOT_FOUND_ERROR]: "Failed to download the archive file (Response code: 404 Not Found). Please make sure the URL you've provided is correct.",
27
+ [SubmissionErrorCode.ARCHIVE_DOWNLOAD_NOT_FOUND_ERROR]: "Failed to download the archive file (Response code: 404 Not Found). Make sure the URL you've provided is correct.",
28
28
  [SubmissionErrorCode.ARCHIVE_DOWNLOAD_FORBIDDEN_ERROR]: 'Failed to download the archive file (Response code: 403 Forbidden). This is most probably caused by trying to upload an expired build artifact. All EAS build artifacts expire after 30 days.',
29
29
  [SubmissionErrorCode.ARCHIVE_EXTRACT_CORRUPT_ARCHIVE_ERROR]: 'The compressed archive is corrupt, in an unsupported format, or contains an invalid application format. Supported files include .apk, .aab, and .ipa files and one of these files compressed into a .tar.gz archive.',
30
30
  [SubmissionErrorCode.ARCHIVE_EXTRACT_NO_FILES_FOUND_ERROR]: "EAS Submit couldn't find a valid build artifact within provided compressed archive.\n" +
31
31
  'If you provide a tar.gz archive, it should contain at least one .apk/.aab/.ipa file, depending on the submission platform.',
32
- [SubmissionErrorCode.ANDROID_UNKNOWN_ERROR]: "We couldn't figure out what went wrong. Please see logs to learn more.",
32
+ [SubmissionErrorCode.ANDROID_UNKNOWN_ERROR]: "We couldn't figure out what went wrong. See logs to learn more.",
33
33
  [SubmissionErrorCode.ANDROID_FIRST_UPLOAD_ERROR]: "You haven't submitted this app to Google Play Store yet. The first submission of the app needs to be performed manually.\n" +
34
34
  `${(0, log_1.learnMore)('https://expo.fyi/first-android-submission')}.`,
35
35
  [SubmissionErrorCode.ANDROID_OLD_VERSION_CODE_ERROR]: "You've already submitted this version of the app.\n" +
@@ -42,22 +42,22 @@ const SubmissionErrorMessages = {
42
42
  'Versions are identified by Build Numbers (expo.ios.buildNumber in app.json).\n' +
43
43
  "If you're submitting an Expo project built with EAS Build, increment the build number in app.json and build the project again.\n" +
44
44
  `${(0, log_1.learnMore)('https://expo.fyi/bumping-ios-build-number')}.`,
45
- [SubmissionErrorCode.IOS_UNKNOWN_ERROR]: "We couldn't figure out what went wrong. Please see logs to learn more.",
45
+ [SubmissionErrorCode.IOS_UNKNOWN_ERROR]: "We couldn't figure out what went wrong. See logs to learn more.",
46
46
  [SubmissionErrorCode.IOS_MISSING_APP_ICON]: 'Your iOS app icon is missing or is an invalid format. The icon must be a 1024x1024 PNG image with no transparency.\n' +
47
- 'Please check your icon image and icon configuration in app.json.\n' +
47
+ 'Check your icon image and icon configuration in app.json.\n' +
48
48
  `${(0, log_1.learnMore)('https://docs.expo.dev/guides/app-icons/')}`,
49
49
  [SubmissionErrorCode.IOS_INVALID_SIGNATURE]: 'Your app signature seems to be invalid.\n' +
50
- "Please check your iOS Distribution Certificate and your app's Provisioning Profile.\n" +
50
+ "Check your iOS Distribution Certificate and your app's Provisioning Profile.\n" +
51
51
  `${(0, log_1.learnMore)('https://docs.expo.dev/distribution/app-signing')}`,
52
- [SubmissionErrorCode.IOS_INCORRECT_CREDENTIALS]: 'Your Apple ID or app-specific password is incorrect. Please verify that you entered them correctly and try again.',
52
+ [SubmissionErrorCode.IOS_INCORRECT_CREDENTIALS]: 'Your Apple ID or app-specific password is incorrect. Verify that you entered them correctly and try again.',
53
53
  [SubmissionErrorCode.IOS_IPAD_INVALID_ORIENTATION]: "Your app doesn't support iPad multitasking and has to require full screen.\n" +
54
54
  "If you're submitting a managed Expo project, set the `expo.ios.requireFullScreen` to true in app.json and build the project again.\n" +
55
55
  `${(0, log_1.learnMore)('https://expo.fyi/ipad-requires-fullscreen')}`,
56
- [SubmissionErrorCode.IOS_APPLE_MAINTENANCE]: 'It looks like Apple servers are undergoing an unscheduled maintenance. Please try again later.',
56
+ [SubmissionErrorCode.IOS_APPLE_MAINTENANCE]: 'It looks like Apple servers are undergoing an unscheduled maintenance. Try again later.',
57
57
  [SubmissionErrorCode.IOS_INVALID_PROVISIONING_PROFILE_SIGNATURE]: 'Invalid Provisioning Profile Signature (ITMS-90165)\n' +
58
58
  "Some of Apple's certificates have expired.\n" +
59
- 'Please delete your Provisioning Profile from your account. Then rebuild the app interactively to generate a new one, and try submitting it to the App Store again.',
60
- [SubmissionErrorCode.UPLOAD_TAKING_TOO_LONG_ERROR]: 'Submission has reached the timeout limit. Please try again.',
59
+ 'Delete your Provisioning Profile from your account. Then rebuild the app interactively to generate a new one, and try submitting it to the App Store again.',
60
+ [SubmissionErrorCode.UPLOAD_TAKING_TOO_LONG_ERROR]: 'Submission has reached the timeout limit. Try again.',
61
61
  };
62
62
  function printSubmissionError(error) {
63
63
  if (error.errorCode &&
@@ -12,14 +12,11 @@ const APP_STORE_NAMES = {
12
12
  [generated_1.AppPlatform.Android]: 'Google Play Store',
13
13
  [generated_1.AppPlatform.Ios]: 'Apple App Store Connect',
14
14
  };
15
- const CHECK_TIMEOUT_MS = 3600000;
16
15
  const CHECK_INTERVAL_MS = 5000;
17
16
  async function waitForSubmissionsEndAsync(initialSubmissions) {
18
17
  log_1.default.log(`Waiting for submission${initialSubmissions.length > 1 ? 's' : ''} to complete. You can press Ctrl+C to exit.`);
19
18
  const spinner = (0, ora_1.ora)(`Submitting`).start();
20
- let time = new Date().getTime();
21
- const timeoutTime = time + CHECK_TIMEOUT_MS;
22
- while (time <= timeoutTime) {
19
+ while (true) {
23
20
  const submissions = await Promise.all(initialSubmissions.map(({ id }) => {
24
21
  try {
25
22
  return SubmissionQuery_1.SubmissionQuery.byIdAsync(id, { useCache: false });
@@ -69,11 +66,8 @@ async function waitForSubmissionsEndAsync(initialSubmissions) {
69
66
  return submissions.map(s => (0, nullthrows_1.default)(s));
70
67
  }
71
68
  }
72
- time = new Date().getTime();
73
69
  await (0, promise_1.sleepAsync)(CHECK_INTERVAL_MS);
74
70
  }
75
- spinner.warn('Timed out');
76
- throw new Error('Timeout reached! It is taking longer than expected to complete, aborting...');
77
71
  }
78
72
  exports.waitForSubmissionsEndAsync = waitForSubmissionsEndAsync;
79
73
  function getSingleSpinnerText(submission) {
@@ -52,7 +52,7 @@ function formatUpdate(update) {
52
52
  exports.formatUpdate = formatUpdate;
53
53
  function ensureValidVersions(exp, platform) {
54
54
  var _a, _b;
55
- const error = new Error(`Couldn't find either ${chalk_1.default.bold('runtimeVersion')} or ${chalk_1.default.bold('sdkVersion')} to configure ${chalk_1.default.bold('expo-updates')}. Please specify at least one of these properties under the ${chalk_1.default.bold('expo')} key in ${chalk_1.default.bold('app.json')}. ${(0, log_1.learnMore)('https://docs.expo.dev/eas-update/runtime-versions/')}`);
55
+ const error = new Error(`Couldn't find either ${chalk_1.default.bold('runtimeVersion')} or ${chalk_1.default.bold('sdkVersion')} to configure ${chalk_1.default.bold('expo-updates')}. Specify at least one of these properties under the ${chalk_1.default.bold('expo')} key in ${chalk_1.default.bold('app.json')}. ${(0, log_1.learnMore)('https://docs.expo.dev/eas-update/runtime-versions/')}`);
56
56
  if ([platform_1.RequestedPlatform.Android, platform_1.RequestedPlatform.All].includes(platform) &&
57
57
  !(((_a = exp.android) === null || _a === void 0 ? void 0 : _a.runtimeVersion) || exp.runtimeVersion) &&
58
58
  !exp.sdkVersion) {
@@ -6,7 +6,7 @@ export declare function uploadFileAtPathToS3Async(type: UploadSessionType, path:
6
6
  url: string;
7
7
  bucketKey: string;
8
8
  }>;
9
- export declare function uploadWithPresignedPostAsync(file: string, presignedPost: PresignedPost, handleProgressEvent?: ProgressHandler): Promise<Response>;
9
+ export declare function uploadWithPresignedPostWithRetryAsync(file: string, presignedPost: PresignedPost): Promise<Response>;
10
10
  /**
11
11
  * S3 returns broken URLs, sth like:
12
12
  * https://submission-service-archives.s3.amazonaws.com/production%2Fdc98ca84-1473-4cb3-ae81-8c7b291cb27e%2F4424aa95-b985-4e2f-8755-9507b1037c1c
package/build/uploads.js CHANGED
@@ -1,24 +1,54 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fixS3Url = exports.uploadWithPresignedPostAsync = exports.uploadFileAtPathToS3Async = void 0;
3
+ exports.fixS3Url = exports.uploadWithPresignedPostWithRetryAsync = exports.uploadFileAtPathToS3Async = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const assert_1 = tslib_1.__importDefault(require("assert"));
6
6
  const form_data_1 = tslib_1.__importDefault(require("form-data"));
7
7
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
8
8
  const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
9
+ const promise_retry_1 = tslib_1.__importDefault(require("promise-retry"));
9
10
  const url_1 = require("url");
10
11
  const fetch_1 = tslib_1.__importDefault(require("./fetch"));
11
12
  const UploadSessionMutation_1 = require("./graphql/mutations/UploadSessionMutation");
12
13
  async function uploadFileAtPathToS3Async(type, path, handleProgressEvent) {
13
14
  const presignedPost = await UploadSessionMutation_1.UploadSessionMutation.createUploadSessionAsync(type);
14
15
  (0, assert_1.default)(presignedPost.fields.key, 'key is not specified in in presigned post');
15
- const response = await uploadWithPresignedPostAsync(path, presignedPost, handleProgressEvent);
16
+ const response = await uploadWithPresignedPostWithProgressAsync(path, presignedPost, handleProgressEvent);
16
17
  const location = (0, nullthrows_1.default)(response.headers.get('location'), `location does not exist in response headers (make sure you're uploading to AWS S3)`);
17
18
  const url = fixS3Url(location);
18
19
  return { url, bucketKey: presignedPost.fields.key };
19
20
  }
20
21
  exports.uploadFileAtPathToS3Async = uploadFileAtPathToS3Async;
21
- async function uploadWithPresignedPostAsync(file, presignedPost, handleProgressEvent) {
22
+ async function uploadWithPresignedPostWithRetryAsync(file, presignedPost) {
23
+ return await (0, promise_retry_1.default)(async (retry) => {
24
+ // retry fetch errors (usually connection or DNS errors)
25
+ let response;
26
+ try {
27
+ response = await uploadWithPresignedPostAsync(file, presignedPost);
28
+ }
29
+ catch (e) {
30
+ return retry(e);
31
+ }
32
+ // retry 408, 429, 5xx as suggested by google
33
+ if (response.status === 408 ||
34
+ response.status === 429 ||
35
+ (response.status >= 500 && response.status <= 599)) {
36
+ return retry(new Error(`Presigned upload responded with a ${response.status} status`));
37
+ }
38
+ // don't retry other errors
39
+ if (!response.ok) {
40
+ throw new Error(`Presigned upload responded with a ${response.status} status`);
41
+ }
42
+ return response;
43
+ },
44
+ // retry parameters match google suggested defaults: https://cloud.google.com/storage/docs/retry-strategy#node.js
45
+ {
46
+ retries: 3,
47
+ factor: 2,
48
+ });
49
+ }
50
+ exports.uploadWithPresignedPostWithRetryAsync = uploadWithPresignedPostWithRetryAsync;
51
+ async function createPresignedPostFormDataAsync(file, presignedPost) {
22
52
  const fileStat = await fs_extra_1.default.stat(file);
23
53
  const fileSize = fileStat.size;
24
54
  const form = new form_data_1.default();
@@ -26,6 +56,21 @@ async function uploadWithPresignedPostAsync(file, presignedPost, handleProgressE
26
56
  form.append(fieldKey, fieldValue);
27
57
  }
28
58
  form.append('file', fs_extra_1.default.createReadStream(file), { knownLength: fileSize });
59
+ return { form, fileSize };
60
+ }
61
+ async function uploadWithPresignedPostAsync(file, presignedPost) {
62
+ const { form } = await createPresignedPostFormDataAsync(file, presignedPost);
63
+ const formHeaders = form.getHeaders();
64
+ return await (0, fetch_1.default)(presignedPost.url, {
65
+ method: 'POST',
66
+ body: form,
67
+ headers: {
68
+ ...formHeaders,
69
+ },
70
+ });
71
+ }
72
+ async function uploadWithPresignedPostWithProgressAsync(file, presignedPost, handleProgressEvent) {
73
+ const { form, fileSize } = await createPresignedPostFormDataAsync(file, presignedPost);
29
74
  const formHeaders = form.getHeaders();
30
75
  const uploadPromise = (0, fetch_1.default)(presignedPost.url, {
31
76
  method: 'POST',
@@ -35,32 +80,26 @@ async function uploadWithPresignedPostAsync(file, presignedPost, handleProgressE
35
80
  },
36
81
  });
37
82
  let currentSize = 0;
38
- if (handleProgressEvent) {
39
- form.addListener('data', (chunk) => {
40
- currentSize += Buffer.byteLength(chunk);
41
- handleProgressEvent({
42
- progress: {
43
- total: fileSize,
44
- percent: currentSize / fileSize,
45
- transferred: currentSize,
46
- },
47
- });
83
+ form.addListener('data', (chunk) => {
84
+ currentSize += Buffer.byteLength(chunk);
85
+ handleProgressEvent({
86
+ progress: {
87
+ total: fileSize,
88
+ percent: currentSize / fileSize,
89
+ transferred: currentSize,
90
+ },
48
91
  });
49
- try {
50
- const response = await uploadPromise;
51
- handleProgressEvent({ isComplete: true });
52
- return response;
53
- }
54
- catch (error) {
55
- handleProgressEvent({ isComplete: true, error });
56
- throw error;
57
- }
92
+ });
93
+ try {
94
+ const response = await uploadPromise;
95
+ handleProgressEvent({ isComplete: true });
96
+ return response;
58
97
  }
59
- else {
60
- return await uploadPromise;
98
+ catch (error) {
99
+ handleProgressEvent({ isComplete: true, error });
100
+ throw error;
61
101
  }
62
102
  }
63
- exports.uploadWithPresignedPostAsync = uploadWithPresignedPostAsync;
64
103
  /**
65
104
  * S3 returns broken URLs, sth like:
66
105
  * https://submission-service-archives.s3.amazonaws.com/production%2Fdc98ca84-1473-4cb3-ae81-8c7b291cb27e%2F4424aa95-b985-4e2f-8755-9507b1037c1c
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isGitCaseSensitiveAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const PackageManagerUtils = tslib_1.__importStar(require("@expo/package-manager"));
5
6
  const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
6
7
  const core_1 = require("@oclif/core");
7
8
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
@@ -12,6 +13,7 @@ const git_1 = require("../git");
12
13
  const vcs_1 = require("../vcs");
13
14
  class GitClient extends vcs_1.Client {
14
15
  async ensureRepoExistsAsync() {
16
+ var _a;
15
17
  if (!(await (0, git_1.isGitInstalledAsync)())) {
16
18
  log_1.default.error(`${chalk_1.default.bold('git')} command not found. Install it before proceeding or set ${chalk_1.default.bold('EAS_NO_VCS=1')} to use EAS CLI without Git (or any other version control system).`);
17
19
  log_1.default.error((0, log_1.learnMore)('https://expo.fyi/eas-vcs-workflow'));
@@ -22,13 +24,15 @@ class GitClient extends vcs_1.Client {
22
24
  }
23
25
  log_1.default.warn("It looks like you haven't initialized the git repository yet.");
24
26
  log_1.default.warn('EAS Build requires you to use a git repository for your project.');
27
+ const cwd = process.cwd();
28
+ const repoRoot = (_a = PackageManagerUtils.findWorkspaceRoot(cwd)) !== null && _a !== void 0 ? _a : cwd;
25
29
  const confirmInit = await (0, prompts_1.confirmAsync)({
26
- message: `Would you like us to run 'git init' in the current directory for you?`,
30
+ message: `Would you like us to run 'git init' in ${repoRoot} for you?`,
27
31
  });
28
32
  if (!confirmInit) {
29
33
  throw new Error('A git repository is required for building your project. Initialize it and run this command again.');
30
34
  }
31
- await (0, spawn_async_1.default)('git', ['init']);
35
+ await (0, spawn_async_1.default)('git', ['init'], { cwd: repoRoot });
32
36
  log_1.default.log("We're going to make an initial commit for your repository.");
33
37
  const { message } = await (0, prompts_1.promptAsync)({
34
38
  type: 'text',
@@ -15,5 +15,6 @@ export declare class Ignore {
15
15
  constructor(rootDir: string);
16
16
  initIgnoreAsync(): Promise<void>;
17
17
  ignores(relativePath: string): boolean;
18
+ private readIgnoreFileAsync;
18
19
  }
19
20
  export declare function makeShallowCopyAsync(src: string, dst: string): Promise<void>;