eas-cli 0.36.1 → 0.38.2

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 (79) hide show
  1. package/README.md +37 -37
  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/UpdatesModule.js +3 -2
  13. package/build/build/ios/build.d.ts +2 -1
  14. package/build/build/ios/build.js +24 -19
  15. package/build/build/ios/configure.d.ts +3 -2
  16. package/build/build/ios/version.d.ts +1 -1
  17. package/build/build/ios/version.js +11 -4
  18. package/build/build/local.js +15 -4
  19. package/build/build/metadata.d.ts +1 -12
  20. package/build/build/metadata.js +24 -19
  21. package/build/build/utils/devClient.d.ts +1 -2
  22. package/build/build/utils/repository.js +1 -0
  23. package/build/build/validate.d.ts +3 -3
  24. package/build/commandUtils/EasCommand.js +0 -2
  25. package/build/commands/branch/publish.js +38 -2
  26. package/build/commands/build/configure.js +2 -0
  27. package/build/commands/build/index.js +26 -24
  28. package/build/commands/channel/create.d.ts +6 -0
  29. package/build/commands/channel/create.js +2 -0
  30. package/build/commands/config.js +1 -1
  31. package/build/commands/secret/create.js +0 -6
  32. package/build/commands/secret/delete.js +0 -6
  33. package/build/commands/secret/list.js +0 -6
  34. package/build/commands/submit.js +2 -11
  35. package/build/commands/webhook/create.js +1 -2
  36. package/build/commands/webhook/list.js +1 -1
  37. package/build/commands/webhook/update.js +1 -2
  38. package/build/credentials/ios/appstore/bundleIdCapabilities.js +11 -1
  39. package/build/credentials/ios/appstore/entitlements.js +9 -12
  40. package/build/credentials/manager/SelectBuildProfileFromEasJson.js +1 -1
  41. package/build/credentials/manager/SelectIosDistributionTypeGraphqlFromBuildProfile.d.ts +3 -2
  42. package/build/graphql/generated.d.ts +2 -1
  43. package/build/graphql/generated.js +1 -0
  44. package/build/project/android/applicationId.d.ts +6 -0
  45. package/build/project/android/applicationId.js +39 -29
  46. package/build/project/android/gradle.js +3 -2
  47. package/build/project/android/gradleUtils.d.ts +1 -0
  48. package/build/project/ios/bundleIdentifier.d.ts +6 -1
  49. package/build/project/ios/bundleIdentifier.js +29 -18
  50. package/build/project/ios/scheme.d.ts +3 -2
  51. package/build/submit/android/AndroidSubmitCommand.d.ts +1 -2
  52. package/build/submit/android/AndroidSubmitCommand.js +23 -35
  53. package/build/submit/android/AndroidSubmitter.d.ts +0 -2
  54. package/build/submit/android/AndroidSubmitter.js +1 -3
  55. package/build/submit/android/ServiceAccountSource.d.ts +3 -2
  56. package/build/submit/android/ServiceAccountSource.js +16 -4
  57. package/build/submit/context.d.ts +2 -0
  58. package/build/submit/context.js +2 -1
  59. package/build/submit/ios/CredentialsServiceSource.d.ts +6 -3
  60. package/build/submit/ios/CredentialsServiceSource.js +13 -2
  61. package/build/submit/ios/IosSubmitCommand.d.ts +2 -1
  62. package/build/submit/ios/IosSubmitCommand.js +47 -17
  63. package/build/submit/ios/IosSubmitter.js +1 -1
  64. package/build/{build/ios → utils}/plist.d.ts +1 -1
  65. package/build/{build/ios → utils}/plist.js +8 -2
  66. package/build/utils/profiles.d.ts +9 -5
  67. package/build/utils/profiles.js +29 -9
  68. package/build/vcs/clients/git.d.ts +2 -1
  69. package/build/vcs/clients/git.js +87 -6
  70. package/build/vcs/vcs.d.ts +4 -3
  71. package/build/vcs/vcs.js +3 -3
  72. package/build/webhooks/input.d.ts +2 -2
  73. package/build/webhooks/input.js +19 -2
  74. package/oclif.manifest.json +1 -1
  75. package/package.json +13 -14
  76. package/build/project/isEasEnabledForProject.d.ts +0 -8
  77. package/build/project/isEasEnabledForProject.js +0 -33
  78. package/build/submit/android/AndroidPackageSource.d.ts +0 -17
  79. package/build/submit/android/AndroidPackageSource.js +0 -27
@@ -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
+ }
@@ -6,9 +6,9 @@ const config_plugins_1 = require("@expo/config-plugins");
6
6
  const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
7
7
  const projectUtils_1 = require("../../project/projectUtils");
8
8
  const actions_1 = require("../../user/actions");
