eas-cli 3.18.3 → 4.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 (48) hide show
  1. package/README.md +72 -64
  2. package/build/channel/branch-mapping.d.ts +6 -0
  3. package/build/channel/branch-mapping.js +10 -1
  4. package/build/channel/print-utils.js +1 -1
  5. package/build/channel/utils.d.ts +0 -10
  6. package/build/channel/utils.js +1 -60
  7. package/build/commands/channel/edit.js +1 -1
  8. package/build/commands/channel/rollout.d.ts +14 -2
  9. package/build/commands/channel/rollout.js +106 -270
  10. package/build/commands/update/republish.js +6 -6
  11. package/build/devices/actions/create/action.d.ts +2 -1
  12. package/build/devices/actions/create/action.js +10 -1
  13. package/build/devices/actions/create/currentMachineMethod.d.ts +3 -0
  14. package/build/devices/actions/create/currentMachineMethod.js +100 -0
  15. package/build/devices/actions/create/developerPortalMethod.js +2 -1
  16. package/build/devices/actions/create/inputMethod.d.ts +0 -1
  17. package/build/devices/actions/create/inputMethod.js +6 -64
  18. package/build/devices/actions/create/utils.d.ts +10 -0
  19. package/build/devices/actions/create/utils.js +73 -0
  20. package/build/devices/manager.js +3 -3
  21. package/build/devices/utils/errors.d.ts +3 -0
  22. package/build/devices/utils/errors.js +7 -1
  23. package/build/devices/utils/formatDevice.js +1 -0
  24. package/build/graphql/generated.d.ts +5 -4
  25. package/build/graphql/generated.js +1 -0
  26. package/build/graphql/types/credentials/AppleDevice.js +1 -0
  27. package/build/rollout/actions/CreateRollout.d.ts +2 -0
  28. package/build/rollout/actions/CreateRollout.js +82 -5
  29. package/build/rollout/actions/EditRollout.js +5 -2
  30. package/build/rollout/actions/EndRollout.d.ts +6 -3
  31. package/build/rollout/actions/EndRollout.js +22 -21
  32. package/build/rollout/actions/ManageRollout.d.ts +3 -3
  33. package/build/rollout/actions/ManageRollout.js +1 -1
  34. package/build/rollout/actions/NonInteractiveRollout.d.ts +6 -4
  35. package/build/rollout/actions/NonInteractiveRollout.js +1 -1
  36. package/build/rollout/actions/RolloutMainMenu.d.ts +4 -4
  37. package/build/rollout/actions/RolloutMainMenu.js +14 -5
  38. package/build/rollout/actions/SelectRuntime.d.ts +4 -7
  39. package/build/rollout/actions/SelectRuntime.js +22 -39
  40. package/build/rollout/branch-mapping.js +2 -2
  41. package/build/rollout/utils.d.ts +1 -1
  42. package/build/rollout/utils.js +5 -5
  43. package/build/update/republish.js +6 -6
  44. package/build/utils/relay.js +3 -9
  45. package/oclif.manifest.json +1 -1
  46. package/package.json +3 -3
  47. package/build/commands/channel/rollout-preview.d.ts +0 -32
  48. package/build/commands/channel/rollout-preview.js +0 -140
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runCurrentMachineMethodAsync = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const os_1 = tslib_1.__importDefault(require("os"));
8
+ const AppleDeviceMutation_1 = require("../../../credentials/ios/api/graphql/mutations/AppleDeviceMutation");
9
+ const generated_1 = require("../../../graphql/generated");
10
+ const log_1 = tslib_1.__importDefault(require("../../../log"));
11
+ const ora_1 = require("../../../ora");
12
+ const prompts_1 = require("../../../prompts");
13
+ const errors_1 = require("../../utils/errors");
14
+ const utils_1 = require("./utils");
15
+ async function runCurrentMachineMethodAsync(graphqlClient, accountId, appleTeam) {
16
+ log_1.default.newLine();
17
+ log_1.default.log(chalk_1.default.white('Checking if current machine is an Apple Silicon one.'));
18
+ if (!isMachineAppleSilicon()) {
19
+ throw new errors_1.DeviceCreateError("Current machine is not of Apple Silicon type - provisioning UDID can't be added automatically.");
20
+ }
21
+ log_1.default.log(chalk_1.default.green('Check successful.'));
22
+ await collectDataAndRegisterDeviceAsync(graphqlClient, { accountId, appleTeam });
23
+ }
24
+ exports.runCurrentMachineMethodAsync = runCurrentMachineMethodAsync;
25
+ function isMachineAppleSilicon() {
26
+ return os_1.default.cpus()[0].model.includes('Apple M') && process.platform === 'darwin';
27
+ }
28
+ async function collectDataAndRegisterDeviceAsync(graphqlClient, { accountId, appleTeam, }) {
29
+ const deviceData = await collectDeviceDataAsync(appleTeam);
30
+ if (!deviceData) {
31
+ return;
32
+ }
33
+ const { udid, deviceClass, name } = deviceData;
34
+ const spinner = (0, ora_1.ora)(`Registering Apple device on Expo`).start();
35
+ try {
36
+ await AppleDeviceMutation_1.AppleDeviceMutation.createAppleDeviceAsync(graphqlClient, {
37
+ appleTeamId: appleTeam.id,
38
+ identifier: udid,
39
+ name,
40
+ deviceClass: deviceClass !== null && deviceClass !== void 0 ? deviceClass : undefined,
41
+ }, accountId);
42
+ }
43
+ catch (err) {
44
+ spinner.fail();
45
+ throw err;
46
+ }
47
+ spinner.succeed();
48
+ }
49
+ async function collectDeviceDataAsync(appleTeam, initialValues = {}) {
50
+ log_1.default.log(chalk_1.default.white('Fetching the provisioning UDID.'));
51
+ const [udid, defaultMachineName] = await fetchCurrentMachineUDIDAsync();
52
+ log_1.default.log(chalk_1.default.green(`Fetched the provisioning UDID - ${udid}`));
53
+ const name = await (0, utils_1.promptForNameAsync)(defaultMachineName !== null && defaultMachineName !== void 0 ? defaultMachineName : initialValues.name);
54
+ const deviceClass = generated_1.AppleDeviceClass.Mac;
55
+ const deviceData = {
56
+ udid,
57
+ name,
58
+ deviceClass,
59
+ };
60
+ (0, utils_1.printDeviceData)(deviceData, appleTeam);
61
+ const registrationConfirmed = await (0, prompts_1.confirmAsync)({
62
+ message: 'Is this what you want to register?',
63
+ });
64
+ if (!registrationConfirmed) {
65
+ log_1.default.log('No worries, just try again.');
66
+ log_1.default.newLine();
67
+ return null;
68
+ }
69
+ else {
70
+ return deviceData;
71
+ }
72
+ }
73
+ async function fetchCurrentMachineUDIDAsync() {
74
+ var _a, _b;
75
+ try {
76
+ const profilerData = (await (0, spawn_async_1.default)('system_profiler', ['-json', 'SPHardwareDataType'])).stdout.trim();
77
+ if (!profilerData) {
78
+ const message = 'Failed to fetch the provisioning UDID from system profiler';
79
+ log_1.default.error(message);
80
+ throw new errors_1.DeviceCreateError(message);
81
+ }
82
+ const profilerDataJSON = JSON.parse(profilerData);
83
+ const provisioningUDID = (_a = profilerDataJSON === null || profilerDataJSON === void 0 ? void 0 : profilerDataJSON.SPHardwareDataType[0]) === null || _a === void 0 ? void 0 : _a.provisioning_UDID;
84
+ if (!provisioningUDID) {
85
+ const message = 'System profiler data did not contain the provisioning UDID';
86
+ log_1.default.error(message);
87
+ throw new errors_1.DeviceCreateError(message);
88
+ }
89
+ const defaultMachineName = (_b = profilerDataJSON === null || profilerDataJSON === void 0 ? void 0 : profilerDataJSON.SPHardwareDataType[0]) === null || _b === void 0 ? void 0 : _b.machine_name;
90
+ return [provisioningUDID, defaultMachineName];
91
+ }
92
+ catch (err) {
93
+ if (!(err instanceof errors_1.DeviceCreateError)) {
94
+ const message = `Failed to fetch the provisioning UDID of the current machine - ${err.message}`;
95
+ log_1.default.error(message);
96
+ throw new errors_1.DeviceCreateError(message);
97
+ }
98
+ throw err;
99
+ }
100
+ }
@@ -15,6 +15,7 @@ const DEVICE_IMPORT_CHUNK_SIZE = 10;
15
15
  const DEVICE_CLASS_TO_GRAPHQL_TYPE = {
16
16
  [apple_utils_1.DeviceClass.IPAD]: generated_1.AppleDeviceClass.Ipad,
17
17
  [apple_utils_1.DeviceClass.IPHONE]: generated_1.AppleDeviceClass.Iphone,
18
+ [apple_utils_1.DeviceClass.MAC]: generated_1.AppleDeviceClass.Mac,
18
19
  };
