eas-cli 0.36.0 → 0.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) 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/build.d.ts +0 -2
  5. package/build/build/build.js +1 -2
  6. package/build/build/configure.js +0 -1
  7. package/build/build/context.d.ts +18 -10
  8. package/build/build/context.js +0 -96
  9. package/build/build/createContext.d.ts +13 -0
  10. package/build/build/createContext.js +114 -0
  11. package/build/build/ios/UpdatesModule.js +3 -2
  12. package/build/build/ios/build.d.ts +2 -1
  13. package/build/build/ios/build.js +24 -19
  14. package/build/build/ios/version.js +7 -3
  15. package/build/build/local.js +15 -4
  16. package/build/build/metadata.d.ts +1 -12
  17. package/build/build/metadata.js +24 -19
  18. package/build/build/utils/devClient.d.ts +1 -2
  19. package/build/build/utils/repository.js +1 -0
  20. package/build/build/validate.d.ts +3 -3
  21. package/build/commands/branch/publish.js +24 -2
  22. package/build/commands/build/configure.js +2 -0
  23. package/build/commands/build/index.js +11 -16
  24. package/build/commands/channel/create.d.ts +6 -0
  25. package/build/commands/channel/create.js +2 -0
  26. package/build/commands/secret/create.js +0 -6
  27. package/build/commands/secret/delete.js +0 -6
  28. package/build/commands/secret/list.js +0 -6
  29. package/build/commands/submit.js +2 -11
  30. package/build/commands/webhook/create.js +1 -2
  31. package/build/commands/webhook/list.js +1 -1
  32. package/build/commands/webhook/update.js +1 -2
  33. package/build/credentials/ios/appstore/bundleIdCapabilities.js +11 -1
  34. package/build/credentials/ios/appstore/entitlements.js +9 -12
  35. package/build/graphql/generated.d.ts +2 -1
  36. package/build/graphql/generated.js +1 -0
  37. package/build/project/android/applicationId.d.ts +6 -0
  38. package/build/project/android/applicationId.js +39 -29
  39. package/build/project/android/gradle.js +3 -2
  40. package/build/project/android/gradleUtils.d.ts +1 -0
  41. package/build/project/ios/bundleIdentifier.d.ts +6 -1
  42. package/build/project/ios/bundleIdentifier.js +29 -18
  43. package/build/submit/android/AndroidSubmitCommand.d.ts +1 -2
  44. package/build/submit/android/AndroidSubmitCommand.js +23 -35
  45. package/build/submit/android/AndroidSubmitter.d.ts +0 -2
  46. package/build/submit/android/AndroidSubmitter.js +1 -3
  47. package/build/submit/android/ServiceAccountSource.d.ts +3 -2
  48. package/build/submit/android/ServiceAccountSource.js +16 -4
  49. package/build/submit/context.d.ts +2 -0
  50. package/build/submit/context.js +2 -1
  51. package/build/submit/ios/CredentialsServiceSource.d.ts +6 -3
  52. package/build/submit/ios/CredentialsServiceSource.js +13 -2
  53. package/build/submit/ios/IosSubmitCommand.d.ts +2 -1
  54. package/build/submit/ios/IosSubmitCommand.js +47 -17
  55. package/build/submit/ios/IosSubmitter.js +1 -1
  56. package/build/{build/ios → utils}/plist.d.ts +1 -1
  57. package/build/{build/ios → utils}/plist.js +8 -2
  58. package/build/utils/profiles.d.ts +9 -4
  59. package/build/utils/profiles.js +14 -7
  60. package/build/vcs/clients/git.d.ts +2 -1
  61. package/build/vcs/clients/git.js +87 -6
  62. package/build/vcs/vcs.d.ts +4 -3
  63. package/build/vcs/vcs.js +3 -3
  64. package/build/webhooks/input.d.ts +2 -2
  65. package/build/webhooks/input.js +19 -2
  66. package/oclif.manifest.json +1 -1
  67. package/package.json +13 -14
  68. package/build/project/isEasEnabledForProject.d.ts +0 -8
  69. package/build/project/isEasEnabledForProject.js +0 -33
  70. package/build/submit/android/AndroidPackageSource.d.ts +0 -17
  71. package/build/submit/android/AndroidPackageSource.js +0 -27
