eas-cli 3.5.2 → 3.6.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.
@@ -17,7 +17,7 @@ const prompts_1 = require("../../prompts");
17
17
  const workflow_1 = require("../workflow");
18
18
  const gradleUtils = tslib_1.__importStar(require("./gradleUtils"));
19
19
  exports.INVALID_APPLICATION_ID_MESSAGE = `Invalid format of Android applicationId. Only alphanumeric characters, '.' and '_' are allowed, and each '.' must be followed by a letter.`;
20
- async function ensureApplicationIdIsDefinedForManagedProjectAsync(projectDir, exp, actor) {
20
+ async function ensureApplicationIdIsDefinedForManagedProjectAsync({ graphqlClient, projectDir, projectId, exp, }) {
21
21
  const workflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.ANDROID);
22
22
  (0, assert_1.default)(workflow === eas_build_job_1.Workflow.MANAGED, 'This function should be called only for managed projects');
23
23
  try {
@@ -26,7 +26,7 @@ async function ensureApplicationIdIsDefinedForManagedProjectAsync(projectDir, ex
26
26
  });
27
27
  }
28
28
  catch {
29
- return await configureApplicationIdAsync(projectDir, exp, actor);
29
+ return await configureApplicationIdAsync({ graphqlClient, projectDir, projectId, exp });
30
30
  }
31
31
  }
32
32
  exports.ensureApplicationIdIsDefinedForManagedProjectAsync = ensureApplicationIdIsDefinedForManagedProjectAsync;
@@ -85,7 +85,7 @@ async function getApplicationIdAsync(projectDir, exp, gradleContext) {
85
85
  }
86
86
  }
87
87
  exports.getApplicationIdAsync = getApplicationIdAsync;
