eas-cli 19.1.0 → 20.1.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 (51) hide show
  1. package/README.md +371 -100
  2. package/build/commands/go.d.ts +1 -0
  3. package/build/commands/go.js +29 -1
  4. package/build/commands/observe/events.d.ts +3 -3
  5. package/build/commands/observe/events.js +69 -51
  6. package/build/commands/observe/{logs.d.ts → metrics-summary.d.ts} +3 -11
  7. package/build/commands/observe/metrics-summary.js +95 -0
  8. package/build/commands/observe/metrics.d.ts +8 -3
  9. package/build/commands/observe/metrics.js +63 -47
  10. package/build/commands/observe/routes.d.ts +0 -1
  11. package/build/commands/observe/routes.js +0 -4
  12. package/build/commands/observe/versions.d.ts +0 -1
  13. package/build/commands/observe/versions.js +0 -4
  14. package/build/commands/simulator/exec.d.ts +12 -0
  15. package/build/commands/simulator/exec.js +42 -0
  16. package/build/commands/simulator/get.d.ts +2 -1
  17. package/build/commands/simulator/get.js +13 -7
  18. package/build/commands/simulator/start.d.ts +3 -0
  19. package/build/commands/simulator/start.js +65 -5
  20. package/build/commands/simulator/stop.d.ts +2 -1
  21. package/build/commands/simulator/stop.js +16 -9
  22. package/build/commands/update/embedded/delete.d.ts +15 -0
  23. package/build/commands/update/embedded/delete.js +55 -0
  24. package/build/commands/update/embedded/list.d.ts +19 -0
  25. package/build/commands/update/embedded/list.js +132 -0
  26. package/build/commands/update/embedded/upload.d.ts +20 -0
  27. package/build/commands/update/embedded/upload.js +129 -0
  28. package/build/commands/update/embedded/view.d.ts +17 -0
  29. package/build/commands/update/embedded/view.js +75 -0
  30. package/build/graphql/client.js +1 -0
  31. package/build/graphql/generated.d.ts +434 -4
  32. package/build/graphql/generated.js +35 -1
  33. package/build/graphql/mutations/EmbeddedUpdateAssetMutation.d.ts +13 -0
  34. package/build/graphql/mutations/EmbeddedUpdateAssetMutation.js +32 -0
  35. package/build/graphql/mutations/EmbeddedUpdateMutation.d.ts +19 -0
  36. package/build/graphql/mutations/EmbeddedUpdateMutation.js +51 -0
  37. package/build/graphql/queries/EmbeddedUpdateQuery.d.ts +18 -0
  38. package/build/graphql/queries/EmbeddedUpdateQuery.js +81 -0
  39. package/build/graphql/queries/WorkflowRunQuery.d.ts +2 -1
  40. package/build/graphql/queries/WorkflowRunQuery.js +19 -6
  41. package/build/observe/formatCustomEvents.js +5 -5
  42. package/build/observe/metricNames.js +2 -0
  43. package/build/simulator/env.d.ts +7 -0
  44. package/build/simulator/env.js +44 -0
  45. package/build/simulator/utils.d.ts +3 -1
  46. package/build/simulator/utils.js +26 -7
  47. package/build/update/embeddedManifest.d.ts +3 -0
  48. package/build/update/embeddedManifest.js +28 -0
  49. package/oclif.manifest.json +2803 -2309
  50. package/package.json +6 -6
  51. package/build/commands/observe/logs.js +0 -141