@@ -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
  }
@@ -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,10 @@ 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.warn(err.message);
102
+ log_1.default.warn('Proceeding anyway...');
100
103
  return {};
101
104
  }
102
105
  }
@@ -125,8 +128,9 @@ function getInfoPlistPath(projectDir, buildSettings) {
125
128
  }
126
129
  exports.getInfoPlistPath = getInfoPlistPath;
127
130
  async function readInfoPlistAsync(projectDir, buildSettings) {
131
+ var _a;
128
132
  const infoPlistPath = getInfoPlistPath(projectDir, buildSettings);
129
- return (await (0, plist_1.readPlistAsync)(infoPlistPath));
133
+ return ((_a = (await (0, plist_1.readPlistAsync)(infoPlistPath))) !== null && _a !== void 0 ? _a : {});
130
134
  }
131
135
  async function writeInfoPlistAsync({ projectDir, infoPlist, buildSettings, }) {
132
136
  const infoPlistPath = getInfoPlistPath(projectDir, buildSettings);
@@ -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.47';
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>;
@@ -23,7 +23,8 @@ 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");
29
30
  exports.defaultPublishPlatforms = ['android', 'ios'];
@@ -46,6 +47,24 @@ async function getUpdateGroupAsync({ group, }) {
46
47
  .toPromise());
47
48
  return updatesByGroup;
48
49
  }