9
+ const plist_1 = require("../../utils/plist");
9
10
  const vcs_1 = require("../../vcs");
10
11
  const updates_1 = require("../utils/updates");
11
- const plist_1 = require("./plist");
12
12
  async function configureUpdatesAsync(projectDir, exp) {
13
13
  (0, updates_1.ensureValidVersions)(exp);
14
14
  const accountName = (0, projectUtils_1.getProjectAccountName)(exp, await (0, actions_1.ensureLoggedInAsync)());
@@ -49,8 +49,9 @@ async function ensureUpdatesConfiguredAsync(projectDir) {
49
49
  }
50
50
  }
51
51
  async function readExpoPlistAsync(projectDir) {
52
+ var _a;
52
53
  const expoPlistPath = config_plugins_1.IOSConfig.Paths.getExpoPlistPath(projectDir);
53
- return (await (0, plist_1.readPlistAsync)(expoPlistPath));
54
+ return ((_a = (await (0, plist_1.readPlistAsync)(expoPlistPath))) !== null && _a !== void 0 ? _a : {});
54
55
  }
55
56
  async function writeExpoPlistAsync(projectDir, expoPlist) {
56
57
  const expoPlistPath = config_plugins_1.IOSConfig.Paths.getExpoPlistPath(projectDir);
@@ -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;
@@ -10,9 +10,9 @@ const path_1 = (0, tslib_1.__importDefault)(require("path"));
10
10
  const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
11
11
  const workflow_1 = require("../../project/workflow");
12
12
  const prompts_1 = require("../../prompts");
13
+ const plist_1 = require("../../utils/plist");
13
14
  const appJson_1 = require("../utils/appJson");
14
15
  const version_1 = require("../utils/version");
15
- const plist_1 = require("./plist");
16
16
  var BumpStrategy;
17
17
  (function (BumpStrategy) {
18
18
  BumpStrategy[BumpStrategy["APP_VERSION"] = 0] = "APP_VERSION";
@@ -96,7 +96,11 @@ async function maybeResolveVersionsAsync(projectDir, exp, buildSettings) {
96
96
  appVersion: await readShortVersionAsync(projectDir, exp, buildSettings),
97
97
  };
98
98
  }
99
- catch {
99
+ catch (err) {
100
+ log_1.default.warn('Failed to read app versions.');
101
+ log_1.default.debug(err);
102
+ log_1.default.warn(err.message);
103
+ log_1.default.warn('Proceeding anyway...');
100
104
  return {};
101
105
  }
102
106
  }
@@ -125,8 +129,9 @@ function getInfoPlistPath(projectDir, buildSettings) {
125
129
  }
126
130
  exports.getInfoPlistPath = getInfoPlistPath;
127
131
  async function readInfoPlistAsync(projectDir, buildSettings) {
132
+ var _a;
128
133
  const infoPlistPath = getInfoPlistPath(projectDir, buildSettings);
129
- return (await (0, plist_1.readPlistAsync)(infoPlistPath));
134
+ return ((_a = (await (0, plist_1.readPlistAsync)(infoPlistPath))) !== null && _a !== void 0 ? _a : {});
130
135
  }
131
136
  async function writeInfoPlistAsync({ projectDir, infoPlist, buildSettings, }) {
132
137
  const infoPlistPath = getInfoPlistPath(projectDir, buildSettings);
@@ -138,7 +143,9 @@ function ensureStaticConfigExists(projectDir) {
138
143
  throw new Error('autoIncrement option is not supported when using app.config.js');
139
144
  }
140
145
  }
141
- function evaluateTemplateString(s, vars) {
146
+ function evaluateTemplateString(s, buildSettings) {
147
+ // necessary because XCBuildConfiguration['buildSettings'] is not a plain object
148
+ const vars = { ...buildSettings };
142
149
  return s.replace(/\$\((\w+)\)/g, (match, key) => {
143
150
  if (vars.hasOwnProperty(key)) {
144
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
- const PLUGIN_PACKAGE_VERSION = '0.0.48';
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,7 +1,6 @@
1
- import { BuildProfile } from '@expo/eas-json';
2
1
  import { ProfileData } from '../../utils/profiles';
3
2
  export declare function ensureExpoDevClientInstalledForDevClientBuildsAsync({ projectDir, nonInteractive, buildProfiles, }: {
4
3
  projectDir: string;
5
4
  nonInteractive?: boolean;
6
- buildProfiles?: ProfileData<BuildProfile>[];
5
+ buildProfiles?: ProfileData<'build'>[];
7
6
  }): Promise<void>;
@@ -113,6 +113,7 @@ async function reviewAndCommitChangesAsync(initialCommitMessage, { nonInteractiv
113
113
  await (0, vcs_1.getVcsClient)().commitAsync({
114
114
  commitMessage: initialCommitMessage,
115
115
  commitAllFiles: false,
116
+ nonInteractive,
116
117
  });
117
118
  log_1.default.withTick('Committed changes.');
118
119
  return;
@@ -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) {
@@ -23,9 +23,11 @@ const utils_1 = require("../../update/utils");
23
23
  const uniqBy_1 = (0, tslib_1.__importDefault)(require("../../utils/expodash/uniqBy"));
24
24
  const formatFields_1 = (0, tslib_1.__importDefault)(require("../../utils/formatFields"));
25
25
  const vcs_1 = require("../../vcs");
26
- const create_1 = require("./create");
26
+ const create_1 = require("../channel/create");
27
+ const create_2 = require("./create");
27
28
  const list_1 = require("./list");
28
29
  const view_1 = require("./view");
30
+ const EAS_UPDATE_URL = 'https://u.expo.dev';
29
31
  exports.defaultPublishPlatforms = ['android', 'ios'];
30
32
  async function getUpdateGroupAsync({ group, }) {
31
33
  const { updatesByGroup } = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
@@ -46,6 +48,24 @@ async function getUpdateGroupAsync({ group, }) {
46
48
  .toPromise());
47
49
  return updatesByGroup;
48
50
  }
51
+ async function ensureChannelExistsAsync({ appId, branchId, channelName, }) {
52
+ var _a;
53
+ try {
54
+ await (0, create_1.createUpdateChannelOnAppAsync)({
55
+ appId,
56
+ channelName,
57
+ branchId,
58
+ });
59
+ log_1.default.withTick(`Created a channel: ${chalk_1.default.bold(channelName)} pointed at branch: ${chalk_1.default.bold(channelName)}.`);
60
+ }
61
+ catch (e) {
62
+ const isIgnorableError = ((_a = e.graphQLErrors) === null || _a === void 0 ? void 0 : _a.length) === 1 &&
63
+ e.graphQLErrors[0].extensions.errorCode === 'CHANNEL_ALREADY_EXISTS';
64
+ if (!isIgnorableError) {
65
+ throw e;
66
+ }
67
+ }
68
+ }
49
69
  async function ensureBranchExistsAsync({ appId, name: branchName, }) {
50
70
  const { app } = await (0, view_1.viewUpdateBranchAsync)({
51
71
  appId,
@@ -54,9 +74,12 @@ async function ensureBranchExistsAsync({ appId, name: branchName, }) {
54
74
  const updateBranch = app === null || app === void 0 ? void 0 : app.byId.updateBranchByName;
55
75
  if (updateBranch) {
56
76
  const { id, updates } = updateBranch;
77
+ await ensureChannelExistsAsync({ appId, branchId: id, channelName: branchName });
57
78
  return { id, updates };
58
79
  }
59
- const newUpdateBranch = await (0, create_1.createUpdateBranchOnAppAsync)({ appId, name: branchName });
80
+ const newUpdateBranch = await (0, create_2.createUpdateBranchOnAppAsync)({ appId, name: branchName });
81
+ log_1.default.withTick(`Created branch: ${chalk_1.default.bold(branchName)}`);
82
+ await ensureChannelExistsAsync({ appId, branchId: newUpdateBranch.id, channelName: branchName });
60
83
  return { id: newUpdateBranch.id, updates: [] };
61
84
  }
62
85
  class BranchPublish extends EasCommand_1.default {
@@ -73,6 +96,7 @@ class BranchPublish extends EasCommand_1.default {
73
96
  });
74
97
  const runtimeVersions = await getRuntimeVersionObjectAsync(exp, platformFlag, projectDir);
75
98
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
99
+ await checkEASUpdateURLIsSetAsync(exp);
76
100
  if (!branchName && autoFlag) {
77
101
  branchName =
78
102
  (await (0, vcs_1.getVcsClient)().getBranchNameAsync()) ||
@@ -330,3 +354,15 @@ function formatUpdateTitle(update) {
330
354
  }
331
355
  return `[${(0, dateformat_1.default)(createdAt, 'mmm dd HH:MM')} by ${actorName}, runtimeVersion: ${runtimeVersion}] ${message}`;
332
356
  }
357
+ async function getEASUpdateURLAsync(exp) {
358
+ const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
359
+ return new URL(projectId, EAS_UPDATE_URL).href;
360
+ }
361
+ async function checkEASUpdateURLIsSetAsync(exp) {
362
+ var _a;
363
+ const configuredURL = (_a = exp.updates) === null || _a === void 0 ? void 0 : _a.url;
364
+ const expectedURL = await getEASUpdateURLAsync(exp);
365
+ if (configuredURL !== expectedURL) {
366
+ throw new Error(`The update URL is incorrectly configured for EAS Update. Please set updates.url to ${expectedURL} in your app.json.`);
367
+ }
368
+ }
@@ -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,