@@ -0,0 +1,129 @@
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 config_plugins_1 = require("@expo/config-plugins");
6
+ const core_1 = require("@oclif/core");
7
+ const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
8
+ const EasCommand_1 = tslib_1.__importDefault(require("../../../commandUtils/EasCommand"));
9
+ const flags_1 = require("../../../commandUtils/flags");
10
+ const EmbeddedUpdateAssetMutation_1 = require("../../../graphql/mutations/EmbeddedUpdateAssetMutation");
11
+ const EmbeddedUpdateMutation_1 = require("../../../graphql/mutations/EmbeddedUpdateMutation");
12
+ const AppPlatform_1 = require("../../../graphql/types/AppPlatform");
13
+ const log_1 = tslib_1.__importDefault(require("../../../log"));
14
+ const ora_1 = require("../../../ora");
15
+ const embeddedManifest_1 = require("../../../update/embeddedManifest");
16
+ const uploads_1 = require("../../../uploads");
17
+ const json_1 = require("../../../utils/json");
18
+ const promise_1 = require("../../../utils/promise");
19
+ const MAX_ATTEMPTS = 10;
20
+ const RETRY_BASE_DELAY_MS = 3_000;
21
+ const RETRY_MAX_DELAY_MS = 10_000;
22
+ class UpdateEmbeddedUpload extends EasCommand_1.default {
23
+ static description = 'upload the JS bundle embedded in a native build so EAS Update can generate bsdiff patches against it';
24
+ static examples = [
25
+ '$ eas update:embedded:upload --platform ios --bundle ios/build/App.app/main.jsbundle --manifest ios/build/App.app/app.manifest --channel production',
26
+ '$ eas update:embedded:upload --platform android --bundle android/app/src/main/assets/index.android.bundle --manifest android/app/src/main/assets/app.manifest --channel production --build-id <BUILD-ID>',
27
+ ];
28
+ static flags = {
29
+ platform: core_1.Flags.option({
30
+ char: 'p',
31
+ description: 'Platform of the embedded bundle',
32
+ options: [eas_build_job_1.Platform.IOS, eas_build_job_1.Platform.ANDROID],
33
+ required: true,
34
+ })(),
35
+ bundle: core_1.Flags.string({
36
+ description: 'Path to the embedded JS bundle file',
37
+ required: true,
38
+ }),
39
+ manifest: core_1.Flags.string({
40
+ description: 'Path to the app.manifest file embedded in the build',
41
+ required: true,
42
+ }),
43
+ channel: core_1.Flags.string({
44
+ description: 'Channel name the embedded update should be associated with',
45
+ required: true,
46
+ }),
47
+ 'build-id': core_1.Flags.string({
48
+ description: 'EAS Build ID that produced this binary (required when invoked from EAS Build)',
49
+ required: false,
50
+ }),
51
+ ...flags_1.EasNonInteractiveAndJsonFlags,
52
+ };
53
+ static contextDefinition = {
54
+ ...this.ContextOptions.ProjectConfig,
55
+ };
56
+ async runAsync() {
57
+ const { flags } = await this.parse(UpdateEmbeddedUpload);
58
+ const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
59
+ const platform = flags.platform;
60
+ const bundlePath = flags.bundle;
61
+ const manifestPath = flags.manifest;
62
+ const channelName = flags.channel;
63
+ const buildId = flags['build-id'];
64
+ const { loggedIn: { graphqlClient }, privateProjectConfig: { projectId, exp, projectDir }, } = await this.getContextAsync(UpdateEmbeddedUpload, {
65
+ nonInteractive,
66
+ withServerSideEnvironment: null,
67
+ });
68
+ if (jsonFlag) {
69
+ (0, json_1.enableJsonOutput)();
70
+ }
71
+ if (!(await fs_extra_1.default.pathExists(bundlePath))) {
72
+ core_1.Errors.error(`Bundle file not found at "${bundlePath}". Check that the path is correct and points to the JS bundle in your native build output.`, { exit: 1 });
73
+ }
74
+ const { id: embeddedUpdateId } = await (0, embeddedManifest_1.readEmbeddedManifestAsync)(manifestPath);
75
+ const runtimeVersion = await config_plugins_1.Updates.getRuntimeVersionNullableAsync(projectDir, exp, platform);
76
+ if (runtimeVersion === null) {
77
+ core_1.Errors.error(`Could not resolve runtimeVersion for platform "${platform}". ` +
78
+ `Ensure runtimeVersion is set in your app.json under the expo key.`, { exit: 1 });
79
+ }
80
+ const appPlatform = (0, AppPlatform_1.toAppPlatform)(platform);
81
+ const uploadSpinner = (0, ora_1.ora)('Uploading bundle...').start();
82
+ const contentType = 'application/javascript';
83
+ const uploadSpec = await EmbeddedUpdateAssetMutation_1.EmbeddedUpdateAssetMutation.getSignedUploadSpecAsync(graphqlClient, {
84
+ appId: projectId,
85
+ embeddedUpdateId,
86
+ contentType,
87
+ });
88
+ await (0, uploads_1.uploadWithPresignedPostWithRetryAsync)(bundlePath, { url: uploadSpec.presignedUrl, fields: uploadSpec.fields }, () => { });
89
+ uploadSpinner.succeed('Uploaded bundle');
90
+ const registerSpinner = (0, ora_1.ora)('Registering embedded update...').start();
91
+ let embeddedUpdate;
92
+ for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
93
+ try {
94
+ embeddedUpdate = await EmbeddedUpdateMutation_1.EmbeddedUpdateMutation.uploadEmbeddedUpdateAsync(graphqlClient, {
95
+ appId: projectId,
96
+ platform: appPlatform,
97
+ runtimeVersion,
98
+ channel: channelName,
99
+ embeddedUpdateId,
100
+ turtleBuildId: buildId,
101
+ });
102
+ break;
103
+ }
104
+ catch (e) {
105
+ if ((0, EmbeddedUpdateMutation_1.isEmbeddedUpdateAssetNotAvailableError)(e)) {
106
+ if (attempt < MAX_ATTEMPTS) {
107
+ await (0, promise_1.sleepAsync)(Math.min(RETRY_BASE_DELAY_MS * 2 ** (attempt - 1), RETRY_MAX_DELAY_MS));
108
+ }
109
+ continue;
110
+ }
111
+ registerSpinner.fail('Failed to register embedded update');
112
+ if ((0, EmbeddedUpdateMutation_1.isEmbeddedUpdateAlreadyExistsError)(e)) {
113
+ core_1.Errors.error(`An embedded update with id "${embeddedUpdateId}" is already registered for this app. Delete it before re-uploading.`, { exit: 1 });
114
+ }
115
+ throw e;
116
+ }
117
+ }
118
+ if (embeddedUpdate === undefined) {
119
+ registerSpinner.fail('Failed to register embedded update');
120
+ throw new Error('Embedded bundle could not be processed in time. Try re-running the command in a moment.');
121
+ }
122
+ registerSpinner.succeed(`Registered ${platform} embedded update (runtimeVersion: ${runtimeVersion}, channel: "${channelName}")`);
123
+ log_1.default.log(`Embedded update ID: ${embeddedUpdate.id}`);
124
+ if (jsonFlag) {
125
+ (0, json_1.printJsonOnlyOutput)(embeddedUpdate);
126
+ }
127
+ }
128
+ }
129
+ exports.default = UpdateEmbeddedUpload;
@@ -0,0 +1,17 @@
1
+ import EasCommand from '../../../commandUtils/EasCommand';
2
+ import { EmbeddedUpdateFragment } from '../../../graphql/queries/EmbeddedUpdateQuery';
3
+ export default class UpdateEmbeddedView extends EasCommand {
4
+ static description: string;
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ };
11
+ static contextDefinition: {
12
+ loggedIn: import("../../../commandUtils/context/LoggedInContextField").default;
13
+ projectId: import("../../../commandUtils/context/ProjectIdContextField").ProjectIdContextField;
14
+ };
15
+ runAsync(): Promise<void>;
16
+ }
17
+ export declare function formatEmbeddedUpdate(embeddedUpdate: EmbeddedUpdateFragment): string;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatEmbeddedUpdate = formatEmbeddedUpdate;
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@oclif/core");
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const EasCommand_1 = tslib_1.__importDefault(require("../../../commandUtils/EasCommand"));
8
+ const flags_1 = require("../../../commandUtils/flags");
9
+ const EmbeddedUpdateQuery_1 = require("../../../graphql/queries/EmbeddedUpdateQuery");
10
+ const log_1 = tslib_1.__importDefault(require("../../../log"));
11
+ const date_1 = require("../../../utils/date");
12
+ const files_1 = require("../../../utils/files");
13
+ const formatFields_1 = tslib_1.__importDefault(require("../../../utils/formatFields"));
14
+ const json_1 = require("../../../utils/json");
15
+ class UpdateEmbeddedView extends EasCommand_1.default {
16
+ static description = 'view details of an embedded update registered with EAS Update';
17
+ static args = {
18
+ id: core_1.Args.string({
19
+ required: true,
20
+ description: 'The ID of the embedded update (manifest UUID from app.manifest).',
21
+ }),
22
+ };
23
+ static flags = {
24
+ ...flags_1.EasJsonOnlyFlag,
25
+ };
26
+ static contextDefinition = {
27
+ ...this.ContextOptions.ProjectId,
28
+ ...this.ContextOptions.LoggedIn,
29
+ };
30
+ async runAsync() {
31
+ const { args: { id: embeddedUpdateId }, flags: { json: jsonFlag }, } = await this.parse(UpdateEmbeddedView);
32
+ const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(UpdateEmbeddedView, { nonInteractive: true });
33
+ if (jsonFlag) {
34
+ (0, json_1.enableJsonOutput)();
35
+ }
36
+ let embeddedUpdate;
37
+ try {
38
+ embeddedUpdate = await EmbeddedUpdateQuery_1.EmbeddedUpdateQuery.viewByIdAsync(graphqlClient, {
39
+ embeddedUpdateId,
40
+ appId: projectId,
41
+ });
42
+ }
43
+ catch (e) {
44
+ if ((0, EmbeddedUpdateQuery_1.isEmbeddedUpdateNotFoundError)(e)) {
45
+ core_1.Errors.error(`No embedded update found with id "${embeddedUpdateId}" for this project. ` +
46
+ `Run "eas update:embedded:list" to see the embedded updates registered for this app.`, { exit: 1 });
47
+ }
48
+ throw e;
49
+ }
50
+ if (jsonFlag) {
51
+ (0, json_1.printJsonOnlyOutput)(embeddedUpdate);
52
+ return;
53
+ }
54
+ log_1.default.addNewLineIfNone();
55
+ log_1.default.log(chalk_1.default.bold('Embedded update:'));
56
+ log_1.default.log(formatEmbeddedUpdate(embeddedUpdate));
57
+ }
58
+ }
59
+ exports.default = UpdateEmbeddedView;
60
+ function formatEmbeddedUpdate(embeddedUpdate) {
61
+ const createdAt = new Date(embeddedUpdate.createdAt);
62
+ const bundleSize = embeddedUpdate.launchAsset.finalFileSize ?? embeddedUpdate.launchAsset.fileSize;
63
+ return (0, formatFields_1.default)([
64
+ { label: 'ID', value: embeddedUpdate.id },
65
+ { label: 'Platform', value: embeddedUpdate.platform.toLowerCase() },
66
+ { label: 'Runtime version', value: embeddedUpdate.runtimeVersion },
67
+ { label: 'Channel', value: embeddedUpdate.channel },
68
+ { label: 'Bundle size', value: (0, files_1.formatBytes)(bundleSize) },
69
+ { label: 'Bundle SHA-256', value: embeddedUpdate.launchAsset.fileSHA256 },
70
+ {
71
+ label: 'Created at',
72
+ value: `${createdAt.toLocaleString()} (${(0, date_1.fromNow)(createdAt)} ago)`,
73
+ },
74
+ ]);
75
+ }
@@ -16,6 +16,7 @@ async function withErrorHandlingAsync(promise) {
16
16
  ![
17
17
  'EAS_BUILD_FREE_TIER_LIMIT_EXCEEDED',
18
18
  'EAS_BUILD_FREE_TIER_IOS_LIMIT_EXCEEDED',
19
+ 'EMBEDDED_UPDATE_ASSET_NOT_AVAILABLE',
19
20
  ].includes(e?.extensions?.errorCode))) {
20
21
  log_1.default.error(`We've encountered a transient error. Try again shortly.`);
21
22
  }