eas-cli 5.1.0 → 5.3.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.
@@ -128,8 +128,14 @@ async function getSuggestedBundleIdentifierAsync(graphqlClient, exp, projectId)
128
128
  else {
129
129
  // the only callsite is heavily interactive
130
130
  const account = await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, projectId);
131
+ let possibleId;
131
132
  // It's common to use dashes in your node project name, strip them from the suggested package name.
132
- const possibleId = `com.${account.name}.${exp.slug}`.split('-').join('');
133
+ if (account.name) {
134
+ possibleId = `com.${account.name}.${exp.slug}`.split('-').join('');
135
+ }
136
+ else {
137
+ possibleId = `com.${exp.slug}`.split('-').join('');
138
+ }
133
139
  if (isBundleIdentifierValid(possibleId)) {
134
140
  return possibleId;
135
141
  }
@@ -67,12 +67,13 @@ export declare function convertAssetToUpdateInfoGroupFormatAsync(asset: RawAsset
67
67
  * This will be sorted later based on the platform's runtime versions.
68
68
  */
69
69
  export declare function buildUnsortedUpdateInfoGroupAsync(assets: CollectedAssets, exp: ExpoConfig): Promise<UpdateInfoGroup>;
70
- export declare function buildBundlesAsync({ projectDir, inputDir, exp, platformFlag, clearCache, }: {
70
+ export declare function buildBundlesAsync({ projectDir, inputDir, exp, platformFlag, clearCache, dev, }: {
71
71
  projectDir: string;
72
72
  inputDir: string;
73
73
  exp: Pick<ExpoConfig, 'sdkVersion' | 'web'>;
74
74
  platformFlag: ExpoCLIExportPlatformFlag;
75
75
  clearCache?: boolean;
76
+ dev?: boolean;
76
77
  }): Promise<void>;
77
78
  export declare function resolveInputDirectoryAsync(inputDir: string, { skipBundler }: {
78
79
  skipBundler?: boolean;
@@ -118,7 +118,7 @@ async function buildUnsortedUpdateInfoGroupAsync(assets, exp) {
118
118
  return updateInfoGroup;
119
119
  }
120
120
  exports.buildUnsortedUpdateInfoGroupAsync = buildUnsortedUpdateInfoGroupAsync;
121
- async function buildBundlesAsync({ projectDir, inputDir, exp, platformFlag, clearCache, }) {
121
+ async function buildBundlesAsync({ projectDir, inputDir, exp, platformFlag, clearCache, dev = false, }) {
122
122
  var _a;
123
123
  const packageJSON = json_file_1.default.read(path_1.default.resolve(projectDir, 'package.json'));
124
124
  if (!packageJSON) {
@@ -135,6 +135,7 @@ async function buildBundlesAsync({ projectDir, inputDir, exp, platformFlag, clea
135
135
  '--dump-sourcemap',
136
136
  '--dump-assetmap',
137
137
  `--platform=${platformFlag}`,
138
+ ...(dev ? ['--dev'] : []),
138
139
  ...(clearCache ? ['--clear'] : []),
139
140
  ]);
140
141
  }
@@ -151,6 +152,7 @@ async function buildBundlesAsync({ projectDir, inputDir, exp, platformFlag, clea
151
152
  '--dump-sourcemap',
152
153
  '--dump-assetmap',
153
154
  ...platformArgs,
155
+ ...(dev ? ['--dev'] : []),
154
156
  ...(clearCache ? ['--clear'] : []),
155
157
  ]);
156
158
  }
@@ -168,6 +170,7 @@ async function buildBundlesAsync({ projectDir, inputDir, exp, platformFlag, clea
168
170
  '--dump-sourcemap',
169
171
  '--dump-assetmap',
170
172
  `--platform=${platformFlag}`,
173
+ ...(dev ? ['--dev'] : []),
171
174
  ...(clearCache ? ['--clear'] : []),
172
175
  ]);
173
176
  }
@@ -6,6 +6,7 @@ import { GeneralOptions as EndRolloutGeneralOptions, NonInteractiveOptions as En
6
6
  export declare enum ManageRolloutActions {
7
7
  EDIT = "Edit",
8
8
  END = "End",
9
+ VIEW = "View",
9
10
  GO_BACK = "Go back"
10
11
  }
11
12
  /**
@@ -16,7 +17,7 @@ export declare class ManageRollout implements EASUpdateAction<EASUpdateAction> {
16
17
  private options;
17
18
  constructor(channelInfo: UpdateChannelBasicInfoFragment, options: {
18
19
  callingAction?: EASUpdateAction;
19
- action?: ManageRolloutActions.EDIT | ManageRolloutActions.END;
20
+ action?: ManageRolloutActions.EDIT | ManageRolloutActions.END | ManageRolloutActions.VIEW;
20
21
  } & Partial<EditRolloutNonInteractiveOptions> & Partial<EndRolloutNonInteractiveOptions> & EndRolloutGeneralOptions);
21
22
  runAsync(ctx: EASUpdateContext): Promise<EASUpdateAction>;
22
23
  selectActionAsync(): Promise<ManageRolloutActions>;
@@ -14,6 +14,7 @@ var ManageRolloutActions;
14
14
  (function (ManageRolloutActions) {
15
15
  ManageRolloutActions["EDIT"] = "Edit";
16
16
  ManageRolloutActions["END"] = "End";
17
+ ManageRolloutActions["VIEW"] = "View";
17
18
  ManageRolloutActions["GO_BACK"] = "Go back";
18
19
  })(ManageRolloutActions = exports.ManageRolloutActions || (exports.ManageRolloutActions = {}));
19
20
  /**
@@ -38,6 +39,9 @@ class ManageRollout {
38
39
  return new EditRollout_1.EditRollout(this.channelInfo, this.options);
39
40
  case ManageRolloutActions.END:
40
41
  return new EndRollout_1.EndRollout(this.channelInfo, this.options);
42
+ case ManageRolloutActions.VIEW:
43
+ // Rollout is automatically printed in interactive mode
44
+ return new Noop();
41
45
  case ManageRolloutActions.GO_BACK:
42
46
  (0, assert_1.default)(this.options.callingAction, 'calling action must be defined');
43
47
  return this.options.callingAction;
@@ -76,3 +80,6 @@ class ManageRollout {
76
80
  }
77
81
  }
78
82
  exports.ManageRollout = ManageRollout;
83
+ class Noop {
84
+ async runAsync() { }
85
+ }
@@ -1,10 +1,22 @@
1
1
  import { EASUpdateAction, EASUpdateContext } from '../../eas-update/utils';
2
2
  import { UpdateChannelBasicInfoFragment } from '../../graphql/generated';
3
- import { CodeSigningInfo } from '../../utils/code-signing';
3
+ import { UpdateBranchObject, UpdateChannelObject } from '../../graphql/queries/ChannelQuery';
4
4
  import { NonInteractiveOptions as CreateRolloutNonInteractiveOptions } from './CreateRollout';
5
5
  import { NonInteractiveOptions as EditRolloutNonInteractiveOptions } from './EditRollout';
6
6
  import { GeneralOptions as EndRolloutGeneralOptions, NonInteractiveOptions as EndRolloutNonInteractiveOptions } from './EndRollout';
7
7
  import { RolloutActions } from './RolloutMainMenu';
8
+ type JSONRolloutOutput = {
9
+ defaultBranch: UpdateBranchObject;
10
+ rolledOutBranch: UpdateBranchObject;
11
+ percentRolledOut: number;
12
+ runtimeVersion?: string;
13
+ updatedAt: Date;
14
+ };
15
+ type JSONOutput = {
16
+ hasRollout: boolean;
17
+ originalRolloutInfo?: JSONRolloutOutput;
18
+ currentRolloutInfo?: JSONRolloutOutput;
19
+ };
8
20
  /**
9
21
  * Control a rollout in non interactive mode.
10
22
  */
@@ -12,9 +24,21 @@ export declare class NonInteractiveRollout implements EASUpdateAction<void> {
12
24
  private options;
13
25
  constructor(options: {
14
26
  channelName?: string;
15
- codeSigningInfo?: CodeSigningInfo;
27
+ json?: boolean;
16
28
  action?: RolloutActions;
17
29
  } & Partial<EditRolloutNonInteractiveOptions> & Partial<EndRolloutNonInteractiveOptions> & EndRolloutGeneralOptions & Partial<CreateRolloutNonInteractiveOptions>);
18
30
  runAsync(ctx: EASUpdateContext): Promise<void>;
19
- runActionAsync(ctx: EASUpdateContext, action: RolloutActions, channelInfo: UpdateChannelBasicInfoFragment, options: Partial<EditRolloutNonInteractiveOptions> & Partial<EndRolloutNonInteractiveOptions> & EndRolloutGeneralOptions & Partial<CreateRolloutNonInteractiveOptions>): Promise<UpdateChannelBasicInfoFragment>;
31
+ runActionAsync(ctx: EASUpdateContext, action: RolloutActions, channelObject: UpdateChannelObject): Promise<UpdateChannelBasicInfoFragment>;
32
+ viewRollout(channelObject: UpdateChannelObject): UpdateChannelObject;
33
+ getJsonAsync({ originalChannelObject, updatedChannelObject, }: {
34
+ originalChannelObject: UpdateChannelObject;
35
+ updatedChannelObject: UpdateChannelObject;
36
+ }): Promise<JSONOutput>;
37
+ getRolloutJsonAsync(channelObject: UpdateChannelObject): Promise<JSONRolloutOutput>;
38
+ getRuntimeVersion(channelInfo: UpdateChannelBasicInfoFragment): string | undefined;
39
+ getChannelObjectAsync(ctx: EASUpdateContext, { channelName, runtimeVersion }: {
40
+ channelName: string;
41
+ runtimeVersion?: string;
42
+ }): Promise<UpdateChannelObject>;
20
43
  }
44
+ export {};
@@ -1,7 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NonInteractiveRollout = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  const ChannelQuery_1 = require("../../graphql/queries/ChannelQuery");
6
+ const log_1 = tslib_1.__importDefault(require("../../log"));
7
+ const json_1 = require("../../utils/json");
8
+ const branch_mapping_1 = require("../branch-mapping");
9
+ const utils_1 = require("../utils");
5
10
  const CreateRollout_1 = require("./CreateRollout");
6
11
  const EditRollout_1 = require("./EditRollout");
7
12
  const EndRollout_1 = require("./EndRollout");
@@ -27,20 +32,84 @@ class NonInteractiveRollout {
27
32
  appId: app.projectId,
28
33
  channelName,
29
34
  });
35
+ const channelObject = await this.getChannelObjectAsync(ctx, {
36
+ channelName,
37
+ runtimeVersion: this.getRuntimeVersion(channelInfo),
38
+ });
30
39
  if (!action) {
31
40
  throw new Error(`--action is required in non-interactive mode.`);
32
41
  }
33
- await this.runActionAsync(ctx, action, channelInfo, this.options);
42
+ const updatedChannelInfo = await this.runActionAsync(ctx, action, channelObject);
43
+ const updatedChannelObject = await this.getChannelObjectAsync(ctx, {
44
+ channelName,
45
+ runtimeVersion: this.getRuntimeVersion(updatedChannelInfo),
46
+ });
47
+ if (this.options.json) {
48
+ const json = await this.getJsonAsync({
49
+ originalChannelObject: channelObject,
50
+ updatedChannelObject,
51
+ });
52
+ (0, json_1.printJsonOnlyOutput)(json);
53
+ }
34
54
  }
35
- async runActionAsync(ctx, action, channelInfo, options) {
55
+ async runActionAsync(ctx, action, channelObject) {
36
56
  switch (action) {
37
57
  case RolloutMainMenu_1.MainMenuActions.CREATE_NEW:
38
- return await new CreateRollout_1.CreateRollout(channelInfo, options).runAsync(ctx);
58
+ return await new CreateRollout_1.CreateRollout(channelObject, this.options).runAsync(ctx);
39
59
  case ManageRollout_1.ManageRolloutActions.EDIT:
40
- return await new EditRollout_1.EditRollout(channelInfo, options).runAsync(ctx);
60
+ return await new EditRollout_1.EditRollout(channelObject, this.options).runAsync(ctx);
41
61
  case ManageRollout_1.ManageRolloutActions.END:
42
- return await new EndRollout_1.EndRollout(channelInfo, options).runAsync(ctx);
62
+ return await new EndRollout_1.EndRollout(channelObject, this.options).runAsync(ctx);
63
+ case ManageRollout_1.ManageRolloutActions.VIEW:
64
+ return this.viewRollout(channelObject);
65
+ }
66
+ }
67
+ viewRollout(channelObject) {
68
+ if (!this.options.json) {
69
+ (0, utils_1.printRollout)(channelObject);
70
+ log_1.default.warn('For formatted output, add the --json flag to your command.');
43
71
  }
72
+ return channelObject;
73
+ }
74
+ async getJsonAsync({ originalChannelObject, updatedChannelObject, }) {
75
+ return {
76
+ hasRollout: (0, branch_mapping_1.isRollout)(updatedChannelObject),
77
+ ...((0, branch_mapping_1.isRollout)(originalChannelObject)
78
+ ? { originalRolloutInfo: await this.getRolloutJsonAsync(originalChannelObject) }
79
+ : {}),
80
+ ...((0, branch_mapping_1.isRollout)(updatedChannelObject)
81
+ ? { currentRolloutInfo: await this.getRolloutJsonAsync(updatedChannelObject) }
82
+ : {}),
83
+ };
84
+ }
85
+ async getRolloutJsonAsync(channelObject) {
86
+ var _a;
87
+ const rollout = (0, branch_mapping_1.getRollout)(channelObject);
88
+ return {
89
+ defaultBranch: rollout.defaultBranch,
90
+ rolledOutBranch: rollout.rolledOutBranch,
91
+ percentRolledOut: rollout.percentRolledOut,
92
+ runtimeVersion: (_a = this.getRuntimeVersion(channelObject)) !== null && _a !== void 0 ? _a : undefined,
93
+ updatedAt: channelObject.updatedAt,
94
+ };
95
+ }
96
+ getRuntimeVersion(channelInfo) {
97
+ if ((0, branch_mapping_1.isRollout)(channelInfo)) {
98
+ const updatedRolloutInfo = (0, branch_mapping_1.getRolloutInfo)(channelInfo);
99
+ if ((0, branch_mapping_1.isConstrainedRolloutInfo)(updatedRolloutInfo)) {
100
+ return updatedRolloutInfo.runtimeVersion;
101
+ }
102
+ }
103
+ return undefined;
104
+ }
105
+ async getChannelObjectAsync(ctx, { channelName, runtimeVersion }) {
106
+ const { graphqlClient, app } = ctx;
107
+ const { projectId } = app;
108
+ return await ChannelQuery_1.ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
109
+ appId: projectId,
110
+ channelName,
111
+ ...(runtimeVersion ? { filter: { runtimeVersions: [runtimeVersion] } } : {}),
112
+ });
44
113
  }
45
114
  }
46
115
  exports.NonInteractiveRollout = NonInteractiveRollout;
@@ -8,7 +8,7 @@ export declare enum MainMenuActions {
8
8
  CREATE_NEW = "Create a new rollout",
9
9
  MANAGE_EXISTING = "Manage an existing rollout"
10
10
  }
11
- export type RolloutActions = MainMenuActions.CREATE_NEW | ManageRolloutActions.EDIT | ManageRolloutActions.END;
11
+ export type RolloutActions = MainMenuActions.CREATE_NEW | ManageRolloutActions.EDIT | ManageRolloutActions.END | ManageRolloutActions.VIEW;
12
12
  /**
13
13
  * Manage a rollout for the project.
14
14
  */
@@ -95,7 +95,9 @@ class RolloutMainMenu {
95
95
  if (action === MainMenuActions.CREATE_NEW) {
96
96
  return MainMenuActions.CREATE_NEW;
97
97
  }
98
- else if (action === ManageRollout_1.ManageRolloutActions.EDIT || action === ManageRollout_1.ManageRolloutActions.END) {
98
+ else if (action === ManageRollout_1.ManageRolloutActions.EDIT ||
99
+ action === ManageRollout_1.ManageRolloutActions.END ||
100
+ action === ManageRollout_1.ManageRolloutActions.VIEW) {
99
101
  return MainMenuActions.MANAGE_EXISTING;
100
102
  }
101
103
  else {
@@ -9,6 +9,10 @@ const utils_1 = require("../update/utils");
9
9
  const formatFields_1 = tslib_1.__importDefault(require("../utils/formatFields"));
10
10
  const branch_mapping_1 = require("./branch-mapping");
11
11
  function printRollout(channel) {
12
+ if (!(0, branch_mapping_1.isRollout)(channel)) {
13
+ log_1.default.log(`Channel ${chalk_1.default.bold(channel.name)} doesn't have a rollout.`);
14
+ return;
15
+ }
12
16
  const rollout = (0, branch_mapping_1.getRollout)(channel);
13
17
  displayRolloutDetails(channel.name, rollout);
14
18
  }
@@ -5,7 +5,6 @@ const tslib_1 = require("tslib");
5
5
  const eas_json_1 = require("@expo/eas-json");
6
6
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
7
7
  const path_1 = tslib_1.__importDefault(require("path"));
8
- const semver_1 = tslib_1.__importDefault(require("semver"));
9
8
  const log_1 = tslib_1.__importStar(require("../log"));
10
9
  async function getProfilesAsync({ easJsonAccessor, platforms, profileName, type, projectDir, }) {
11
10
  const results = platforms.map(async function (platform) {
@@ -47,9 +46,6 @@ async function getNodeVersionFromFileAsync(projectDir) {
47
46
  catch {
48
47
  return undefined;
49
48
  }
50
- if (!semver_1.default.valid(semver_1.default.coerce(nodeVersion))) {
51
- throw new Error(`Invalid node version in .nvmrc: ${nodeVersion}`);
52
- }
53
49
  return nodeVersion;
54
50
  }
55
51
  async function readProfileWithOverridesAsync({ easJsonAccessor, platform, type, profileName, projectDir, }) {
@@ -17,6 +17,8 @@ const humanReadableServiceName = {
17
17
  [generated_1.StatuspageServiceName.EasBuild]: 'EAS Build',
18
18
  [generated_1.StatuspageServiceName.EasSubmit]: 'EAS Submit',
19
19
  [generated_1.StatuspageServiceName.EasUpdate]: 'EAS Update',
20
+ [generated_1.StatuspageServiceName.GithubApiRequests]: 'GitHub API Requests',
21
+ [generated_1.StatuspageServiceName.GithubWebhooks]: 'Github Webhooks',
20
22
  };
21
23
  function warnAboutServiceOutage(service) {
22
24
  if (service.status === generated_1.StatuspageServiceStatus.Operational) {