eas-cli 20.5.1 → 21.0.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 (59) hide show
  1. package/README.md +171 -178
  2. package/build/analytics/AnalyticsManager.js +3 -0
  3. package/build/analytics/agent.d.ts +5 -0
  4. package/build/analytics/agent.js +26 -0
  5. package/build/build/utils/url.d.ts +1 -0
  6. package/build/build/utils/url.js +6 -1
  7. package/build/commandUtils/workflow/buildProfileUtils.d.ts +11 -29
  8. package/build/commandUtils/workflow/buildProfileUtils.js +47 -126
  9. package/build/commandUtils/workflow/creation.d.ts +11 -3
  10. package/build/commandUtils/workflow/creation.js +151 -261
  11. package/build/commands/browse.d.ts +17 -0
  12. package/build/commands/browse.js +90 -0
  13. package/build/commands/deploy/index.d.ts +1 -0
  14. package/build/commands/deploy/index.js +15 -1
  15. package/build/commands/integrations/posthog/dashboard.d.ts +1 -0
  16. package/build/commands/integrations/posthog/dashboard.js +30 -6
  17. package/build/commands/observe/metrics.js +1 -1
  18. package/build/commands/open.d.ts +1 -4
  19. package/build/commands/open.js +4 -32
  20. package/build/commands/project/delete.d.ts +16 -0
  21. package/build/commands/project/delete.js +129 -0
  22. package/build/commands/project/init.d.ts +0 -7
  23. package/build/commands/project/init.js +4 -274
  24. package/build/commands/simulator/get.js +57 -4
  25. package/build/commands/simulator/start.js +1 -0
  26. package/build/commands/workflow/create.d.ts +3 -0
  27. package/build/commands/workflow/create.js +118 -87
  28. package/build/credentials/ios/appstore/bundleIdCapabilities.js +9 -3
  29. package/build/graphql/generated.d.ts +253 -253
  30. package/build/graphql/generated.js +41 -4
  31. package/build/graphql/mutations/AppMutation.d.ts +2 -0
  32. package/build/graphql/mutations/AppMutation.js +19 -0
  33. package/build/graphql/mutations/PostHogMutation.d.ts +2 -1
  34. package/build/graphql/mutations/PostHogMutation.js +14 -0
  35. package/build/graphql/queries/DeviceRunSessionQuery.js +15 -0
  36. package/build/graphql/queries/UserQuery.js +0 -10
  37. package/build/graphql/queries/WorkflowRunQuery.js +1 -0
  38. package/build/integrations/asc/utils.js +6 -4
  39. package/build/observe/metricNames.d.ts +1 -1
  40. package/build/observe/metricNames.js +7 -6
  41. package/build/project/android/applicationId.d.ts +2 -1
  42. package/build/project/android/applicationId.js +19 -11
  43. package/build/project/ios/bundleIdentifier.d.ts +2 -1
  44. package/build/project/ios/bundleIdentifier.js +19 -11
  45. package/build/project/projectInitialization.d.ts +9 -0
  46. package/build/project/projectInitialization.js +277 -0
  47. package/build/project/publish.js +73 -40
  48. package/build/user/sudo.d.ts +14 -0
  49. package/build/user/sudo.js +62 -0
  50. package/build/worker/deployment.d.ts +11 -1
  51. package/build/worker/deployment.js +71 -22
  52. package/build/worker/queries.d.ts +2 -1
  53. package/build/worker/queries.js +18 -0
  54. package/oclif.manifest.json +1764 -1602
  55. package/package.json +9 -8
  56. package/build/commands/project/onboarding.d.ts +0 -14
  57. package/build/commands/project/onboarding.js +0 -362
  58. package/build/graphql/mutations/UserPreferencesMutation.d.ts +0 -10
  59. package/build/graphql/mutations/UserPreferencesMutation.js +0 -41
