eas-cli 0.37.0 → 0.38.3

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 +52 -40
  2. package/build/build/android/build.d.ts +2 -1
  3. package/build/build/android/build.js +11 -9
  4. package/build/build/android/configure.d.ts +3 -2
  5. package/build/build/build.d.ts +0 -2
  6. package/build/build/build.js +1 -2
  7. package/build/build/configure.js +1 -2
  8. package/build/build/context.d.ts +18 -10
  9. package/build/build/context.js +0 -96
  10. package/build/build/createContext.d.ts +13 -0
  11. package/build/build/createContext.js +114 -0
  12. package/build/build/ios/build.d.ts +2 -1
  13. package/build/build/ios/build.js +24 -19
  14. package/build/build/ios/configure.d.ts +3 -2
  15. package/build/build/ios/version.d.ts +1 -1
  16. package/build/build/ios/version.js +4 -1
  17. package/build/build/local.js +14 -3
  18. package/build/build/metadata.d.ts +1 -12
  19. package/build/build/metadata.js +24 -19
  20. package/build/build/validate.d.ts +3 -3
  21. package/build/commandUtils/EasCommand.js +0 -2
  22. package/build/commands/branch/publish.js +10 -0
  23. package/build/commands/build/configure.js +2 -0
  24. package/build/commands/build/index.js +24 -16
  25. package/build/commands/config.js +1 -1
  26. package/build/commands/update/configure.d.ts +7 -0
  27. package/build/commands/update/configure.js +67 -0
  28. package/build/commands/webhook/create.js +1 -2
  29. package/build/commands/webhook/list.js +1 -1
  30. package/build/commands/webhook/update.js +1 -2
  31. package/build/credentials/ios/appstore/bundleIdCapabilities.js +11 -1
  32. package/build/credentials/ios/appstore/entitlements.js +1 -1
  33. package/build/credentials/manager/SelectBuildProfileFromEasJson.js +1 -1
  34. package/build/credentials/manager/SelectIosDistributionTypeGraphqlFromBuildProfile.d.ts +3 -2
  35. package/build/graphql/generated.d.ts +2 -1
  36. package/build/graphql/generated.js +1 -0
  37. package/build/project/ios/scheme.d.ts +3 -2
  38. package/build/submit/android/AndroidSubmitCommand.js +2 -1
  39. package/build/submit/context.d.ts +2 -0
  40. package/build/submit/context.js +2 -1
  41. package/build/submit/ios/IosSubmitCommand.js +2 -1
  42. package/build/utils/profiles.d.ts +2 -3
  43. package/build/utils/profiles.js +20 -7
  44. package/build/vcs/clients/git.js +4 -1
  45. package/build/webhooks/input.d.ts +2 -2
  46. package/build/webhooks/input.js +19 -2
  47. package/oclif.manifest.json +1 -1
  48. package/package.json +16 -16
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createBuildContextAsync = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const eas_build_job_1 = require("@expo/eas-build-job");
6
+ const json_file_1 = (0, tslib_1.__importDefault)(require("@expo/json-file"));
7
+ const resolve_from_1 = (0, tslib_1.__importDefault)(require("resolve-from"));
8
+ const uuid_1 = require("uuid");
9
+ const events_1 = require("../analytics/events");
10
+ const context_1 = require("../credentials/context");
11
+ const expoConfig_1 = require("../project/expoConfig");
12
+ const projectUtils_1 = require("../project/projectUtils");
13
+ const workflow_1 = require("../project/workflow");
14
+ const Account_1 = require("../user/Account");
15
+ const actions_1 = require("../user/actions");
16
+ const build_1 = require("./android/build");
17
+ const build_2 = require("./ios/build");
18
+ async function createBuildContextAsync({ buildProfileName, buildProfile, clearCache = false, local, nonInteractive = false, platform, projectDir, skipProjectConfiguration = false, }) {
19
+ var _a;
20
+ const exp = (0, expoConfig_1.getExpoConfig)(projectDir, { env: buildProfile.env });
21
+ const user = await (0, actions_1.ensureLoggedInAsync)();
22
+ const accountName = (0, projectUtils_1.getProjectAccountName)(exp, user);
23
+ const projectName = exp.slug;
24
+ const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp, { env: buildProfile.env });
25
+ const workflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, platform);
26
+ const accountId = (_a = (0, Account_1.findAccountByName)(user.accounts, accountName)) === null || _a === void 0 ? void 0 : _a.id;
27
+ const credentialsCtx = new context_1.CredentialsContext({
28
+ exp,
29
+ nonInteractive,
30
+ projectDir,
31
+ user,
32
+ });
33
+ const devClientProperties = getDevClientEventProperties({
34
+ platform,
35
+ projectDir,
36
+ buildProfile,
37
+ });
38
+ const trackingCtx = {
39
+ tracking_id: (0, uuid_1.v4)(),
40
+ platform,
41
+ ...(accountId && { account_id: accountId }),
42
+ account_name: accountName,
43
+ project_id: projectId,
44
+ project_type: workflow,
45
+ ...devClientProperties,
46
+ };
47
+ events_1.Analytics.logEvent(events_1.BuildEvent.BUILD_COMMAND, trackingCtx);
48
+ const commonContext = {
49
+ accountName,
50
+ buildProfile,
51
+ buildProfileName,
52
+ clearCache,
53
+ credentialsCtx,
54
+ exp,
55
+ local,
56
+ nonInteractive,
57
+ platform,
58
+ projectDir,
59
+ projectId,
60
+ projectName,
61
+ skipProjectConfiguration,
62
+ trackingCtx,
63
+ user,
64
+ workflow,
65
+ };
66
+ if (platform === eas_build_job_1.Platform.ANDROID) {
67
+ const common = commonContext;
68
+ return {
69
+ ...common,
70
+ android: await (0, build_1.createAndroidContextAsync)(common),
71
+ };
72
+ }
73
+ else {
74
+ const common = commonContext;
75
+ return {
76
+ ...common,
77
+ ios: await (0, build_2.createIosContextAsync)(common),
78
+ };
79
+ }
80
+ }
81
+ exports.createBuildContextAsync = createBuildContextAsync;
82
+ function getDevClientEventProperties({ platform, projectDir, buildProfile, }) {
83
+ var _a;
84
+ let includesDevClient;
85
+ const version = tryGetDevClientVersion(projectDir);
86
+ if (platform === eas_build_job_1.Platform.ANDROID && 'gradleCommand' in buildProfile) {
87
+ includesDevClient = Boolean(version && ((_a = buildProfile.gradleCommand) === null || _a === void 0 ? void 0 : _a.includes('Debug')));
88
+ }
89
+ else if (platform === eas_build_job_1.Platform.IOS && 'buildConfiguration' in buildProfile) {
90
+ includesDevClient = Boolean(version && buildProfile.buildConfiguration === 'Debug');
91
+ }
92
+ else if (buildProfile.developmentClient) {
93
+ includesDevClient = true;
94
+ }
95
+ else {
96
+ includesDevClient = false;
97
+ }
98
+ if (version) {
99
+ return { dev_client: includesDevClient, dev_client_version: version };
100
+ }
101
+ else {
102
+ return { dev_client: includesDevClient };
103
+ }
104
+ }
105
+ function tryGetDevClientVersion(projectDir) {
106
+ var _a, _b;
107
+ try {
108
+ const pkg = json_file_1.default.read((0, resolve_from_1.default)(projectDir, 'expo-dev-client/package.json'));
109
+ return (_b = (_a = pkg.version) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : null;
110
+ }
111
+ catch {
112
+ return null;
113
+ }
114
+ }
@@ -1,4 +1,5 @@
1
1
  import { Platform } from '@expo/eas-build-job';
2
2
  import { BuildRequestSender } from '../build';
3
- import { BuildContext } from '../context';
3
+ import { BuildContext, CommonContext, IosBuildContext } from '../context';
4
+ export declare function createIosContextAsync(ctx: CommonContext<Platform.IOS>): Promise<IosBuildContext>;
4
5
  export declare function prepareIosBuildAsync(ctx: BuildContext<Platform.IOS>): Promise<BuildRequestSender>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.prepareIosBuildAsync = void 0;
3
+ exports.prepareIosBuildAsync = exports.createIosContextAsync = void 0;
4
4
  const config_plugins_1 = require("@expo/config-plugins");
5
5
  const eas_build_job_1 = require("@expo/eas-build-job");
6
6
  const BuildMutation_1 = require("../../graphql/mutations/BuildMutation");
@@ -14,7 +14,7 @@ const configure_1 = require("./configure");
14
14
  const credentials_1 = require("./credentials");
15
15
  const graphql_2 = require("./graphql");
16
16
  const prepareJob_1 = require("./prepareJob");
17
- async function prepareIosBuildAsync(ctx) {
17
+ async function createIosContextAsync(ctx) {
18
18
  const { buildProfile } = ctx;
19
19
  if (ctx.workflow === eas_build_job_1.Workflow.MANAGED) {
20
20
  await (0, bundleIdentifier_1.ensureBundleIdentifierIsDefinedForManagedProjectAsync)(ctx.projectDir, ctx.exp);
@@ -30,25 +30,36 @@ async function prepareIosBuildAsync(ctx) {
30
30
  projectDir: ctx.projectDir,
31
31
  exp: ctx.exp,
32
32
  }, xcodeBuildContext);
33
- const buildConfiguration = resolveBuildConfiguration(ctx, targets);
33
+ const applicationTarget = (0, target_1.findApplicationTarget)(targets);
34
+ const applicationTargetBuildSettings = resolveBuildSettings(ctx, applicationTarget);
35
+ return {
36
+ bundleIdentifier: applicationTarget.bundleIdentifier,
37
+ applicationTarget,
38
+ applicationTargetBuildSettings,
39
+ targets,
40
+ xcodeBuildContext,
41
+ };
42
+ }
43
+ exports.createIosContextAsync = createIosContextAsync;
44
+ async function prepareIosBuildAsync(ctx) {
34
45
  return await (0, build_1.prepareBuildRequestForPlatformAsync)({
35
46
  ctx,
36
47
  ensureCredentialsAsync: async (ctx) => {
37
- return (0, credentials_1.ensureIosCredentialsAsync)(ctx, targets);
48
+ return (0, credentials_1.ensureIosCredentialsAsync)(ctx, ctx.ios.targets);
38
49
  },
39
50
  ensureProjectConfiguredAsync: async () => {
40
51
  await (0, configure_1.validateAndSyncProjectConfigurationAsync)({
41
52
  projectDir: ctx.projectDir,
42
53
  exp: ctx.exp,
43
- buildProfile,
44
- buildSettings: buildConfiguration.buildSettings,
54
+ buildProfile: ctx.buildProfile,
55
+ buildSettings: ctx.ios.applicationTargetBuildSettings,
45
56
  });
46
57
  },
47
- getMetadataContext: () => {
48
- return buildConfiguration;
49
- },
50
58
  prepareJobAsync: async (ctx, jobData) => {
51
- return await (0, prepareJob_1.prepareJobAsync)(ctx, { ...jobData, buildScheme: xcodeBuildContext.buildScheme });
59
+ return await (0, prepareJob_1.prepareJobAsync)(ctx, {
60
+ ...jobData,
61
+ buildScheme: ctx.ios.xcodeBuildContext.buildScheme,
62
+ });
52
63
  },
53
64
  sendBuildRequestAsync: async (appId, job, metadata) => {
54
65
  const graphqlMetadata = (0, graphql_1.transformMetadata)(metadata);
@@ -62,21 +73,15 @@ async function prepareIosBuildAsync(ctx) {
62
73
  });
63
74
  }
64
75
  exports.prepareIosBuildAsync = prepareIosBuildAsync;
65
- function resolveBuildConfiguration(ctx, targets) {
76
+ function resolveBuildSettings(ctx, applicationTarget) {
66
77
  var _a;
67
78
  if (ctx.workflow === eas_build_job_1.Workflow.MANAGED) {
68
- return { buildSettings: {} };
79
+ return {};
69
80
  }
70
- const applicationTarget = (0, target_1.findApplicationTarget)(targets);
71
81
  const project = config_plugins_1.IOSConfig.XcodeUtils.getPbxproj(ctx.projectDir);
72
82
  const xcBuildConfiguration = config_plugins_1.IOSConfig.Target.getXCBuildConfigurationFromPbxproj(project, {
73
83
  targetName: applicationTarget.targetName,
74
84
  buildConfiguration: applicationTarget.buildConfiguration,
75
85
  });
76
- const buildSettings = (_a = xcBuildConfiguration === null || xcBuildConfiguration === void 0 ? void 0 : xcBuildConfiguration.buildSettings) !== null && _a !== void 0 ? _a : {};
77
- return {
78
- buildSettings,
79
- targetName: applicationTarget.targetName,
80
- buildConfiguration: applicationTarget.buildConfiguration,
81
- };
86
+ return (_a = xcBuildConfiguration === null || xcBuildConfiguration === void 0 ? void 0 : xcBuildConfiguration.buildSettings) !== null && _a !== void 0 ? _a : {};
82
87
  }
@@ -1,11 +1,12 @@
1
1
  import { ExpoConfig } from '@expo/config';
2
- import { IosBuildProfile } from '@expo/eas-json';
2
+ import { Platform } from '@expo/eas-build-job';
3
+ import { BuildProfile } from '@expo/eas-json';
3
4
  import type { XCBuildConfiguration } from 'xcode';
4
5
  import { ConfigureContext } from '../context';
5
6
  export declare function configureIosAsync(ctx: ConfigureContext): Promise<void>;
6
7
  export declare function validateAndSyncProjectConfigurationAsync({ projectDir, exp, buildProfile, buildSettings, }: {
7
8
  projectDir: string;
8
9
  exp: ExpoConfig;
9
- buildProfile: IosBuildProfile;
10
+ buildProfile: BuildProfile<Platform.IOS>;
10
11
  buildSettings: XCBuildConfiguration['buildSettings'];
11
12
  }): Promise<void>;
@@ -23,4 +23,4 @@ export declare function maybeResolveVersionsAsync(projectDir: string, exp: ExpoC
23
23
  appBuildVersion?: string;
24
24
  }>;
25
25
  export declare function getInfoPlistPath(projectDir: string, buildSettings: XCBuildConfiguration['buildSettings']): string;
26
- export declare function evaluateTemplateString(s: string, vars: Record<string, any>): string;
26
+ export declare function evaluateTemplateString(s: string, buildSettings: XCBuildConfiguration['buildSettings']): string;
@@ -98,6 +98,7 @@ async function maybeResolveVersionsAsync(projectDir, exp, buildSettings) {
98
98
  }
99
99
  catch (err) {
100
100
  log_1.default.warn('Failed to read app versions.');
101
+ log_1.default.debug(err);
101
102
  log_1.default.warn(err.message);
102
103
  log_1.default.warn('Proceeding anyway...');
103
104
  return {};
@@ -142,7 +143,9 @@ function ensureStaticConfigExists(projectDir) {
142
143
  throw new Error('autoIncrement option is not supported when using app.config.js');
143
144
  }
144
145
  }
145
- function evaluateTemplateString(s, vars) {
146
+ function evaluateTemplateString(s, buildSettings) {
147
+ // necessary because XCBuildConfiguration['buildSettings'] is not a plain object
148
+ const vars = { ...buildSettings };
146
149
  return s.replace(/\$\((\w+)\)/g, (match, key) => {
147
150
  if (vars.hasOwnProperty(key)) {
148
151
  const value = String(vars[key]);
@@ -3,16 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runLocalBuildAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const spawn_async_1 = (0, tslib_1.__importDefault)(require("@expo/spawn-async"));
6
+ const semver_1 = (0, tslib_1.__importDefault)(require("semver"));
6
7
  const PLUGIN_PACKAGE_NAME = 'eas-cli-local-build-plugin';
7
8
  const PLUGIN_PACKAGE_VERSION = '0.0.50';
8
9
  async function runLocalBuildAsync(job) {
9
- const { command, args } = getCommandAndArgs(job);
10
+ const { command, args } = await getCommandAndArgsAsync(job);
10
11
  await (0, spawn_async_1.default)(command, args, {
11
12
  stdio: 'inherit',
12
13
  });
13
14
  }
14
15
  exports.runLocalBuildAsync = runLocalBuildAsync;
15
- function getCommandAndArgs(job) {
16
+ async function getCommandAndArgsAsync(job) {
16
17
  const jobBase64 = Buffer.from(JSON.stringify({ job })).toString('base64');
17
18
  if (process.env.EAS_LOCAL_BUILD_PLUGIN_PATH) {
18
19
  return {
@@ -21,9 +22,19 @@ function getCommandAndArgs(job) {
21
22
  };
22
23
  }
23
24
  else {
25
+ const args = [`${PLUGIN_PACKAGE_NAME}@${PLUGIN_PACKAGE_VERSION}`, jobBase64];
26
+ if (await isAtLeastNpm7Async()) {
27
+ // npx shipped with npm >= 7.0.0 requires the "-y" flag to run commands without
28
+ // prompting the user to install a package that is used for the first time
29
+ args.unshift('-y');
30
+ }
24
31
  return {
25
32
  command: 'npx',
26
- args: ['-y', `${PLUGIN_PACKAGE_NAME}@${PLUGIN_PACKAGE_VERSION}`, jobBase64],
33
+ args,
27
34
  };
28
35
  }
29
36
  }
37
+ async function isAtLeastNpm7Async() {
38
+ const version = (await (0, spawn_async_1.default)('npm', ['--version'])).stdout.trim();
39
+ return semver_1.default.gte(version, '7.0.0');
40
+ }
@@ -1,14 +1,3 @@
1
1
  import { Metadata, Platform } from '@expo/eas-build-job';
2
- import type { XCBuildConfiguration } from 'xcode';
3
- import { GradleBuildContext } from '../project/android/gradle';
4
2
  import { BuildContext } from './context';
5
- export declare type MetadataContext<T extends Platform> = T extends Platform.ANDROID ? AndroidMetadataContext : IosMetadataContext;
6
- export interface AndroidMetadataContext {
7
- gradleContext?: GradleBuildContext;
8
- }
9
- export interface IosMetadataContext {
10
- buildSettings: XCBuildConfiguration['buildSettings'];
11
- targetName?: string;
12
- buildConfiguration?: string;
13
- }
14
- export declare function collectMetadataAsync<T extends Platform>(ctx: BuildContext<T>, platformContext: MetadataContext<T>): Promise<Metadata>;
3
+ export declare function collectMetadataAsync<T extends Platform>(ctx: BuildContext<T>): Promise<Metadata>;
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.collectMetadataAsync = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const config_plugins_1 = require("@expo/config-plugins");
4
6
  const eas_build_job_1 = require("@expo/eas-build-job");
5
- const applicationId_1 = require("../project/android/applicationId");
6
- const bundleIdentifier_1 = require("../project/ios/bundleIdentifier");
7
+ const log_1 = (0, tslib_1.__importDefault)(require("../log"));
7
8
  const projectUtils_1 = require("../project/projectUtils");
8
9
  const actions_1 = require("../user/actions");
9
10
  const easCli_1 = require("../utils/easCli");
@@ -13,24 +14,34 @@ const version_1 = require("./android/version");
13
14
  const UpdatesModule_2 = require("./ios/UpdatesModule");
14
15
  const version_2 = require("./ios/version");
15
16
  const updates_1 = require("./utils/updates");
16
- async function collectMetadataAsync(ctx, platformContext) {
17
- var _a;
17
+ // TODO(JJ): Replace this with the getRuntimeVersionNullable function in @expo/config-plugins
18
+ function getRuntimeVersionNullable(...[config, platform]) {
19
+ try {
20
+ return config_plugins_1.Updates.getRuntimeVersion(config, platform);
21
+ }
22
+ catch (e) {
23
+ log_1.default.debug(e);
24
+ return null;
25
+ }
26
+ }
27
+ async function collectMetadataAsync(ctx) {
28
+ var _a, _b;
18
29
  const channelOrReleaseChannel = await resolveChannelOrReleaseChannelAsync(ctx);
19
30
  const distribution = (_a = ('simulator' in ctx.buildProfile && ctx.buildProfile.simulator
20
31
  ? 'simulator'
21
32
  : ctx.buildProfile.distribution)) !== null && _a !== void 0 ? _a : 'store';
22
33
  const metadata = {
23
34
  trackingContext: ctx.trackingCtx,
24
- ...(await maybeResolveVersionsAsync(ctx, platformContext)),
35
+ ...(await maybeResolveVersionsAsync(ctx)),
25
36
  cliVersion: easCli_1.easCliVersion,
26
37
  workflow: ctx.workflow,
27
38
  credentialsSource: ctx.buildProfile.credentialsSource,
28
39
  sdkVersion: ctx.exp.sdkVersion,
29
- runtimeVersion: ctx.exp.runtimeVersion,
40
+ runtimeVersion: (_b = getRuntimeVersionNullable(ctx.exp, ctx.platform)) !== null && _b !== void 0 ? _b : undefined,
30
41
  ...channelOrReleaseChannel,
31
42
  distribution,
32
43
  appName: ctx.exp.name,
33
- appIdentifier: await resolveAppIdentifierAsync(ctx, platformContext),
44
+ appIdentifier: resolveAppIdentifier(ctx),
34
45
  buildProfile: ctx.buildProfileName,
35
46
  gitCommitHash: await (0, vcs_1.getVcsClient)().getCommitHashAsync(),
36
47
  isGitWorkingTreeDirty: await (0, vcs_1.getVcsClient)().hasUncommittedChangesAsync(),
@@ -42,11 +53,10 @@ async function collectMetadataAsync(ctx, platformContext) {
42
53
  return (0, eas_build_job_1.sanitizeMetadata)(metadata);
43
54
  }
44
55
  exports.collectMetadataAsync = collectMetadataAsync;
45
- async function maybeResolveVersionsAsync(ctx, platformContext) {
46
- var _a;
56
+ async function maybeResolveVersionsAsync(ctx) {
47
57
  if (ctx.platform === eas_build_job_1.Platform.IOS) {
48
- const iosContext = platformContext;
49
- return await (0, version_2.maybeResolveVersionsAsync)(ctx.projectDir, ctx.exp, (_a = iosContext === null || iosContext === void 0 ? void 0 : iosContext.buildSettings) !== null && _a !== void 0 ? _a : {});
58
+ const iosContext = ctx;
59
+ return await (0, version_2.maybeResolveVersionsAsync)(ctx.projectDir, ctx.exp, iosContext.ios.applicationTargetBuildSettings);
50
60
  }
51
61
  else if (ctx.platform === eas_build_job_1.Platform.ANDROID) {
52
62
  const androidCtx = ctx;
@@ -56,17 +66,12 @@ async function maybeResolveVersionsAsync(ctx, platformContext) {
56
66
  throw new Error(`Unsupported platform ${ctx.platform}`);
57
67
  }
58
68
  }
59
- async function resolveAppIdentifierAsync(ctx, platformContext) {
69
+ function resolveAppIdentifier(ctx) {
60
70
  if (ctx.platform === eas_build_job_1.Platform.IOS) {
61
- const iosContext = platformContext;
62
- return await (0, bundleIdentifier_1.getBundleIdentifierAsync)(ctx.projectDir, ctx.exp, {
63
- targetName: iosContext.targetName,
64
- buildConfiguration: iosContext.buildConfiguration,
65
- });
71
+ return ctx.ios.bundleIdentifier;
66
72
  }
67
73
  else {
68
- const androidContext = platformContext;
69
- return await (0, applicationId_1.getApplicationIdAsync)(ctx.projectDir, ctx.exp, androidContext.gradleContext);
74
+ return ctx.android.applicationId;
70
75
  }
71
76
  }
72
77
  async function resolveChannelOrReleaseChannelAsync(ctx) {
@@ -1,4 +1,4 @@
1
1
  import { Platform } from '@expo/eas-build-job';
2
- import { BuildContext } from './context';
3
- export declare function checkNodeEnvVariable(ctx: BuildContext<Platform>): void;
4
- export declare function checkGoogleServicesFileAsync<T extends Platform>(ctx: BuildContext<T>): Promise<void>;
2
+ import { CommonContext } from './context';
3
+ export declare function checkNodeEnvVariable(ctx: CommonContext<Platform>): void;
4
+ export declare function checkGoogleServicesFileAsync<T extends Platform>(ctx: CommonContext<T>): Promise<void>;
@@ -5,7 +5,6 @@ const eas_json_1 = require("@expo/eas-json");
5
5
  const command_1 = require("@oclif/command");
6
6
  const semver_1 = (0, tslib_1.__importDefault)(require("semver"));
7
7
  const rudderstackClient_1 = require("../analytics/rudderstackClient");
8
- const log_1 = (0, tslib_1.__importDefault)(require("../log"));
9
8
  const projectUtils_1 = require("../project/projectUtils");
10
9
  const User_1 = require("../user/User");
11
10
  const actions_1 = require("../user/actions");
@@ -24,7 +23,6 @@ class EasCommand extends command_1.Command {
24
23
  // eslint-disable-next-line async-protect/async-suffix
25
24
  async run() {
26
25
  var _a;
27
- eas_json_1.EasJsonReader.setLog(log_1.default);
28
26
  await (0, rudderstackClient_1.initAsync)();
29
27
  await this.applyCliConfigAsync();
30
28
  if (this.requiresAuthentication) {
@@ -24,6 +24,7 @@ const uniqBy_1 = (0, tslib_1.__importDefault)(require("../../utils/expodash/uniq
24
24
  const formatFields_1 = (0, tslib_1.__importDefault)(require("../../utils/formatFields"));
25
25
  const vcs_1 = require("../../vcs");
26
26
  const create_1 = require("../channel/create");
27
+ const configure_1 = require("../update/configure");
27
28
  const create_2 = require("./create");
28
29
  const list_1 = require("./list");
29
30
  const view_1 = require("./view");
@@ -95,6 +96,7 @@ class BranchPublish extends EasCommand_1.default {
95
96
  });
96
97
  const runtimeVersions = await getRuntimeVersionObjectAsync(exp, platformFlag, projectDir);
97
98
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
99
+ await checkEASUpdateURLIsSetAsync(exp);
98
100
  if (!branchName && autoFlag) {
99
101
  branchName =
100
102
  (await (0, vcs_1.getVcsClient)().getBranchNameAsync()) ||
@@ -352,3 +354,11 @@ function formatUpdateTitle(update) {
352
354
  }
353
355
  return `[${(0, dateformat_1.default)(createdAt, 'mmm dd HH:MM')} by ${actorName}, runtimeVersion: ${runtimeVersion}] ${message}`;
354
356
  }
357
+ async function checkEASUpdateURLIsSetAsync(exp) {
358
+ var _a;
359
+ const configuredURL = (_a = exp.updates) === null || _a === void 0 ? void 0 : _a.url;
360
+ const expectedURL = await (0, configure_1.getEASUpdateURLAsync)(exp);
361
+ if (configuredURL !== expectedURL) {
362
+ throw new Error(`The update URL is incorrectly configured for EAS Update. Please set updates.url to ${expectedURL} in your app.json.`);
363
+ }
364
+ }
@@ -9,12 +9,14 @@ const log_1 = (0, tslib_1.__importStar)(require("../../log"));
9
9
  const platform_1 = require("../../platform");
10
10
  const projectUtils_1 = require("../../project/projectUtils");
11
11
  const prompts_1 = require("../../prompts");
12
+ const vcs_1 = require("../../vcs");
12
13
  class BuildConfigure extends EasCommand_1.default {
13
14
  async runAsync() {
14
15
  var _a;
15
16
  const { flags } = this.parse(BuildConfigure);
16
17
  log_1.default.log('💡 The following process will configure your iOS and/or Android project to be compatible with EAS Build. These changes only apply to your local project files and you can safely revert them at any time.');
17
18
  log_1.default.newLine();
19
+ await (0, vcs_1.getVcsClient)().ensureRepoExistsAsync();
18
20
  const platform = (_a = flags.platform) !== null && _a !== void 0 ? _a : (await promptForPlatformAsync());
19
21
  await (0, configure_1.configureAsync)({
20
22
  platform,
@@ -13,7 +13,7 @@ const nullthrows_1 = (0, tslib_1.__importDefault)(require("nullthrows"));
13
13
  const build_1 = require("../../build/android/build");
14
14
  const build_2 = require("../../build/build");
15
15
  const configure_1 = require("../../build/configure");
16
- const context_1 = require("../../build/context");
16
+ const createContext_1 = require("../../build/createContext");
17
17
  const build_3 = require("../../build/ios/build");
18
18
  const devClient_1 = require("../../build/utils/devClient");
19
19
  const printBuildInfo_1 = require("../../build/utils/printBuildInfo");
@@ -26,7 +26,7 @@ const platform_1 = require("../../platform");
26
26
  const metroConfig_1 = require("../../project/metroConfig");
27
27
  const projectUtils_1 = require("../../project/projectUtils");
28
28
  const prompts_1 = require("../../prompts");
29
- const context_2 = require("../../submit/context");
29
+ const context_1 = require("../../submit/context");
30
30
  const submit_1 = require("../../submit/submit");
31
31
  const urls_1 = require("../../submit/utils/urls");
32
32
  const easCli_1 = require("../../utils/easCli");
@@ -57,7 +57,7 @@ class Build extends EasCommand_1.default {
57
57
  type: 'build',
58
58
  projectDir,
59
59
  platforms,
60
- profileName: flags.profile,
60
+ profileName: (_a = flags.profile) !== null && _a !== void 0 ? _a : undefined,
61
61
  });
62
62
  await (0, devClient_1.ensureExpoDevClientInstalledForDevClientBuildsAsync)({
63
63
  projectDir,
@@ -86,14 +86,22 @@ class Build extends EasCommand_1.default {
86
86
  log_1.default.newLine();
87
87
  const submissions = [];
88
88
  if (flags.autoSubmit) {
89
+ const submitProfiles = await (0, profiles_1.getProfilesAsync)({
90
+ projectDir,
91
+ platforms,
92
+ profileName: flags.submitProfile,
93
+ type: 'submit',
94
+ });
89
95
  for (const startedBuild of startedBuilds) {
96
+ const submitProfile = (0, nullthrows_1.default)(submitProfiles.find(({ platform }) => (0, AppPlatform_1.toAppPlatform)(platform) === startedBuild.build.platform)).profile;
90
97
  const submission = await this.prepareAndStartSubmissionAsync({
91
98
  build: startedBuild.build,
92
- credentialsCtx: (0, nullthrows_1.default)((_a = buildCtxByPlatform[startedBuild.build.platform]) === null || _a === void 0 ? void 0 : _a.credentialsCtx),
93
- flags,
99
+ buildCtx: (0, nullthrows_1.default)(buildCtxByPlatform[startedBuild.build.platform]),
94
100
  moreBuilds: startedBuilds.length > 1,
95
101
  projectDir,
96
- buildProfile: startedBuild.buildProfile,
102
+ buildProfile: startedBuild.buildProfile.profile,
103
+ submitProfile,
104
+ nonInteractive: flags.nonInteractive,
97
105
  });
98
106
  submissions.push(submission);
99
107
  }
@@ -145,7 +153,7 @@ class Build extends EasCommand_1.default {
145
153
  return {
146
154
  requestedPlatform,
147
155
  skipProjectConfiguration: flags['skip-project-configuration'],
148
- profile: profile !== null && profile !== void 0 ? profile : null,
156
+ profile,
149
157
  nonInteractive,
150
158
  local: flags['local'],
151
159
  wait: flags['wait'],
@@ -156,7 +164,7 @@ class Build extends EasCommand_1.default {
156
164
  };
157
165
  }
158
166
  async prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildProfile, }) {
159
- const buildCtx = await (0, context_1.createBuildContextAsync)({
167
+ const buildCtx = await (0, createContext_1.createBuildContextAsync)({
160
168
  buildProfileName: buildProfile.profileName,
161
169
  clearCache: flags.clearCache,
162
170
  buildProfile: buildProfile.profile,
@@ -191,19 +199,19 @@ class Build extends EasCommand_1.default {
191
199
  }
192
200
  return await sendBuildRequestAsync();
193
201
  }
194
- async prepareAndStartSubmissionAsync({ build, credentialsCtx, flags, moreBuilds, projectDir, buildProfile, }) {
195
- const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
202
+ async prepareAndStartSubmissionAsync({ build, buildCtx, moreBuilds, projectDir, buildProfile, submitProfile, nonInteractive, }) {
203
+ var _a, _b, _c;
196
204
  const platform = (0, AppPlatform_1.toPlatform)(build.platform);
197
- const submitProfile = await easJsonReader.readSubmitProfileAsync(platform, flags.submitProfile);
198
- const submissionCtx = await (0, context_2.createSubmissionContextAsync)({
205
+ const submissionCtx = await (0, context_1.createSubmissionContextAsync)({
199
206
  platform,
200
207
  projectDir,
201
208
  projectId: build.project.id,
202
209
  profile: submitProfile,
203
210
  archiveFlags: { id: build.id },
204
- nonInteractive: flags.nonInteractive,
205
- env: buildProfile.profile.env,
206
- credentialsCtx,
211
+ nonInteractive,
212
+ env: buildProfile.env,
213
+ credentialsCtx: buildCtx.credentialsCtx,
214
+ applicationIdentifier: (_b = (_a = buildCtx.android) === null || _a === void 0 ? void 0 : _a.applicationId) !== null && _b !== void 0 ? _b : (_c = buildCtx.ios) === null || _c === void 0 ? void 0 : _c.bundleIdentifier,
207
215
  });
208
216
  if (moreBuilds) {
209
217
  log_1.default.newLine();
@@ -275,7 +283,7 @@ async function handleDeprecatedEasJsonAsync(projectDir, nonInteractive) {
275
283
  return;
276
284
  }
277
285
  const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
278
- const rawEasJson = await easJsonReader.readRawAsync();
286
+ const rawEasJson = await easJsonReader.readAsync();
279
287
  if (rawEasJson === null || rawEasJson === void 0 ? void 0 : rawEasJson.cli) {
280
288
  return;
281
289
  }
@@ -36,7 +36,7 @@ class Config extends EasCommand_1.default {
36
36
  value: eas_build_job_1.Platform.IOS,
37
37
  },
38
38
  ]));
39
- const profile = await reader.readBuildProfileAsync(platform, profileName);
39
+ const profile = await reader.getBuildProfileAsync(platform, profileName);
40
40
  const config = (0, expoConfig_1.getExpoConfig)(projectDir, { env: profile.env, isPublicConfig: true });
41
41
  log_1.default.log((0, config_1.getProjectConfigDescription)(projectDir));
42
42
  log_1.default.newLine();
@@ -0,0 +1,7 @@
1
+ import { ExpoConfig } from '@expo/config';
2
+ import EasCommand from '../../commandUtils/EasCommand';
3
+ export declare function getEASUpdateURLAsync(exp: ExpoConfig): Promise<string>;
4
+ export default class UpdateConfigure extends EasCommand {
5
+ static description: string;
6
+ runAsync(): Promise<void>;
7
+ }