88
- async function configureApplicationIdAsync(projectDir, exp, actor) {
88
+ async function configureApplicationIdAsync({ graphqlClient, projectDir, projectId, exp, }) {
89
89
  var _a;
90
90
  const paths = (0, config_1.getConfigFilePaths)(projectDir);
91
91
  // we can't automatically update app.config.js
@@ -95,7 +95,7 @@ async function configureApplicationIdAsync(projectDir, exp, actor) {
95
95
  (0, assert_1.default)(paths.staticConfigPath, 'app.json must exist');
96
96
  log_1.default.addNewLineIfNone();
97
97
  log_1.default.log(`${chalk_1.default.bold(`📝 Android application id`)} ${chalk_1.default.dim((0, log_1.learnMore)('https://expo.fyi/android-package'))}`);
98
- const suggestedAndroidApplicationId = await getSuggestedApplicationIdAsync(exp, actor);
98
+ const suggestedAndroidApplicationId = await getSuggestedApplicationIdAsync(graphqlClient, exp, projectId);
99
99
  const { packageName } = await (0, prompts_1.promptAsync)({
100
100
  name: 'packageName',
101
101
  type: 'text',
@@ -125,7 +125,7 @@ function warnIfAndroidPackageDefinedInAppConfigForBareWorkflowProject(projectDir
125
125
  }
126
126
  }
127
127
  exports.warnIfAndroidPackageDefinedInAppConfigForBareWorkflowProject = warnIfAndroidPackageDefinedInAppConfigForBareWorkflowProject;
128
- async function getSuggestedApplicationIdAsync(exp, actor) {
128
+ async function getSuggestedApplicationIdAsync(graphqlClient, exp, projectId) {
129
129
  // Attempt to use the ios bundle id first since it's convenient to have them aligned.
130
130
  const maybeBundleId = config_plugins_1.IOSConfig.BundleIdentifier.getBundleIdentifier(exp);
131
131
  if (maybeBundleId && isApplicationIdValid(maybeBundleId)) {
@@ -133,9 +133,9 @@ async function getSuggestedApplicationIdAsync(exp, actor) {
133
133
  }
134
134
  else {
135
135
  // the only callsite is heavily interactive
136
- const username = (0, projectUtils_1.getUsername)(exp, actor);
136
+ const account = await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, projectId);
137
137
  // It's common to use dashes in your node project name, strip them from the suggested package name.
138
- const possibleId = `com.${username}.${exp.slug}`.split('-').join('');
138
+ const possibleId = `com.${account.name}.${exp.slug}`.split('-').join('');
139
139
  if (isApplicationIdValid(possibleId)) {
140
140
  return possibleId;
141
141
  }
@@ -1,5 +1,12 @@
1
1
  import { ExpoConfig } from '@expo/config';
2
2
  import { Platform } from '@expo/eas-build-job';
3
3
  import { BuildProfile } from '@expo/eas-json';
4
- import { Actor } from '../user/User';
5
- export declare function getApplicationIdentifierAsync(projectDir: string, exp: ExpoConfig, buildProfile: BuildProfile, platform: Platform, actor: Actor): Promise<string>;
4
+ import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
5
+ export declare function getApplicationIdentifierAsync({ graphqlClient, projectDir, projectId, exp, buildProfile, platform, }: {
6
+ graphqlClient: ExpoGraphqlClient;
7
+ projectDir: string;
8
+ projectId: string;
9
+ exp: ExpoConfig;
10
+ buildProfile: BuildProfile;
11
+ platform: Platform;
12
+ }): Promise<string>;
@@ -8,12 +8,17 @@ const bundleIdentifier_1 = require("./ios/bundleIdentifier");
8
8
  const scheme_1 = require("./ios/scheme");
9
9
  const target_1 = require("./ios/target");
10
10
  const workflow_1 = require("./workflow");
11
- async function getApplicationIdentifierAsync(projectDir, exp, buildProfile, platform, actor) {
11
+ async function getApplicationIdentifierAsync({ graphqlClient, projectDir, projectId, exp, buildProfile, platform, }) {
12
12
  if (platform === eas_build_job_1.Platform.ANDROID) {
13
13
  const profile = buildProfile;
14
14
  const workflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.ANDROID);
15
15
  if (workflow === eas_build_job_1.Workflow.MANAGED) {
16
- return await (0, applicationId_1.ensureApplicationIdIsDefinedForManagedProjectAsync)(projectDir, exp, actor);
16
+ return await (0, applicationId_1.ensureApplicationIdIsDefinedForManagedProjectAsync)({
17
+ graphqlClient,
18
+ projectDir,
19
+ projectId,
20
+ exp,
21
+ });
17
22
  }
18
23
  const gradleContext = await (0, gradle_1.resolveGradleBuildContextAsync)(projectDir, profile);
19
24
  return await (0, applicationId_1.getApplicationIdAsync)(projectDir, exp, gradleContext);
@@ -22,7 +27,12 @@ async function getApplicationIdentifierAsync(projectDir, exp, buildProfile, plat
22
27
  const workflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.IOS);
23
28
  const profile = buildProfile;
24
29
  if (workflow === eas_build_job_1.Workflow.MANAGED) {
25
- return await (0, bundleIdentifier_1.ensureBundleIdentifierIsDefinedForManagedProjectAsync)(projectDir, exp, actor);
30
+ return await (0, bundleIdentifier_1.ensureBundleIdentifierIsDefinedForManagedProjectAsync)({
31
+ graphqlClient,
32
+ projectDir,
33
+ projectId,
34
+ exp,
35
+ });
26
36
  }
27
37
  const xcodeBuildContext = await (0, scheme_1.resolveXcodeBuildContextAsync)({ exp, projectDir, nonInteractive: false }, profile);
28
38
  const targets = await (0, target_1.resolveTargetsAsync)({
@@ -1,7 +1,12 @@
1
1
  import { ExpoConfig } from '@expo/config';
2
- import { Actor } from '../../user/User';
2
+ import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
3
3
  export declare const INVALID_BUNDLE_IDENTIFIER_MESSAGE = "Invalid format of iOS bundle identifier. Only alphanumeric characters, '.' and '-' are allowed, and each '.' must be followed by a letter.";
4
- export declare function ensureBundleIdentifierIsDefinedForManagedProjectAsync(projectDir: string, exp: ExpoConfig, actor: Actor): Promise<string>;
4
+ export declare function ensureBundleIdentifierIsDefinedForManagedProjectAsync({ graphqlClient, projectDir, projectId, exp, }: {
5
+ graphqlClient: ExpoGraphqlClient;
6
+ projectDir: string;
7
+ projectId: string;
8
+ exp: ExpoConfig;
9
+ }): Promise<string>;
5
10
  export declare class AmbiguousBundleIdentifierError extends Error {
6
11
  constructor(message?: string);
7
12
  }
@@ -14,14 +14,19 @@ const prompts_1 = require("../../prompts");
14
14
  const projectUtils_1 = require("../projectUtils");
15
15
  const workflow_1 = require("../workflow");
16
16
  exports.INVALID_BUNDLE_IDENTIFIER_MESSAGE = `Invalid format of iOS bundle identifier. Only alphanumeric characters, '.' and '-' are allowed, and each '.' must be followed by a letter.`;
17
- async function ensureBundleIdentifierIsDefinedForManagedProjectAsync(projectDir, exp, actor) {
17
+ async function ensureBundleIdentifierIsDefinedForManagedProjectAsync({ graphqlClient, projectDir, projectId, exp, }) {
18
18
  const workflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.IOS);
19
19
  (0, assert_1.default)(workflow === eas_build_job_1.Workflow.MANAGED, 'This function should be called only for managed projects');
20
20
  try {
21
21
  return await getBundleIdentifierAsync(projectDir, exp);
22
22
  }
23
23
  catch {
24
- return await configureBundleIdentifierAsync(projectDir, exp, actor);
24
+ return await configureBundleIdentifierAsync({
25
+ graphqlClient,
26
+ projectDir,
27
+ exp,
28
+ projectId,
29
+ });
25
30
  }
26
31
  }
27
32
  exports.ensureBundleIdentifierIsDefinedForManagedProjectAsync = ensureBundleIdentifierIsDefinedForManagedProjectAsync;
@@ -69,7 +74,7 @@ async function getBundleIdentifierAsync(projectDir, exp, xcodeContext) {
69
74
  }
70
75
  }
71
76
  exports.getBundleIdentifierAsync = getBundleIdentifierAsync;
72
- async function configureBundleIdentifierAsync(projectDir, exp, actor) {
77
+ async function configureBundleIdentifierAsync({ graphqlClient, projectDir, projectId, exp, }) {
73
78
  var _a;
74
79
  const paths = (0, config_1.getConfigFilePaths)(projectDir);
75
80
  // we can't automatically update app.config.js
@@ -79,7 +84,7 @@ async function configureBundleIdentifierAsync(projectDir, exp, actor) {
79
84
  (0, assert_1.default)(paths.staticConfigPath, 'app.json must exist');
80
85
  log_1.default.addNewLineIfNone();
81
86
  log_1.default.log(`${chalk_1.default.bold(`📝 iOS Bundle Identifier`)} ${chalk_1.default.dim((0, log_1.learnMore)('https://expo.fyi/bundle-identifier'))}`);
82
- const suggestedBundleIdentifier = await getSuggestedBundleIdentifierAsync(exp, actor);
87
+ const suggestedBundleIdentifier = await getSuggestedBundleIdentifierAsync(graphqlClient, exp, projectId);
83
88
  const { bundleIdentifier } = await (0, prompts_1.promptAsync)({
84
89
  name: 'bundleIdentifier',
85
90
  type: 'text',
@@ -114,7 +119,7 @@ function isWildcardBundleIdentifier(bundleIdentifier) {
114
119
  return wildcardRegex.test(bundleIdentifier);
115
120
  }
116
121
  exports.isWildcardBundleIdentifier = isWildcardBundleIdentifier;
117
- async function getSuggestedBundleIdentifierAsync(exp, actor) {
122
+ async function getSuggestedBundleIdentifierAsync(graphqlClient, exp, projectId) {
118
123
  // Attempt to use the android package name first since it's convenient to have them aligned.
119
124
  const maybeAndroidPackage = config_plugins_1.AndroidConfig.Package.getPackage(exp);
120
125
  if (maybeAndroidPackage && isBundleIdentifierValid(maybeAndroidPackage)) {
@@ -122,9 +127,9 @@ async function getSuggestedBundleIdentifierAsync(exp, actor) {
122
127
  }
123
128
  else {
124
129
  // the only callsite is heavily interactive
125
- const username = (0, projectUtils_1.getUsername)(exp, actor);
130
+ const account = await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, projectId);
126
131
  // It's common to use dashes in your node project name, strip them from the suggested package name.
127
- const possibleId = `com.${username}.${exp.slug}`.split('-').join('');
132
+ const possibleId = `com.${account.name}.${exp.slug}`.split('-').join('');
128
133
  if (isBundleIdentifierValid(possibleId)) {
129
134
  return possibleId;
130
135
  }
@@ -190,22 +190,31 @@ async function handleBuildListSourceAsync(ctx) {
190
190
  }
191
191
  }
192
192
  function formatBuildChoice(build, expiryDate) {
193
- const { id, updatedAt, runtimeVersion, buildProfile, gitCommitHash, gitCommitMessage, channel } = build;
194
- const formatValue = (field) => (field ? chalk_1.default.bold(field) : 'Unknown');
193
+ const { id, updatedAt, runtimeVersion, buildProfile, gitCommitHash, gitCommitMessage, channel, message, } = build;
195
194
  const buildDate = new Date(updatedAt);
196
- const formattedCommitData = gitCommitHash && gitCommitMessage
197
- ? `${gitCommitHash.slice(0, 7)} "${chalk_1.default.bold(gitCommitMessage)}"`
198
- : 'Unknown';
195
+ const splitCommitMessage = gitCommitMessage === null || gitCommitMessage === void 0 ? void 0 : gitCommitMessage.split('\n');
196
+ const formattedCommitData = gitCommitHash && splitCommitMessage && splitCommitMessage.length > 0
197
+ ? `${gitCommitHash.slice(0, 7)} "${chalk_1.default.bold(splitCommitMessage[0] + (splitCommitMessage.length > 1 ? '…' : ''))}"`
198
+ : null;
199
199
  const title = `${chalk_1.default.bold(`ID:`)} ${id} (${chalk_1.default.bold(`${(0, date_1.fromNow)(buildDate)} ago`)})`;
200
- const description = [
201
- `\t${chalk_1.default.bold(`Profile:`)} ${formatValue(buildProfile)}`,
202
- `\t${chalk_1.default.bold(`Channel:`)} ${formatValue(channel)}`,
203
- `\t${chalk_1.default.bold(`Runtime version:`)} ${formatValue(runtimeVersion)}`,
204
- `\t${chalk_1.default.bold(`Commit:`)} ${formattedCommitData}`,
205
- ].join('\n');
200
+ const descriptionItems = [
201
+ { name: 'Profile', value: buildProfile ? chalk_1.default.bold(buildProfile) : null },
202
+ { name: 'Channel', value: channel ? chalk_1.default.bold(channel) : null },
203
+ { name: 'Runtime version', value: runtimeVersion ? chalk_1.default.bold(runtimeVersion) : null },
204
+ { name: 'Commit', value: formattedCommitData },
205
+ {
206
+ name: 'Message',
207
+ value: message
208
+ ? chalk_1.default.bold(message.length > 200 ? `${message.slice(0, 200)}...` : message)
209
+ : null,
210
+ },
211
+ ];
212
+ const filteredDescriptionArray = descriptionItems
213
+ .filter(item => item.value)
214
+ .map(item => `${chalk_1.default.bold(item.name)}: ${item.value}`);
206
215
  return {
207
216
  title,
208
- description,
217
+ description: filteredDescriptionArray.length > 0 ? filteredDescriptionArray.join('\n') : '',
209
218
  value: build,
210
219
  disabled: buildDate < expiryDate,
211
220
  };
@@ -2,7 +2,7 @@ import { ExpoConfig } from '@expo/config-types';
2
2
  import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
3
3
  import { RequestedPlatform } from '../platform';
4
4
  export declare const DEFAULT_MANAGED_RUNTIME_VERSION: {
5
- readonly policy: "appVersion";
5
+ readonly policy: "sdkVersion";
6
6
  };
7
7
  export declare const DEFAULT_BARE_RUNTIME_VERSION: "1.0.0";
8
8
  /**
@@ -15,7 +15,7 @@ const projectUtils_1 = require("../project/projectUtils");
15
15
  const workflow_1 = require("../project/workflow");
16
16
  const UpdatesModule_1 = require("./android/UpdatesModule");
17
17
  const UpdatesModule_2 = require("./ios/UpdatesModule");
18
- exports.DEFAULT_MANAGED_RUNTIME_VERSION = { policy: 'appVersion' };
18
+ exports.DEFAULT_MANAGED_RUNTIME_VERSION = { policy: 'sdkVersion' };
19
19
  exports.DEFAULT_BARE_RUNTIME_VERSION = '1.0.0';
20
20
  function getDefaultRuntimeVersion(workflow) {
21
21
  return workflow === eas_build_job_1.Workflow.GENERIC
@@ -5,4 +5,5 @@ export type Actor = NonNullable<CurrentUserQuery['meActor']>;
5
5
  * This should be used whenever the "current user" needs to be displayed.
6
6
  * The display name CANNOT be used as project owner.
7
7
  */
8
- export declare function getActorDisplayName(user?: Actor): string;
8
+ export declare function getActorDisplayName(actor?: Actor): string;
9
+ export declare function getActorUsername(actor?: Actor): string | null;
@@ -1,21 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getActorDisplayName = void 0;
3
+ exports.getActorUsername = exports.getActorDisplayName = void 0;
4
4
  /**
5
5
  * Resolve the name of the actor, either normal user or robot user.
6
6
  * This should be used whenever the "current user" needs to be displayed.
7
7
  * The display name CANNOT be used as project owner.
8
8
  */
9
- function getActorDisplayName(user) {
10
- switch (user === null || user === void 0 ? void 0 : user.__typename) {
9
+ function getActorDisplayName(actor) {
10
+ switch (actor === null || actor === void 0 ? void 0 : actor.__typename) {
11
11
  case 'User':
12
- return user.username;
12
+ return actor.username;
13
13
  case 'Robot':
14
- return user.firstName ? `${user.firstName} (robot)` : 'robot';
14
+ return actor.firstName ? `${actor.firstName} (robot)` : 'robot';
15
15
  case 'SSOUser':
16
- return user.username ? `${user.username} (sso user)` : 'sso user';
16
+ return actor.username ? `${actor.username} (sso user)` : 'sso user';
17
17
  default:
18
18
  return 'anonymous';
19
19
  }
20
20
  }
21
21
  exports.getActorDisplayName = getActorDisplayName;
22
+ function getActorUsername(actor) {
23
+ switch (actor === null || actor === void 0 ? void 0 : actor.__typename) {
24
+ case 'User':
25
+ case 'SSOUser':
26
+ return actor.username;
27
+ default:
28
+ return null;
29
+ }
30
+ }
31
+ exports.getActorUsername = getActorUsername;