19
20
  async function runDeveloperPortalMethodAsync(graphqlClient, appStoreApi, accountId, appleTeam) {
20
21
  const appleAuthCtx = await appStoreApi.ensureAuthenticatedAsync();
@@ -61,7 +62,7 @@ async function findUnregisteredPortalDevicesAsync(graphqlClient, appleAuthCtx, a
61
62
  }, {});
62
63
  const portalDevices = await apple_utils_1.Device.getAsync((0, authenticate_1.getRequestContext)(appleAuthCtx));
63
64
  return portalDevices.filter(portalDevice => !(portalDevice.attributes.udid in expoRegisteredDevicesByUdid) &&
64
- [apple_utils_1.DeviceClass.IPAD, apple_utils_1.DeviceClass.IPHONE, apple_utils_1.DeviceClass.APPLE_TV].includes(portalDevice.attributes.deviceClass));
65
+ [apple_utils_1.DeviceClass.IPAD, apple_utils_1.DeviceClass.IPHONE, apple_utils_1.DeviceClass.APPLE_TV, apple_utils_1.DeviceClass.MAC].includes(portalDevice.attributes.deviceClass));
65
66
  }
66
67
  async function chooseDevicesToImportAsync(devices) {
67
68
  const { chosenDevices } = await (0, prompts_1.promptAsync)({
@@ -1,4 +1,3 @@
1
1
  import { ExpoGraphqlClient } from '../../../commandUtils/context/contextUtils/createGraphqlClient';
2
2
  import { AppleTeam } from '../../../graphql/generated';
3
3
  export declare function runInputMethodAsync(graphqlClient: ExpoGraphqlClient, accountId: string, appleTeam: Pick<AppleTeam, 'appleTeamIdentifier' | 'appleTeamName' | 'id'>): Promise<void>;
4
- export declare function promptForUDIDAsync(initial?: string): Promise<string>;
@@ -1,15 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.promptForUDIDAsync = exports.runInputMethodAsync = void 0;
3
+ exports.runInputMethodAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
6
  const AppleDeviceMutation_1 = require("../../../credentials/ios/api/graphql/mutations/AppleDeviceMutation");
7
- const generated_1 = require("../../../graphql/generated");
8
7
  const log_1 = tslib_1.__importDefault(require("../../../log"));
9
8
  const ora_1 = require("../../../ora");
10
9
  const prompts_1 = require("../../../prompts");
11
- const udids_1 = require("../../udids");
12
- const formatDevice_1 = require("../../utils/formatDevice");
10
+ const utils_1 = require("./utils");
13
11
  async function runInputMethodAsync(graphqlClient, accountId, appleTeam) {
14
12
  log_1.default.newLine();
15
13
  log_1.default.log(chalk_1.default.yellow('This is an advanced option. Use at your own risk.'));
@@ -42,20 +40,15 @@ async function collectDataAndRegisterDeviceAsync(graphqlClient, { accountId, app
42
40
  spinner.succeed();
43
41
  }
44
42
  async function collectDeviceDataAsync(appleTeam, initialValues = {}) {
45
- const udid = await promptForUDIDAsync(initialValues.udid);
46
- const name = await promptForNameAsync(initialValues.name);
47
- const deviceClass = await promptForDeviceClassAsync(initialValues.deviceClass);
43
+ const udid = await (0, utils_1.promptForUDIDAsync)(initialValues.udid);
44
+ const name = await (0, utils_1.promptForNameAsync)(initialValues.name);
45
+ const deviceClass = await (0, utils_1.promptForDeviceClassAsync)(initialValues.deviceClass);
48
46
  const deviceData = {
49
47
  udid,
50
48
  name,
51
49
  deviceClass,
52
50
  };
53
- log_1.default.newLine();
54
- log_1.default.log(`We are going to register the following device in our database.
55
- This device will ${chalk_1.default.bold('not')} be registered on the Apple Developer Portal until it is chosen for an internal distribution build.`);
56
- log_1.default.newLine();
57
- log_1.default.log((0, formatDevice_1.formatNewDevice)({ ...deviceData, identifier: deviceData.udid }, appleTeam));
58
- log_1.default.newLine();
51
+ (0, utils_1.printDeviceData)(deviceData, appleTeam);
59
52
  const registrationConfirmed = await (0, prompts_1.confirmAsync)({
60
53
  message: 'Is this what you want to register?',
61
54
  });
@@ -68,54 +61,3 @@ This device will ${chalk_1.default.bold('not')} be registered on the Apple Devel
68
61
  return deviceData;
69
62
  }
70
63
  }
71
- async function promptForUDIDAsync(initial) {
72
- const { udid } = await (0, prompts_1.promptAsync)({
73
- type: 'text',
74
- name: 'udid',
75
- message: 'UDID:',
76
- initial,
77
- validate: (rawVal) => {
78
- const val = (0, udids_1.normalizeUDID)(rawVal);
79
- if (!val || val === '') {
80
- return 'UDID cannot be empty';
81
- }
82
- else if (val.length !== 25 && val.length !== 40) {
83
- return 'UDID should be a 25 or 40-character string';
84
- }
85
- else if (!(0, udids_1.isValidUDID)(val)) {
86
- return 'UDID is invalid';
87
- }
88
- else {
89
- return true;
90
- }
91
- },
92
- format: (val) => (0, udids_1.normalizeUDID)(val),
93
- });
94
- return udid;
95
- }
96
- exports.promptForUDIDAsync = promptForUDIDAsync;
97
- async function promptForNameAsync(initial) {
98
- const { name } = await (0, prompts_1.promptAsync)({
99
- type: 'text',
100
- name: 'name',
101
- message: 'Device name (optional):',
102
- initial,
103
- });
104
- return name;
105
- }
106
- async function promptForDeviceClassAsync(initial) {
107
- const choices = [
108
- { title: 'iPhone', value: generated_1.AppleDeviceClass.Iphone },
109
- { title: 'iPad', value: generated_1.AppleDeviceClass.Ipad },
110
- { title: 'Not sure (leave empty)', value: null },
111
- ];
112
- const values = choices.map(({ value }) => value);
113
- const { deviceClass } = await (0, prompts_1.promptAsync)({
114
- type: 'select',
115
- name: 'deviceClass',
116
- message: 'Device class (optional):',
117
- choices,
118
- initial: initial !== undefined && values.indexOf(initial),
119
- });
120
- return deviceClass;
121
- }
@@ -0,0 +1,10 @@
1
+ import { AppleDeviceClass, AppleTeam } from '../../../graphql/generated';
2
+ export interface DeviceData {
3
+ udid: string;
4
+ name?: string;
5
+ deviceClass: AppleDeviceClass | null;
6
+ }
7
+ export declare function promptForDeviceClassAsync(initial?: AppleDeviceClass | null): Promise<AppleDeviceClass | null>;
8
+ export declare function promptForNameAsync(initial?: string): Promise<string | undefined>;
9
+ export declare function promptForUDIDAsync(initial?: string): Promise<string>;
10
+ export declare function printDeviceData(deviceData: DeviceData, appleTeam: Pick<AppleTeam, 'appleTeamIdentifier' | 'appleTeamName'>): void;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.printDeviceData = exports.promptForUDIDAsync = exports.promptForNameAsync = exports.promptForDeviceClassAsync = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
+ const generated_1 = require("../../../graphql/generated");
7
+ const log_1 = tslib_1.__importDefault(require("../../../log"));
8
+ const prompts_1 = require("../../../prompts");
9
+ const udids_1 = require("../../udids");
10
+ const formatDevice_1 = require("../../utils/formatDevice");
11
+ async function promptForDeviceClassAsync(initial) {
12
+ const choices = [
13
+ { title: 'iPhone', value: generated_1.AppleDeviceClass.Iphone },
14
+ { title: 'iPad', value: generated_1.AppleDeviceClass.Ipad },
15
+ { title: 'Mac', value: generated_1.AppleDeviceClass.Mac },
16
+ { title: 'Not sure (leave empty)', value: null },
17
+ ];
18
+ const values = choices.map(({ value }) => value);
19
+ const { deviceClass } = await (0, prompts_1.promptAsync)({
20
+ type: 'select',
21
+ name: 'deviceClass',
22
+ message: 'Device class (optional):',
23
+ choices,
24
+ initial: initial !== undefined && values.indexOf(initial),
25
+ });
26
+ return deviceClass;
27
+ }
28
+ exports.promptForDeviceClassAsync = promptForDeviceClassAsync;
29
+ async function promptForNameAsync(initial) {
30
+ const { name } = await (0, prompts_1.promptAsync)({
31
+ type: 'text',
32
+ name: 'name',
33
+ message: 'Device name (optional):',
34
+ initial,
35
+ });
36
+ return name;
37
+ }
38
+ exports.promptForNameAsync = promptForNameAsync;
39
+ async function promptForUDIDAsync(initial) {
40
+ const { udid } = await (0, prompts_1.promptAsync)({
41
+ type: 'text',
42
+ name: 'udid',
43
+ message: 'UDID:',
44
+ initial,
45
+ validate: (rawVal) => {
46
+ const val = (0, udids_1.normalizeUDID)(rawVal);
47
+ if (!val || val === '') {
48
+ return 'UDID cannot be empty';
49
+ }
50
+ else if (val.length !== 25 && val.length !== 40) {
51
+ return 'UDID should be a 25 or 40-character string';
52
+ }
53
+ else if (!(0, udids_1.isValidUDID)(val)) {
54
+ return 'UDID is invalid';
55
+ }
56
+ else {
57
+ return true;
58
+ }
59
+ },
60
+ format: (val) => (0, udids_1.normalizeUDID)(val),
61
+ });
62
+ return udid;
63
+ }
64
+ exports.promptForUDIDAsync = promptForUDIDAsync;
65
+ function printDeviceData(deviceData, appleTeam) {
66
+ log_1.default.newLine();
67
+ log_1.default.log(`We are going to register the following device in our database.
68
+ This device will ${chalk_1.default.bold('not')} be registered on the Apple Developer Portal until it is chosen for an internal distribution build.`);
69
+ log_1.default.newLine();
70
+ log_1.default.log((0, formatDevice_1.formatNewDevice)({ ...deviceData, identifier: deviceData.udid }, appleTeam));
71
+ log_1.default.newLine();
72
+ }
73
+ exports.printDeviceData = printDeviceData;
@@ -10,10 +10,10 @@ const log_1 = tslib_1.__importDefault(require("../log"));
10
10
  const projectUtils_1 = require("../project/projectUtils");
11
11
  const prompts_1 = require("../prompts");
12
12
  const action_1 = tslib_1.__importDefault(require("./actions/create/action"));
13
- const CREATE_COMMAND_DESCRIPTION = `This command lets you register your Apple devices (iPhones and iPads) for internal distribution of your app.
13
+ const CREATE_COMMAND_DESCRIPTION = `This command lets you register your Apple devices (iPhones, iPads and Macs) for internal distribution of your app.
14
14
  Internal distribution means that you won't need to upload your app archive to App Store / Testflight.
15
- Your app archive (.ipa) will be installable on your equipment as long as you sign your application with an adhoc provisiong profile.
16
- The provisioning profile needs to contain the UDIDs (unique identifiers) of your iPhones and iPads.
15
+ Your app archive (.ipa) will be installable on your equipment as long as you sign your application with an adhoc provisioning profile.
16
+ The provisioning profile needs to contain the UDIDs (unique identifiers) of your iPhones, iPads and Macs.
17
17
 
18
18
  First of all, choose the Expo account under which you want to register your devices.
19
19
  Later, authenticate with Apple and choose your desired Apple Team (if your Apple ID has access to multiple teams).`;
@@ -1,3 +1,6 @@
1
1
  export declare class DeviceNotFoundError extends Error {
2
2
  constructor(message?: string);
3
3
  }
4
+ export declare class DeviceCreateError extends Error {
5
+ constructor(message?: string);
6
+ }
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeviceNotFoundError = void 0;
3
+ exports.DeviceCreateError = exports.DeviceNotFoundError = void 0;
4
4
  class DeviceNotFoundError extends Error {
5
5
  constructor(message) {
6
6
  super(message !== null && message !== void 0 ? message : 'Device not found.');
7
7
  }
8
8
  }
9
9
  exports.DeviceNotFoundError = DeviceNotFoundError;
10
+ class DeviceCreateError extends Error {
11
+ constructor(message) {
12
+ super(message !== null && message !== void 0 ? message : 'Failed to create a device.');
13
+ }
14
+ }
15
+ exports.DeviceCreateError = DeviceCreateError;
@@ -7,6 +7,7 @@ const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields
7
7
  const DEVICE_CLASS_DISPLAY_NAMES = {
8
8
  [generated_1.AppleDeviceClass.Iphone]: 'iPhone',
9
9
  [generated_1.AppleDeviceClass.Ipad]: 'iPad',
10
+ [generated_1.AppleDeviceClass.Mac]: 'Mac',
10
11
  };
11
12
  function formatDeviceClass(device) {
12
13
  if (!device.deviceClass || !DEVICE_CLASS_DISPLAY_NAMES[device.deviceClass]) {
@@ -1391,7 +1391,8 @@ export type AppleDevice = {
1391
1391
  };
1392
1392
  export declare enum AppleDeviceClass {
1393
1393
  Ipad = "IPAD",
1394
- Iphone = "IPHONE"
1394
+ Iphone = "IPHONE",
1395
+ Mac = "MAC"
1395
1396
  }
1396
1397
  export type AppleDeviceInput = {
1397
1398
  appleTeamId: Scalars['ID'];
@@ -3713,7 +3714,7 @@ export type SsoUser = Actor & UserActor & {
3713
3714
  twitterUsername?: Maybe<Scalars['String']>;
3714
3715
  username: Scalars['String'];
3715
3716
  /** Web notifications linked to a user */
3716
- webNotifications: Array<Notification>;
3717
+ websiteNotifications: Array<Notification>;
3717
3718
  };
3718
3719
  /** Represents a human SSO (not robot) actor. */
3719
3720
  export type SsoUserActivityTimelineProjectActivitiesArgs = {
@@ -4356,7 +4357,7 @@ export type User = Actor & UserActor & {
4356
4357
  /** @deprecated No longer supported */
4357
4358
  twitterUsername?: Maybe<Scalars['String']>;
4358
4359
  username: Scalars['String'];
4359
- webNotifications: Array<Notification>;
4360
+ websiteNotifications: Array<Notification>;
4360
4361
  };
4361
4362
  /** Represents a human (not robot) actor. */
4362
4363
  export type UserActivityTimelineProjectActivitiesArgs = {
@@ -4435,7 +4436,7 @@ export type UserActor = {
4435
4436
  twitterUsername?: Maybe<Scalars['String']>;
4436
4437
  username: Scalars['String'];
4437
4438
  /** Web notifications linked to a user */
4438
- webNotifications: Array<Notification>;
4439
+ websiteNotifications: Array<Notification>;
4439
4440
  };
4440
4441
  /** A human user (type User or SSOUser) that can login to the Expo website, use Expo services, and be a member of accounts. */
4441
4442
  export type UserActorActivityTimelineProjectActivitiesArgs = {
@@ -83,6 +83,7 @@ var AppleDeviceClass;
83
83
  (function (AppleDeviceClass) {
84
84
  AppleDeviceClass["Ipad"] = "IPAD";
85
85
  AppleDeviceClass["Iphone"] = "IPHONE";
86
+ AppleDeviceClass["Mac"] = "MAC";
86
87
  })(AppleDeviceClass = exports.AppleDeviceClass || (exports.AppleDeviceClass = {}));
87
88
  var AppsFilter;
88
89
  (function (AppsFilter) {
@@ -7,6 +7,7 @@ const generated_1 = require("../../generated");
7
7
  exports.APPLE_DEVICE_CLASS_LABELS = {
8
8
  [generated_1.AppleDeviceClass.Ipad]: 'iPad',
9
9
  [generated_1.AppleDeviceClass.Iphone]: 'iPhone',
10
+ [generated_1.AppleDeviceClass.Mac]: 'Mac',
10
11
  };
11
12
  exports.AppleDeviceFragmentNode = (0, graphql_tag_1.default) `
12
13
  fragment AppleDeviceFragment on AppleDevice {
@@ -18,6 +18,8 @@ export declare class CreateRollout implements EASUpdateAction<UpdateChannelBasic
18
18
  getChannelObjectAsync(ctx: EASUpdateContext, runtimeVersion: string): Promise<UpdateChannelObject>;
19
19
  getLatestUpdateGroupOnBranchAsync(ctx: EASUpdateContext, branchInfo: UpdateBranchBasicInfoFragment, runtimeVersion: string): Promise<UpdateFragment[] | null>;
20
20
  selectRuntimeVersionAsync(ctx: EASUpdateContext, branchToRollout: UpdateBranchBasicInfoFragment, defaultBranchId: string): Promise<string>;
21
+ selectRuntimeVersionFromAlternativeSourceAsync(ctx: EASUpdateContext, branchToRollout: UpdateBranchBasicInfoFragment, defaultBranch: UpdateBranchBasicInfoFragment): Promise<string>;
22
+ selectRuntimeVersionFromProjectConfigAsync(ctx: EASUpdateContext): Promise<string>;
21
23
  selectBranchAsync(ctx: EASUpdateContext, defaultBranchId: string): Promise<UpdateBranchBasicInfoFragment>;
22
24
  resolveBranchNameAsync(ctx: EASUpdateContext, branchName: string): Promise<UpdateBranchBasicInfoFragment>;
23
25
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CreateRollout = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const config_plugins_1 = require("@expo/config-plugins");
5
6
  const assert_1 = tslib_1.__importDefault(require("assert"));
6
7
  const SelectBranch_1 = require("../../branch/actions/SelectBranch");
7
8
  const branch_mapping_1 = require("../../channel/branch-mapping");
@@ -12,6 +13,7 @@ const ChannelQuery_1 = require("../../graphql/queries/ChannelQuery");
12
13
  const UpdateQuery_1 = require("../../graphql/queries/UpdateQuery");
13
14
  const log_1 = tslib_1.__importDefault(require("../../log"));
14
15
  const prompts_1 = require("../../prompts");
16
+ const filter_1 = require("../../utils/expodash/filter");
15
17
  const branch_mapping_2 = require("../branch-mapping");
16
18
  const utils_2 = require("../utils");
17
19
  const SelectRuntime_1 = require("./SelectRuntime");
@@ -39,6 +41,9 @@ class CreateRollout {
39
41
  if ((0, branch_mapping_2.isRollout)(this.channelInfo)) {
40
42
  throw new Error(`A rollout is already in progress for channel ${this.channelInfo.name}`);
41
43
  }
44
+ if ((0, branch_mapping_1.hasEmptyBranchMap)(this.channelInfo)) {
45
+ throw new Error(`Your channel needs to be linked to a branch before a rollout can be created. Do this by running 'eas channel:edit'`);
46
+ }
42
47
  if (!(0, branch_mapping_1.hasStandardBranchMap)(this.channelInfo)) {
43
48
  throw new Error(`You have a custom branch mapping. Map your channel to a single branch before creating a rollout. Received: ${this.channelInfo.branchMapping}`);
44
49
  }
@@ -51,7 +56,7 @@ class CreateRollout {
51
56
  }
52
57
  const runtimeVersion = (_a = this.options.runtimeVersion) !== null && _a !== void 0 ? _a : (await this.selectRuntimeVersionAsync(ctx, branchInfoToRollout, defaultBranchId));
53
58
  log_1.default.newLine();
54
- const promptMessage = `What percent of users should be routed to branch ${branchInfoToRollout.name}?`;
59
+ const promptMessage = `What percent of users should be rolled out to branch ${branchInfoToRollout.name}?`;
55
60
  const percent = (_b = this.options.percent) !== null && _b !== void 0 ? _b : (await (0, utils_2.promptForRolloutPercentAsync)({ promptMessage }));
56
61
  const rolloutBranchMapping = (0, branch_mapping_2.createRolloutBranchMapping)({
57
62
  defaultBranchId,
@@ -125,20 +130,92 @@ class CreateRollout {
125
130
  channelName: this.channelInfo.name,
126
131
  });
127
132
  const defaultBranchRtvAgnostic = (0, utils_1.getUpdateBranch)(channelObjectRtvAgnostic, defaultBranchId);
128
- const selectRuntimeAction = new SelectRuntime_1.SelectRuntime(branchToRollout, {
133
+ const selectSharedRuntimeAction = new SelectRuntime_1.SelectRuntime(branchToRollout, {
129
134
  anotherBranchToIntersectRuntimesBy: defaultBranchRtvAgnostic,
130
135
  });
131
- return await selectRuntimeAction.runAsync(ctx);
136
+ const sharedRuntime = await selectSharedRuntimeAction.runAsync(ctx);
137
+ if (sharedRuntime) {
138
+ return sharedRuntime;
139
+ }
140
+ return await this.selectRuntimeVersionFromAlternativeSourceAsync(ctx, branchToRollout, defaultBranchRtvAgnostic);
141
+ }
142
+ async selectRuntimeVersionFromAlternativeSourceAsync(ctx, branchToRollout, defaultBranch) {
143
+ const { runtimeSource: selectedRuntimeSource } = await (0, prompts_1.promptAsync)({
144
+ type: 'select',
145
+ name: 'runtimeSource',
146
+ message: `What would you like to do?`,
147
+ choices: [
148
+ {
149
+ value: 'DEFAULT_BRANCH_RUNTIME',
150
+ title: `Find a runtime supported on the ${defaultBranch.name} branch`,
151
+ },
152
+ {
153
+ value: 'ROLLED_OUT_BRANCH_RUNTIME',
154
+ title: `Find a runtime supported on the ${branchToRollout.name} branch`,
155
+ },
156
+ {
157
+ value: 'PROJECT_RUNTIME',
158
+ title: 'Use the runtime specified in your project config',
159
+ },
160
+ ],
161
+ });
162
+ if (selectedRuntimeSource === 'DEFAULT_BRANCH_RUNTIME') {
163
+ const selectDefaultBranchRuntimeAction = new SelectRuntime_1.SelectRuntime(defaultBranch);
164
+ const defaultBranchRuntime = await selectDefaultBranchRuntimeAction.runAsync(ctx);
165
+ if (defaultBranchRuntime) {
166
+ return defaultBranchRuntime;
167
+ }
168
+ }
169
+ else if (selectedRuntimeSource === 'ROLLED_OUT_BRANCH_RUNTIME') {
170
+ const selectBranchToRolloutRuntimeAction = new SelectRuntime_1.SelectRuntime(branchToRollout);
171
+ const branchToRolloutRuntime = await selectBranchToRolloutRuntimeAction.runAsync(ctx);
172
+ if (branchToRolloutRuntime) {
173
+ return branchToRolloutRuntime;
174
+ }
175
+ }
176
+ else if (selectedRuntimeSource === 'PROJECT_RUNTIME') {
177
+ return await this.selectRuntimeVersionFromProjectConfigAsync(ctx);
178
+ }
179
+ else {
180
+ throw new Error(`Unexpected runtime source: ${selectedRuntimeSource}`);
181
+ }
182
+ return await this.selectRuntimeVersionFromAlternativeSourceAsync(ctx, branchToRollout, defaultBranch);
183
+ }
184
+ async selectRuntimeVersionFromProjectConfigAsync(ctx) {
185
+ const platforms = ['ios', 'android'];
186
+ const runtimes = platforms
187
+ .map(platform => config_plugins_1.Updates.getRuntimeVersion(ctx.app.exp, platform))
188
+ .filter(filter_1.truthy);
189
+ const dedupedRuntimes = [...new Set(runtimes)];
190
+ if (dedupedRuntimes.length === 0) {
191
+ throw new Error(`Your project config doesn't specify a runtime. Ensure your project is configured correctly for EAS Update by running \`eas update:configure\``);
192
+ }
193
+ else if (dedupedRuntimes.length === 1) {
194
+ const runtime = dedupedRuntimes[0];
195
+ log_1.default.log(`🔧 Your project config currently supports runtime ${runtime}`);
196
+ return runtime;
197
+ }
198
+ const { runtime: selectedRuntime } = await (0, prompts_1.promptAsync)({
199
+ type: 'select',
200
+ name: 'runtime',
201
+ message: `Select a runtime supported by your project config`,
202
+ choices: runtimes.map((runtime, index) => ({
203
+ title: `${runtime} ${index === 0 ? '[iOS runtime]' : '[Android runtime]'}`,
204
+ value: runtime,
205
+ })),
206
+ });
207
+ return selectedRuntime;
132
208
  }
133
209
  async selectBranchAsync(ctx, defaultBranchId) {
134
210
  const selectBranchAction = new SelectBranch_1.SelectBranch({
135
- printedType: 'branch to rollout',
211
+ printedType: 'branch to roll out',
136
212
  // we don't want to show the default branch as an option
137
213
  filterPredicate: (branchInfo) => branchInfo.id !== defaultBranchId,
138
214
  });
139
215
  const branchInfo = await selectBranchAction.runAsync(ctx);
140
216
  if (!branchInfo) {
141
- throw new Error(`You dont have any branches. Create one with 'eas branch:create'`);
217
+ // We know the user has at least one branch, since we have `defaultBranchId`
218
+ throw new Error(`You don't have a second branch to roll out. Create it with 'eas branch:create'`);
142
219
  }
143
220
  return branchInfo;
144
221
  }
@@ -33,12 +33,15 @@ class EditRollout {
33
33
  const channelObject = await this.getChannelObjectAsync(ctx);
34
34
  const rollout = (0, branch_mapping_1.getRollout)(channelObject);
35
35
  const { rolledOutBranch, defaultBranch } = rollout;
36
- const promptMessage = `What percent of users should be directed to the ${rolledOutBranch.name} branch ?`;
36
+ const promptMessage = `What percent of users should be rolled out to the ${rolledOutBranch.name} branch ?`;
37
37
  const percent = (_a = this.options.percent) !== null && _a !== void 0 ? _a : (await (0, utils_1.promptForRolloutPercentAsync)({ promptMessage }));
38
+ if (percent === 0 || percent === 100) {
39
+ log_1.default.warn(`Editing the percent to ${percent} will not end the rollout. You'll need to end the rollout from the main menu.`);
40
+ }
38
41
  const oldBranchMapping = (0, branch_mapping_1.getRolloutBranchMapping)(channelObject.branchMapping);
39
42
  const newBranchMapping = (0, branch_mapping_1.editRolloutBranchMapping)(oldBranchMapping, percent);
40
43
  log_1.default.newLine();
41
- log_1.default.log(`📝 The updated rollout will send ${chalk_1.default.bold(percent)}% of users to the ${chalk_1.default.bold(rolledOutBranch.name)} branch and ${chalk_1.default.bold(100 - percent)}% to the ${chalk_1.default.bold(defaultBranch.name)} branch.`);
44
+ log_1.default.log(`📝 ${chalk_1.default.bold(percent)}% of users will be rolled out to the ${chalk_1.default.bold(rolledOutBranch.name)} branch and ${chalk_1.default.bold(100 - percent)}% will remain on the ${chalk_1.default.bold(defaultBranch.name)} branch.`);
42
45
  const confirmEdit = await this.confirmEditAsync(ctx);
43
46
  if (!confirmEdit) {
44
47
  throw new Error('Aborting...');
@@ -3,9 +3,12 @@ import { UpdateChannelBasicInfoFragment } from '../../graphql/generated';
3
3
  import { UpdateChannelObject } from '../../graphql/queries/ChannelQuery';
4
4
  import { Rollout } from '../branch-mapping';
5
5
  export declare enum EndOutcome {
6
- REPUBLISH_AND_ROUTE_BACK = "republish-and-route-back",
7
- ROUTE_BACK = "route-back"
6
+ REPUBLISH_AND_REVERT = "republish-and-revert",
7
+ REVERT = "revert"
8
8
  }
9
+ export type GeneralOptions = {
10
+ privateKeyPath: string | null;
11
+ };
9
12
  export type NonInteractiveOptions = {
10
13
  outcome: EndOutcome;
11
14
  };
@@ -15,7 +18,7 @@ export type NonInteractiveOptions = {
15
18
  export declare class EndRollout implements EASUpdateAction<UpdateChannelBasicInfoFragment> {
16
19
  private channelInfo;
17
20
  private options;
18
- constructor(channelInfo: UpdateChannelBasicInfoFragment, options?: Partial<NonInteractiveOptions>);
21
+ constructor(channelInfo: UpdateChannelBasicInfoFragment, options: Partial<NonInteractiveOptions> & GeneralOptions);
19
22
  runAsync(ctx: EASUpdateContext): Promise<UpdateChannelBasicInfoFragment>;
20
23
  getChannelObjectAsync(ctx: EASUpdateContext): Promise<UpdateChannelObject>;
21
24
  selectOutcomeAsync(rollout: Rollout): Promise<EndOutcome>;