50
+ async function ensureChannelExistsAsync({ appId, branchId, channelName, }) {
51
+ var _a;
52
+ try {
53
+ await (0, create_1.createUpdateChannelOnAppAsync)({
54
+ appId,
55
+ channelName,
56
+ branchId,
57
+ });
58
+ log_1.default.withTick(`Created a channel: ${chalk_1.default.bold(channelName)} pointed at branch: ${chalk_1.default.bold(channelName)}.`);
59
+ }
60
+ catch (e) {
61
+ const isIgnorableError = ((_a = e.graphQLErrors) === null || _a === void 0 ? void 0 : _a.length) === 1 &&
62
+ e.graphQLErrors[0].extensions.errorCode === 'CHANNEL_ALREADY_EXISTS';
63
+ if (!isIgnorableError) {
64
+ throw e;
65
+ }
66
+ }
67
+ }
49
68
  async function ensureBranchExistsAsync({ appId, name: branchName, }) {
50
69
  const { app } = await (0, view_1.viewUpdateBranchAsync)({
51
70
  appId,
@@ -54,9 +73,12 @@ async function ensureBranchExistsAsync({ appId, name: branchName, }) {
54
73
  const updateBranch = app === null || app === void 0 ? void 0 : app.byId.updateBranchByName;
55
74
  if (updateBranch) {
56
75
  const { id, updates } = updateBranch;
76
+ await ensureChannelExistsAsync({ appId, branchId: id, channelName: branchName });
57
77
  return { id, updates };
58
78
  }
59
- const newUpdateBranch = await (0, create_1.createUpdateBranchOnAppAsync)({ appId, name: branchName });
79
+ const newUpdateBranch = await (0, create_2.createUpdateBranchOnAppAsync)({ appId, name: branchName });
80
+ log_1.default.withTick(`Created branch: ${chalk_1.default.bold(branchName)}`);
81
+ await ensureChannelExistsAsync({ appId, branchId: newUpdateBranch.id, channelName: branchName });
60
82
  return { id: newUpdateBranch.id, updates: [] };
61
83
  }
62
84
  class BranchPublish extends EasCommand_1.default {
@@ -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");
@@ -23,11 +23,10 @@ const generated_1 = require("../../graphql/generated");
23
23
  const AppPlatform_1 = require("../../graphql/types/AppPlatform");
24
24
  const log_1 = (0, tslib_1.__importStar)(require("../../log"));
25
25
  const platform_1 = require("../../platform");
26
- const isEasEnabledForProject_1 = require("../../project/isEasEnabledForProject");
27
26
  const metroConfig_1 = require("../../project/metroConfig");
28
27
  const projectUtils_1 = require("../../project/projectUtils");
29
28
  const prompts_1 = require("../../prompts");
30
- const context_2 = require("../../submit/context");
29
+ const context_1 = require("../../submit/context");
31
30
  const submit_1 = require("../../submit/submit");
32
31
  const urls_1 = require("../../submit/utils/urls");
33
32
  const easCli_1 = require("../../utils/easCli");
@@ -41,7 +40,6 @@ class Build extends EasCommand_1.default {
41
40
  this.metroConfigValidated = false;
42
41
  }
43
42
  async runAsync() {
44
- var _a;
45
43
  const { flags: rawFlags } = this.parse(Build);
46
44
  if (rawFlags.json) {
47
45
  (0, json_1.enableJsonOutput)();
@@ -54,13 +52,11 @@ class Build extends EasCommand_1.default {
54
52
  await (0, repository_1.ensureRepoIsCleanAsync)(flags.nonInteractive);
55
53
  await (0, configure_1.ensureProjectConfiguredAsync)(projectDir, requestedPlatform);
56
54
  const platforms = (0, platform_1.toPlatforms)(requestedPlatform);
57
- const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
58
55
  const buildProfiles = await (0, profiles_1.getProfilesAsync)({
56
+ type: 'build',
57
+ projectDir,
59
58
  platforms,
60
59
  profileName: flags.profile,
61
- async readProfileAsync(platform, profileName) {
62
- return await easJsonReader.readBuildProfileAsync(platform, profileName);
63
- },
64
60
  });
65
61
  await (0, devClient_1.ensureExpoDevClientInstalledForDevClientBuildsAsync)({
66
62
  projectDir,
@@ -92,7 +88,7 @@ class Build extends EasCommand_1.default {
92
88
  for (const startedBuild of startedBuilds) {
93
89
  const submission = await this.prepareAndStartSubmissionAsync({
94
90
  build: startedBuild.build,
95
- credentialsCtx: (0, nullthrows_1.default)((_a = buildCtxByPlatform[startedBuild.build.platform]) === null || _a === void 0 ? void 0 : _a.credentialsCtx),
91
+ buildCtx: (0, nullthrows_1.default)(buildCtxByPlatform[startedBuild.build.platform]),
96
92
  flags,
97
93
  moreBuilds: startedBuilds.length > 1,
98
94
  projectDir,
@@ -159,7 +155,7 @@ class Build extends EasCommand_1.default {
159
155
  };
160
156
  }
161
157
  async prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildProfile, }) {
162
- const buildCtx = await (0, context_1.createBuildContextAsync)({
158
+ const buildCtx = await (0, createContext_1.createBuildContextAsync)({
163
159
  buildProfileName: buildProfile.profileName,
164
160
  clearCache: flags.clearCache,
165
161
  buildProfile: buildProfile.profile,
@@ -178,9 +174,6 @@ class Build extends EasCommand_1.default {
178
174
  await (0, metroConfig_1.validateMetroConfigForManagedWorkflowAsync)(buildCtx);
179
175
  this.metroConfigValidated = true;
180
176
  }
181
- if (!buildCtx.local && !(await (0, isEasEnabledForProject_1.isEasEnabledForProjectAsync)(buildCtx.projectId))) {
182
- (0, errors_1.error)(isEasEnabledForProject_1.EAS_UNAVAILABLE_MESSAGE, { exit: 1 });
183
- }
184
177
  const build = await this.startBuildAsync(buildCtx);
185
178
  return {
186
179
  build,
@@ -197,11 +190,12 @@ class Build extends EasCommand_1.default {
197
190
  }
198
191
  return await sendBuildRequestAsync();
199
192
  }
200
- async prepareAndStartSubmissionAsync({ build, credentialsCtx, flags, moreBuilds, projectDir, buildProfile, }) {
193
+ async prepareAndStartSubmissionAsync({ build, buildCtx, flags, moreBuilds, projectDir, buildProfile, }) {
194
+ var _a, _b, _c;
201
195
  const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
202
196
  const platform = (0, AppPlatform_1.toPlatform)(build.platform);
203
197
  const submitProfile = await easJsonReader.readSubmitProfileAsync(platform, flags.submitProfile);
204
- const submissionCtx = await (0, context_2.createSubmissionContextAsync)({
198
+ const submissionCtx = await (0, context_1.createSubmissionContextAsync)({
205
199
  platform,
206
200
  projectDir,
207
201
  projectId: build.project.id,
@@ -209,7 +203,8 @@ class Build extends EasCommand_1.default {
209
203
  archiveFlags: { id: build.id },
210
204
  nonInteractive: flags.nonInteractive,
211
205
  env: buildProfile.profile.env,
212
- credentialsCtx,
206
+ credentialsCtx: buildCtx.credentialsCtx,
207
+ 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,
213
208
  });
214
209
  if (moreBuilds) {
215
210
  log_1.default.newLine();
@@ -1,4 +1,10 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
+ import { CreateUpdateChannelOnAppMutation } from '../../graphql/generated';
3
+ export declare function createUpdateChannelOnAppAsync({ appId, channelName, branchId, }: {
4
+ appId: string;
5
+ channelName: string;
6
+ branchId: string;
7
+ }): Promise<CreateUpdateChannelOnAppMutation>;
2
8
  export default class ChannelCreate extends EasCommand {
3
9
  static hidden: boolean;
4
10
  static description: string;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createUpdateChannelOnAppAsync = void 0;
3
4
  const tslib_1 = require("tslib");
4
5
  const config_1 = require("@expo/config");
5
6
  const command_1 = require("@oclif/command");
@@ -36,6 +37,7 @@ async function createUpdateChannelOnAppAsync({ appId, channelName, branchId, })
36
37
  })
37
38
  .toPromise());
38
39
  }
40
+ exports.createUpdateChannelOnAppAsync = createUpdateChannelOnAppAsync;
39
41
  class ChannelCreate extends EasCommand_1.default {
40
42
  async runAsync() {
41
43
  let { args: { name: channelName }, flags: { json: jsonFlag }, } = this.parse(ChannelCreate);
@@ -8,7 +8,6 @@ const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/Ea
8
8
  const EnvironmentSecretMutation_1 = require("../../graphql/mutations/EnvironmentSecretMutation");
9
9
  const EnvironmentSecretsQuery_1 = require("../../graphql/queries/EnvironmentSecretsQuery");
10
10
  const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
11
- const isEasEnabledForProject_1 = require("../../project/isEasEnabledForProject");
12
11
  const projectUtils_1 = require("../../project/projectUtils");
13
12
  const prompts_1 = require("../../prompts");
14
13
  const Account_1 = require("../../user/Account");
@@ -23,11 +22,6 @@ class EnvironmentSecretCreate extends EasCommand_1.default {
23
22
  const accountName = await (0, projectUtils_1.getProjectAccountNameAsync)(exp);
24
23
  const { slug } = exp;
25
24
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
26
- if (!(await (0, isEasEnabledForProject_1.isEasEnabledForProjectAsync)(projectId))) {
27
- (0, isEasEnabledForProject_1.warnEasUnavailable)();
28
- process.exitCode = 1;
29
- return;
30
- }
31
25
  if (!scope) {
32
26
  const validationMessage = 'Secret scope may not be empty.';
33
27
  ({ scope } = await (0, prompts_1.promptAsync)({
@@ -8,7 +8,6 @@ const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/Ea
8
8
  const EnvironmentSecretMutation_1 = require("../../graphql/mutations/EnvironmentSecretMutation");
9
9
  const EnvironmentSecretsQuery_1 = require("../../graphql/queries/EnvironmentSecretsQuery");
10
10
  const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
11
- const isEasEnabledForProject_1 = require("../../project/isEasEnabledForProject");
12
11
  const projectUtils_1 = require("../../project/projectUtils");
13
12
  const prompts_1 = require("../../prompts");
14
13
  class EnvironmentSecretDelete extends EasCommand_1.default {
@@ -17,11 +16,6 @@ class EnvironmentSecretDelete extends EasCommand_1.default {
17
16
  const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
18
17
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
19
18
  const projectAccountName = await (0, projectUtils_1.getProjectAccountNameAsync)(exp);
20
- if (!(await (0, isEasEnabledForProject_1.isEasEnabledForProjectAsync)(projectId))) {
21
- (0, isEasEnabledForProject_1.warnEasUnavailable)();
22
- process.exitCode = 1;
23
- return;
24
- }
25
19
  let { flags: { id }, } = this.parse(EnvironmentSecretDelete);
26
20
  let secret;
27
21
  if (!id) {
@@ -8,7 +8,6 @@ const dateformat_1 = (0, tslib_1.__importDefault)(require("dateformat"));
8
8
  const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
9
9
  const EnvironmentSecretsQuery_1 = require("../../graphql/queries/EnvironmentSecretsQuery");
10
10
  const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
11
- const isEasEnabledForProject_1 = require("../../project/isEasEnabledForProject");
12
11
  const projectUtils_1 = require("../../project/projectUtils");
13
12
  class EnvironmentSecretList extends EasCommand_1.default {
14
13
  async runAsync() {
@@ -16,11 +15,6 @@ class EnvironmentSecretList extends EasCommand_1.default {
16
15
  const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
17
16
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
18
17
  const projectAccountName = await (0, projectUtils_1.getProjectAccountNameAsync)(exp);
19
- if (!(await (0, isEasEnabledForProject_1.isEasEnabledForProjectAsync)(projectId))) {
20
- (0, isEasEnabledForProject_1.warnEasUnavailable)();
21
- process.exitCode = 1;
22
- return;
23
- }
24
18
  if (!projectDir) {
25
19
  throw new Error("Please run this command inside your project's directory");
26
20
  }
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const config_1 = require("@expo/config");
5
- const eas_json_1 = require("@expo/eas-json");
6
5
  const command_1 = require("@oclif/command");
7
6
  const errors_1 = require("@oclif/errors");
8
7
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
@@ -10,7 +9,6 @@ const EasCommand_1 = (0, tslib_1.__importDefault)(require("../commandUtils/EasCo
10
9
  const AppPlatform_1 = require("../graphql/types/AppPlatform");
11
10
  const log_1 = (0, tslib_1.__importStar)(require("../log"));
12
11
  const platform_1 = require("../platform");
13
- const isEasEnabledForProject_1 = require("../project/isEasEnabledForProject");
14
12
  const projectUtils_1 = require("../project/projectUtils");
15
13
  const context_1 = require("../submit/context");
16
14
  const submit_1 = require("../submit/submit");
@@ -23,19 +21,12 @@ class Submit extends EasCommand_1.default {
23
21
  const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
24
22
  const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
25
23
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
26
- if (!(await (0, isEasEnabledForProject_1.isEasEnabledForProjectAsync)(projectId))) {
27
- (0, isEasEnabledForProject_1.warnEasUnavailable)();
28
- process.exitCode = 1;
29
- return;
30
- }
31
24
  const platforms = (0, platform_1.toPlatforms)(flags.requestedPlatform);
32
- const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
33
25
  const submissionProfiles = await (0, profiles_1.getProfilesAsync)({
26
+ type: 'submit',
27
+ projectDir,
34
28
  platforms,
35
29
  profileName: flags.profile,
36
- async readProfileAsync(platform, profileName) {
37
- return await easJsonReader.readSubmitProfileAsync(platform, profileName);
38
- },
39
30
  });
40
31
  const submissions = [];
41
32
  for (const submissionProfile of submissionProfiles) {
@@ -32,8 +32,7 @@ WebhookCreate.description = 'Create a webhook on the current project.';
32
32
  WebhookCreate.flags = {
33
33
  event: command_1.flags.enum({
34
34
  description: 'Event type that triggers the webhook',
35
- options: [generated_1.WebhookType.Build],
36
- default: generated_1.WebhookType.Build,
35
+ options: [generated_1.WebhookType.Build, generated_1.WebhookType.Submit],
37
36
  }),
38
37
  url: command_1.flags.string({
39
38
  description: 'Webhook URL',
@@ -43,6 +43,6 @@ WebhookList.description = 'List webhooks on the current project.';
43
43
  WebhookList.flags = {
44
44
  event: command_1.flags.enum({
45
45
  description: 'Event type that triggers the webhook',
46
- options: [generated_1.WebhookType.Build],
46
+ options: [generated_1.WebhookType.Build, generated_1.WebhookType.Submit],
47
47
  }),
48
48
  };