@@ -26,7 +26,11 @@ const isDirectory = (directoryPath) => node_fs_1.default.promises
26
26
  class WorkerDeploy extends EasCommand_1.default {
27
27
  static description = 'deploy your Expo Router web build and API Routes';
28
28
  static aliases = ['worker:deploy'];
29
- static usage = [(0, chalk_1.default) `deploy {dim [options]}`, `deploy --prod`];
29
+ static usage = [
30
+ (0, chalk_1.default) `deploy {dim [options]}`,
31
+ `deploy --prod`,
32
+ `deploy --non-interactive --dev-domain my-app`,
33
+ ];
30
34
  static state = 'preview';
31
35
  static flags = {
32
36
  prod: core_1.Flags.boolean({
@@ -42,6 +46,10 @@ class WorkerDeploy extends EasCommand_1.default {
42
46
  description: 'Custom unique identifier for the new deployment.',
43
47
  helpValue: 'xyz123',
44
48
  }),
49
+ 'dev-domain': core_1.Flags.string({
50
+ description: `Custom preview URL subdomain to assign to the project on its first deployment, e.g. "my-app" for my-app.${logs_1.EXPO_BASE_DOMAIN}.app. Required with --non-interactive if you want to customize the preview URL.`,
51
+ helpValue: 'name',
52
+ }),
45
53
  'export-dir': core_1.Flags.string({
46
54
  description: 'Directory where the Expo project was exported.',
47
55
  helpValue: 'dir',
@@ -217,6 +225,7 @@ class WorkerDeploy extends EasCommand_1.default {
217
225
  const uploadUrl = await (0, deployment_1.getSignedDeploymentUrlAsync)(graphqlClient, {
218
226
  appId: projectId,
219
227
  deploymentIdentifier: flags.deploymentIdentifier,
228
+ devDomainName: flags.devDomainName,
220
229
  // NOTE(cedric): this function might ask the user for a dev-domain name,
221
230
  // when that happens, no ora spinner should be running.
222
231
  onSetupDevDomain: () => progress.stop(),
@@ -336,12 +345,17 @@ class WorkerDeploy extends EasCommand_1.default {
336
345
  }
337
346
  sanitizeFlags(flags) {
338
347
  const { json, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
348
+ const devDomainName = flags['dev-domain']?.trim().toLowerCase();
349
+ if (devDomainName !== undefined) {
350
+ (0, deployment_1.assertValidDevDomainName)(devDomainName);
351
+ }
339
352
  return {
340
353
  nonInteractive,
341
354
  json,
342
355
  isProduction: !!flags.prod,
343
356
  aliasName: flags.alias?.trim().toLowerCase(),
344
357
  deploymentIdentifier: flags.id?.trim(),
358
+ devDomainName,
345
359
  exportDir: flags['export-dir'],
346
360
  environment: flags['environment'],
347
361
  dryRun: flags['dry-run'],
@@ -4,6 +4,7 @@ export default class IntegrationsPostHogDashboard extends EasCommand {
4
4
  static flags: {
5
5
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
6
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ 'show-link': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
8
  };
8
9
  static contextDefinition: {
9
10
  loggedIn: import("../../../commandUtils/context/LoggedInContextField").default;
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ const core_1 = require("@oclif/core");
4
5
  const better_opn_1 = tslib_1.__importDefault(require("better-opn"));
5
6
  const EasCommand_1 = tslib_1.__importDefault(require("../../../commandUtils/EasCommand"));
6
7
  const flags_1 = require("../../../commandUtils/flags");
7
8
  const posthog_1 = require("../../../commandUtils/posthog");
9
+ const generated_1 = require("../../../graphql/generated");
10
+ const PostHogMutation_1 = require("../../../graphql/mutations/PostHogMutation");
8
11
  const PostHogQuery_1 = require("../../../graphql/queries/PostHogQuery");
9
12
  const log_1 = tslib_1.__importDefault(require("../../../log"));
10
13
  const ora_1 = require("../../../ora");
@@ -12,6 +15,10 @@ const json_1 = require("../../../utils/json");
12
15
  class IntegrationsPostHogDashboard extends EasCommand_1.default {
13
16
  static description = 'open the PostHog dashboard for the linked PostHog project';
14
17
  static flags = {
18
+ 'show-link': core_1.Flags.boolean({
19
+ default: false,
20
+ description: 'Print the signed-in dashboard URL in addition to opening it. The URL contains a single-use login token.',
21
+ }),
15
22
  ...flags_1.EasNonInteractiveAndJsonFlags,
16
23
  };
17
24
  static contextDefinition = {
@@ -20,6 +27,7 @@ class IntegrationsPostHogDashboard extends EasCommand_1.default {
20
27
  async runAsync() {
21
28
  const { flags } = await this.parse(IntegrationsPostHogDashboard);
22
29
  const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
30
+ const showLink = flags['show-link'];
23
31
  if (jsonFlag) {
24
32
  (0, json_1.enableJsonOutput)();
25
33
  }
@@ -37,21 +45,37 @@ class IntegrationsPostHogDashboard extends EasCommand_1.default {
37
45
  }
38
46
  return;
39
47
  }
40
- const dashboardUrl = (0, posthog_1.getPostHogProjectDashboardUrl)(posthogProject);
48
+ const staticDashboardUrl = (0, posthog_1.getPostHogProjectDashboardUrl)(posthogProject);
49
+ // Signed-in deep links are single-use and expire in 10 minutes, so only the interactive
50
+ // browser-open benefits from one. JSON/non-interactive consumers may store the URL, so give
51
+ // them the stable (login-required) dashboard URL instead.
41
52
  if (jsonFlag) {
42
- (0, json_1.printJsonOnlyOutput)({ dashboardUrl });
53
+ (0, json_1.printJsonOnlyOutput)({ dashboardUrl: staticDashboardUrl });
43
54
  return;
44
55
  }
45
56
  if (nonInteractive) {
46
- log_1.default.log(dashboardUrl);
57
+ log_1.default.log(staticDashboardUrl);
47
58
  return;
48
59
  }
49
- const failedMessage = `Unable to open a web browser. PostHog dashboard is available at: ${dashboardUrl}`;
50
- const spinner = (0, ora_1.ora)(`Opening ${dashboardUrl}`).start();
60
+ let dashboardUrl;
61
+ try {
62
+ dashboardUrl = await PostHogMutation_1.PostHogMutation.createPostHogDeepLinkAsync(graphqlClient, {
63
+ posthogOrganizationConnectionId: posthogProject.posthogOrganizationConnection.id,
64
+ appId: projectId,
65
+ purpose: generated_1.PostHogDeepLinkPurpose.Dashboard,
66
+ });
67
+ }
68
+ catch (error) {
69
+ log_1.default.debug(`Failed to mint a PostHog deep link; opening the static dashboard URL: ${error}`);
70
+ dashboardUrl = staticDashboardUrl;
71
+ }
72
+ const openLabel = showLink ? dashboardUrl : 'your PostHog dashboard';
73
+ const failedMessage = `Unable to open a web browser. PostHog dashboard is available at: ${showLink ? dashboardUrl : staticDashboardUrl}`;
74
+ const spinner = (0, ora_1.ora)(`Opening ${openLabel}`).start();
51
75
  try {
52
76
  const opened = await (0, better_opn_1.default)(dashboardUrl);
53
77
  if (opened) {
54
- spinner.succeed(`Opened ${dashboardUrl}`);
78
+ spinner.succeed(`Opened ${openLabel}`);
55
79
  }
56
80
  else {
57
81
  spinner.fail(failedMessage);
@@ -21,7 +21,7 @@ class ObserveMetrics extends EasCommand_1.default {
21
21
  static description = 'display individual performance metric samples ordered by value';
22
22
  static args = {
23
23
  metric: core_1.Args.string({
24
- description: 'Metric to query (e.g. tti, cold_launch)',
24
+ description: 'Metric to query (e.g. tti, cold_launch, nav_tti)',
25
25
  required: false,
26
26
  options: Object.keys(metricNames_1.METRIC_ALIASES),
27
27
  }),
@@ -1,9 +1,6 @@
1
1
  import EasCommand from '../commandUtils/EasCommand';
2
2
  export default class Open extends EasCommand {
3
3
  static description: string;
4
- static contextDefinition: {
5
- loggedIn: import("../commandUtils/context/LoggedInContextField").default;
6
- privateProjectConfig: import("../commandUtils/context/PrivateProjectConfigContextField").PrivateProjectConfigContextField;
7
- };
4
+ static hidden: boolean;
8
5
  runAsync(): Promise<void>;
9
6
  }
@@ -1,41 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const better_opn_1 = tslib_1.__importDefault(require("better-opn"));
5
- const url_1 = require("../build/utils/url");
6
4
  const EasCommand_1 = tslib_1.__importDefault(require("../commandUtils/EasCommand"));
7
- const ora_1 = require("../ora");
8
- const projectUtils_1 = require("../project/projectUtils");
5
+ const browse_1 = tslib_1.__importDefault(require("./browse"));
9
6
  class Open extends EasCommand_1.default {
10
- static description = 'open the project page in a web browser';
11
- static contextDefinition = {
12
- ...this.ContextOptions.ProjectConfig,
13
- ...this.ContextOptions.LoggedIn,
14
- };
7
+ static description = 'open the project page in a web browser (alias of `eas browse`)';
8
+ static hidden = true;
15
9
  async runAsync() {
16
- // this command is interactive by nature (only really run by humans in a terminal)
17
- const { privateProjectConfig: { projectId, exp }, loggedIn: { graphqlClient }, } = await this.getContextAsync(Open, {
18
- nonInteractive: false,
19
- withServerSideEnvironment: null,
20
- });
21
- const account = await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, projectId);
22
- const projectName = exp.slug;
23
- const projectDashboardUrl = (0, url_1.getProjectDashboardUrl)(account.name, projectName);
24
- const failedMessage = `Unable to open a web browser. Project page is available at: ${projectDashboardUrl}`;
25
- const spinner = (0, ora_1.ora)(`Opening ${projectDashboardUrl}`).start();
26
- try {
27
- const opened = await (0, better_opn_1.default)(projectDashboardUrl);
28
- if (opened) {
29
- spinner.succeed(`Opened ${projectDashboardUrl}`);
30
- }
31
- else {
32
- spinner.fail(failedMessage);
33
- }
34
- }
35
- catch (error) {
36
- spinner.fail(failedMessage);
37
- throw error;
38
- }
10
+ await browse_1.default.run([]);
39
11
  }
40
12
  }
41
13
  exports.default = Open;
@@ -0,0 +1,16 @@
1
+ import EasCommand from '../../commandUtils/EasCommand';
2
+ export default class ProjectDelete extends EasCommand {
3
+ static description: string;
4
+ static args: {
5
+ name: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
6
+ };
7
+ static flags: {
8
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ 'dangerously-confirm-deletion': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ };
12
+ static contextDefinition: {
13
+ loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
14
+ };
15
+ runAsync(): Promise<void>;
16
+ }
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const config_1 = require("@expo/config");
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 findProjectDirAndVerifyProjectSetupAsync_1 = require("../../commandUtils/context/contextUtils/findProjectDirAndVerifyProjectSetupAsync");
9
+ const flags_1 = require("../../commandUtils/flags");
10
+ const AppMutation_1 = require("../../graphql/mutations/AppMutation");
11
+ const AppQuery_1 = require("../../graphql/queries/AppQuery");
12
+ const log_1 = tslib_1.__importDefault(require("../../log"));
13
+ const ora_1 = require("../../ora");
14
+ const expoConfig_1 = require("../../project/expoConfig");
15
+ const prompts_1 = require("../../prompts");
16
+ const sudo_1 = require("../../user/sudo");
17
+ const json_1 = require("../../utils/json");
18
+ const pollForBackgroundJobReceiptAsync_1 = require("../../utils/pollForBackgroundJobReceiptAsync");
19
+ const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
20
+ class ProjectDelete extends EasCommand_1.default {
21
+ static description = 'delete a project';
22
+ static args = {
23
+ name: core_1.Args.string({
24
+ required: false,
25
+ description: 'Full name (@account/slug) or ID of the project to delete. Defaults to the project in the current directory.',
26
+ }),
27
+ };
28
+ static flags = {
29
+ 'dangerously-confirm-deletion': core_1.Flags.string({
30
+ description: "The project's full name (@account/slug), to confirm deletion. Required in non-interactive mode.",
31
+ }),
32
+ ...flags_1.EasNonInteractiveAndJsonFlags,
33
+ };
34
+ static contextDefinition = {
35
+ ...this.ContextOptions.LoggedIn,
36
+ };
37
+ async runAsync() {
38
+ const { args: { name }, flags, } = await this.parse(ProjectDelete);
39
+ const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
40
+ if (jsonFlag) {
41
+ (0, json_1.enableJsonOutput)();
42
+ }
43
+ const { loggedIn: { graphqlClient, authenticationInfo }, } = await this.getContextAsync(ProjectDelete, { nonInteractive });
44
+ let app;
45
+ if (name) {
46
+ app = UUID_REGEX.test(name)
47
+ ? await AppQuery_1.AppQuery.byIdAsync(graphqlClient, name)
48
+ : await AppQuery_1.AppQuery.byFullNameAsync(graphqlClient, name);
49
+ }
50
+ else {
51
+ let projectDir = null;
52
+ try {
53
+ projectDir = await (0, findProjectDirAndVerifyProjectSetupAsync_1.findProjectRootAsync)();
54
+ }
55
+ catch {
56
+ // Not inside a project directory — handled by the error below.
57
+ }
58
+ let projectId;
59
+ if (projectDir) {
60
+ // Only read the config when one already exists: getPrivateExpoConfigAsync creates a
61
+ // fresh app.json as a side effect when the directory has none. Config errors (broken
62
+ // app.config.js, invalid app.json) propagate so they are not masked by the error below.
63
+ const configPaths = (0, config_1.getConfigFilePaths)(projectDir);
64
+ if (configPaths.staticConfigPath ?? configPaths.dynamicConfigPath) {
65
+ const exp = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir);
66
+ projectId = exp.extra?.eas?.projectId;
67
+ }
68
+ }
69
+ if (!projectId) {
70
+ throw new Error("No EAS project found in the current directory. Pass the project's full name (@account/slug) or ID as an argument.");
71
+ }
72
+ app = await AppQuery_1.AppQuery.byIdAsync(graphqlClient, projectId);
73
+ }
74
+ const confirmedFullName = flags['dangerously-confirm-deletion'];
75
+ if (confirmedFullName) {
76
+ if (confirmedFullName !== app.fullName) {
77
+ throw new Error(`The value of --dangerously-confirm-deletion ("${confirmedFullName}") did not match the project's full name ("${app.fullName}"). Cancelled deletion.`);
78
+ }
79
+ }
80
+ else if (nonInteractive) {
81
+ throw new Error(`Deleting a project in non-interactive mode requires passing --dangerously-confirm-deletion with the project's full name ("${app.fullName}").`);
82
+ }
83
+ else {
84
+ log_1.default.addNewLineIfNone();
85
+ log_1.default.warn(`You are about to permanently delete project ${chalk_1.default.bold(app.fullName)}.` +
86
+ `\nThis will delete everything associated with it, including builds, submissions, update branches, published updates, and environment variables.` +
87
+ `\nThis action is irreversible.`);
88
+ log_1.default.newLine();
89
+ const { confirmedName } = await (0, prompts_1.promptAsync)({
90
+ type: 'text',
91
+ name: 'confirmedName',
92
+ message: `Type the project's full name (${app.fullName}) to confirm deletion:`,
93
+ });
94
+ if (confirmedName !== app.fullName) {
95
+ log_1.default.error(`The input did not match the project's full name. Cancelled deletion.`);
96
+ process.exit(1);
97
+ }
98
+ }
99
+ const spinner = (0, ora_1.ora)(`Deleting project ${app.fullName}`).start();
100
+ try {
101
+ let receipt;
102
+ try {
103
+ receipt = await AppMutation_1.AppMutation.scheduleAppDeletionAsync(graphqlClient, app.id);
104
+ }
105
+ catch (error) {
106
+ if (!(0, sudo_1.isSudoModeRequiredError)(error)) {
107
+ throw error;
108
+ }
109
+ if (nonInteractive) {
110
+ throw new Error('Deleting a project requires a session in sudo mode. Run this command interactively to confirm your password, then retry in non-interactive mode while sudo mode is active.');
111
+ }
112
+ spinner.stop();
113
+ await (0, sudo_1.promptForSudoModeUpgradeAsync)(authenticationInfo);
114
+ spinner.start();
115
+ receipt = await AppMutation_1.AppMutation.scheduleAppDeletionAsync(graphqlClient, app.id);
116
+ }
117
+ await (0, pollForBackgroundJobReceiptAsync_1.pollForBackgroundJobReceiptAsync)(graphqlClient, receipt);
118
+ spinner.succeed(`Deleted project ${chalk_1.default.bold(app.fullName)}`);
119
+ }
120
+ catch (error) {
121
+ spinner.fail(`Failed to delete project ${chalk_1.default.bold(app.fullName)}`);
122
+ throw error;
123
+ }
124
+ if (jsonFlag) {
125
+ (0, json_1.printJsonOnlyOutput)({ id: app.id, fullName: app.fullName });
126
+ }
127
+ }
128
+ }
129
+ exports.default = ProjectDelete;
@@ -11,12 +11,5 @@ export default class ProjectInit extends EasCommand {
11
11
  projectDir: import("../../commandUtils/context/ProjectDirContextField").default;
12
12
  loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
13
13
  };
14
- private static saveProjectIdAndLogSuccessAsync;
15
- private static modifyExpoConfigAsync;
16
- private static ensureOwnerSlugConsistencyAsync;
17
- private static setExplicitIDAsync;
18
- private static initializeWithExplicitIDAsync;
19
- private static initializeWithoutExplicitIDAsync;
20
- private static getAccountChoices;
21
14
  runAsync(): Promise<void>;
22
15
  }