eas-cli 0.38.3 → 0.41.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 (78) hide show
  1. package/README.md +277 -29
  2. package/build/api.d.ts +1 -0
  3. package/build/api.js +13 -1
  4. package/build/build/build.js +3 -3
  5. package/build/build/context.d.ts +2 -1
  6. package/build/build/createContext.d.ts +3 -2
  7. package/build/build/createContext.js +3 -3
  8. package/build/build/local.d.ts +9 -1
  9. package/build/build/local.js +35 -5
  10. package/build/build/metadata.js +14 -0
  11. package/build/build/runBuildAndSubmit.d.ts +15 -0
  12. package/build/build/runBuildAndSubmit.js +173 -0
  13. package/build/commands/branch/create.d.ts +0 -1
  14. package/build/commands/branch/create.js +0 -1
  15. package/build/commands/branch/delete.d.ts +0 -1
  16. package/build/commands/branch/delete.js +1 -2
  17. package/build/commands/branch/list.d.ts +0 -1
  18. package/build/commands/branch/list.js +1 -2
  19. package/build/commands/branch/publish.d.ts +1 -18
  20. package/build/commands/branch/publish.js +2 -354
  21. package/build/commands/branch/rename.d.ts +0 -1
  22. package/build/commands/branch/rename.js +0 -1
  23. package/build/commands/branch/view.d.ts +0 -1
  24. package/build/commands/branch/view.js +0 -1
  25. package/build/commands/build/configure.js +1 -1
  26. package/build/commands/build/index.d.ts +0 -5
  27. package/build/commands/build/index.js +8 -159
  28. package/build/commands/build/inspect.d.ts +22 -0
  29. package/build/commands/build/inspect.js +129 -0
  30. package/build/commands/channel/create.d.ts +0 -1
  31. package/build/commands/channel/create.js +0 -1
  32. package/build/commands/channel/edit.d.ts +0 -1
  33. package/build/commands/channel/edit.js +1 -2
  34. package/build/commands/channel/list.d.ts +0 -1
  35. package/build/commands/channel/list.js +0 -1
  36. package/build/commands/channel/view.d.ts +0 -1
  37. package/build/commands/channel/view.js +3 -4
  38. package/build/commands/credentials.js +1 -7
  39. package/build/commands/diagnostics.d.ts +1 -0
  40. package/build/commands/diagnostics.js +20 -1
  41. package/build/commands/submit.js +1 -1
  42. package/build/commands/update/configure.d.ts +0 -2
  43. package/build/commands/update/configure.js +23 -15
  44. package/build/commands/update/delete.d.ts +0 -1
  45. package/build/commands/update/delete.js +0 -1
  46. package/build/commands/update/index.d.ts +19 -0
  47. package/build/commands/update/index.js +384 -0
  48. package/build/commands/update/view.d.ts +0 -1
  49. package/build/commands/update/view.js +0 -1
  50. package/build/credentials/context.d.ts +5 -0
  51. package/build/credentials/context.js +12 -7
  52. package/build/credentials/ios/actions/AscApiKeyUtils.js +1 -1
  53. package/build/credentials/ios/appstore/ensureAppExists.js +3 -3
  54. package/build/credentials/manager/ManageAndroid.d.ts +3 -3
  55. package/build/credentials/manager/ManageAndroid.js +21 -13
  56. package/build/credentials/manager/ManageIos.d.ts +3 -3
  57. package/build/credentials/manager/ManageIos.js +23 -13
  58. package/build/credentials/manager/SelectBuildProfileFromEasJson.d.ts +2 -3
  59. package/build/credentials/manager/SelectBuildProfileFromEasJson.js +3 -6
  60. package/build/credentials/manager/SelectPlatform.d.ts +1 -2
  61. package/build/credentials/manager/SelectPlatform.js +3 -3
  62. package/build/graphql/generated.d.ts +31 -11
  63. package/build/graphql/generated.js +6 -1
  64. package/build/graphql/types/Submission.js +1 -0
  65. package/build/project/expoSdk.d.ts +3 -0
  66. package/build/project/expoSdk.js +30 -0
  67. package/build/project/ios/target.js +32 -7
  68. package/build/prompts.d.ts +3 -3
  69. package/build/submit/context.js +0 -1
  70. package/build/submit/ios/AppProduce.js +3 -3
  71. package/build/submit/ios/IosSubmitCommand.js +7 -2
  72. package/build/submit/utils/urls.js +1 -1
  73. package/build/submit/utils/wait.js +1 -1
  74. package/build/update/utils.js +5 -5
  75. package/build/utils/profiles.d.ts +1 -1
  76. package/build/utils/profiles.js +80 -30
  77. package/oclif.manifest.json +1 -1
  78. package/package.json +7 -7
@@ -4,13 +4,43 @@ 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
6
  const semver_1 = (0, tslib_1.__importDefault)(require("semver"));
7
+ const ora_1 = require("../ora");
7
8
  const PLUGIN_PACKAGE_NAME = 'eas-cli-local-build-plugin';
8
- const PLUGIN_PACKAGE_VERSION = '0.0.50';
9
- async function runLocalBuildAsync(job) {
9
+ const PLUGIN_PACKAGE_VERSION = '0.0.56';
10
+ async function runLocalBuildAsync(job, options) {
11
+ var _a;
10
12
  const { command, args } = await getCommandAndArgsAsync(job);
11
- await (0, spawn_async_1.default)(command, args, {
12
- stdio: 'inherit',
13
- });
13
+ let spinner;
14
+ if (!options.verbose) {
15
+ spinner = (0, ora_1.ora)().start(options.skipNativeBuild ? 'Preparing project' : 'Building project');
16
+ }
17
+ let childProcess;
18
+ const interruptHandler = () => {
19
+ if (childProcess) {
20
+ childProcess.kill();
21
+ }
22
+ };
23
+ process.on('SIGINT', interruptHandler);
24
+ try {
25
+ const spawnPromise = (0, spawn_async_1.default)(command, args, {
26
+ stdio: options.verbose ? 'inherit' : 'pipe',
27
+ env: {
28
+ ...process.env,
29
+ EAS_LOCAL_BUILD_WORKINGDIR: (_a = options.workingdir) !== null && _a !== void 0 ? _a : process.env.EAS_LOCAL_BUILD_WORKINGDIR,
30
+ ...(options.skipCleanup || options.skipNativeBuild
31
+ ? { EAS_LOCAL_BUILD_SKIP_CLEANUP: '1' }
32
+ : {}),
33
+ ...(options.skipNativeBuild ? { EAS_LOCAL_BUILD_SKIP_NATIVE_BUILD: '1' } : {}),
34
+ ...(options.artifactsDir ? { EAS_LOCAL_BUILD_ARTIFACTS_DIR: options.artifactsDir } : {}),
35
+ },
36
+ });
37
+ childProcess = spawnPromise.child;
38
+ await spawnPromise;
39
+ }
40
+ finally {
41
+ process.removeListener('SIGINT', interruptHandler);
42
+ spinner === null || spinner === void 0 ? void 0 : spinner.stop();
43
+ }
14
44
  }
15
45
  exports.runLocalBuildAsync = runLocalBuildAsync;
16
46
  async function getCommandAndArgsAsync(job) {
@@ -4,6 +4,8 @@ exports.collectMetadataAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const config_plugins_1 = require("@expo/config-plugins");
6
6
  const eas_build_job_1 = require("@expo/eas-build-job");
7
+ const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
8
+ const resolve_from_1 = (0, tslib_1.__importDefault)(require("resolve-from"));
7
9
  const log_1 = (0, tslib_1.__importDefault)(require("../log"));
8
10
  const projectUtils_1 = require("../project/projectUtils");
9
11
  const actions_1 = require("../user/actions");
@@ -38,6 +40,7 @@ async function collectMetadataAsync(ctx) {
38
40
  credentialsSource: ctx.buildProfile.credentialsSource,
39
41
  sdkVersion: ctx.exp.sdkVersion,
40
42
  runtimeVersion: (_b = getRuntimeVersionNullable(ctx.exp, ctx.platform)) !== null && _b !== void 0 ? _b : undefined,
43
+ reactNativeVersion: await getReactNativeVersionAsync(ctx),
41
44
  ...channelOrReleaseChannel,
42
45
  distribution,
43
46
  appName: ctx.exp.name,
@@ -116,6 +119,17 @@ async function getNativeChannelAsync(ctx) {
116
119
  }
117
120
  return undefined;
118
121
  }
122
+ async function getReactNativeVersionAsync(ctx) {
123
+ try {
124
+ const reactNativePackageJsonPath = (0, resolve_from_1.default)(ctx.projectDir, 'react-native/package.json');
125
+ return (await fs_extra_1.default.readJson(reactNativePackageJsonPath)).version;
126
+ }
127
+ catch (err) {
128
+ log_1.default.debug('Failed to resolve react-native version:');
129
+ log_1.default.debug(err);
130
+ return undefined;
131
+ }
132
+ }
119
133
  function resolveIosEnterpriseProvisioning(ctx) {
120
134
  return ctx.buildProfile.enterpriseProvisioning;
121
135
  }
@@ -0,0 +1,15 @@
1
+ import { RequestedPlatform } from '../platform';
2
+ import { LocalBuildOptions } from './local';
3
+ export interface BuildFlags {
4
+ requestedPlatform: RequestedPlatform;
5
+ skipProjectConfiguration: boolean;
6
+ profile?: string;
7
+ nonInteractive: boolean;
8
+ wait: boolean;
9
+ clearCache: boolean;
10
+ json: boolean;
11
+ autoSubmit: boolean;
12
+ submitProfile?: string;
13
+ localBuildOptions: LocalBuildOptions;
14
+ }
15
+ export declare function runBuildAndSubmitAsync(projectDir: string, flags: BuildFlags): Promise<void>;
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runBuildAndSubmitAsync = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const eas_build_job_1 = require("@expo/eas-build-job");
6
+ const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
7
+ const nullthrows_1 = (0, tslib_1.__importDefault)(require("nullthrows"));
8
+ const generated_1 = require("../graphql/generated");
9
+ const AppPlatform_1 = require("../graphql/types/AppPlatform");
10
+ const log_1 = (0, tslib_1.__importDefault)(require("../log"));
11
+ const platform_1 = require("../platform");
12
+ const expoSdk_1 = require("../project/expoSdk");
13
+ const metroConfig_1 = require("../project/metroConfig");
14
+ const context_1 = require("../submit/context");
15
+ const submit_1 = require("../submit/submit");
16
+ const urls_1 = require("../submit/utils/urls");
17
+ const profiles_1 = require("../utils/profiles");
18
+ const vcs_1 = require("../vcs");
19
+ const build_1 = require("./android/build");
20
+ const build_2 = require("./build");
21
+ const configure_1 = require("./configure");
22
+ const createContext_1 = require("./createContext");
23
+ const build_3 = require("./ios/build");
24
+ const devClient_1 = require("./utils/devClient");
25
+ const printBuildInfo_1 = require("./utils/printBuildInfo");
26
+ const repository_1 = require("./utils/repository");
27
+ let metroConfigValidated = false;
28
+ let sdkVersionChecked = false;
29
+ async function runBuildAndSubmitAsync(projectDir, flags) {
30
+ var _a;
31
+ await (0, vcs_1.getVcsClient)().ensureRepoExistsAsync();
32
+ await (0, repository_1.ensureRepoIsCleanAsync)(flags.nonInteractive);
33
+ await (0, configure_1.ensureProjectConfiguredAsync)(projectDir, flags.requestedPlatform);
34
+ const platforms = (0, platform_1.toPlatforms)(flags.requestedPlatform);
35
+ const buildProfiles = await (0, profiles_1.getProfilesAsync)({
36
+ type: 'build',
37
+ projectDir,
38
+ platforms,
39
+ profileName: (_a = flags.profile) !== null && _a !== void 0 ? _a : undefined,
40
+ });
41
+ await (0, devClient_1.ensureExpoDevClientInstalledForDevClientBuildsAsync)({
42
+ projectDir,
43
+ nonInteractive: flags.nonInteractive,
44
+ buildProfiles,
45
+ });
46
+ const startedBuilds = [];
47
+ const buildCtxByPlatform = {};
48
+ for (const buildProfile of buildProfiles) {
49
+ const { build: maybeBuild, buildCtx } = await prepareAndStartBuildAsync({
50
+ projectDir,
51
+ flags,
52
+ moreBuilds: platforms.length > 1,
53
+ buildProfile,
54
+ });
55
+ if (maybeBuild) {
56
+ startedBuilds.push({ build: maybeBuild, buildProfile });
57
+ }
58
+ buildCtxByPlatform[(0, AppPlatform_1.toAppPlatform)(buildProfile.platform)] = buildCtx;
59
+ }
60
+ if (flags.localBuildOptions.enable) {
61
+ return;
62
+ }
63
+ log_1.default.newLine();
64
+ (0, printBuildInfo_1.printLogsUrls)(startedBuilds.map(startedBuild => startedBuild.build));
65
+ log_1.default.newLine();
66
+ const submissions = [];
67
+ if (flags.autoSubmit) {
68
+ const submitProfiles = await (0, profiles_1.getProfilesAsync)({
69
+ projectDir,
70
+ platforms,
71
+ profileName: flags.submitProfile,
72
+ type: 'submit',
73
+ });
74
+ for (const startedBuild of startedBuilds) {
75
+ const submitProfile = (0, nullthrows_1.default)(submitProfiles.find(({ platform }) => (0, AppPlatform_1.toAppPlatform)(platform) === startedBuild.build.platform)).profile;
76
+ const submission = await prepareAndStartSubmissionAsync({
77
+ build: startedBuild.build,
78
+ buildCtx: (0, nullthrows_1.default)(buildCtxByPlatform[startedBuild.build.platform]),
79
+ moreBuilds: startedBuilds.length > 1,
80
+ projectDir,
81
+ buildProfile: startedBuild.buildProfile.profile,
82
+ submitProfile,
83
+ nonInteractive: flags.nonInteractive,
84
+ });
85
+ submissions.push(submission);
86
+ }
87
+ log_1.default.newLine();
88
+ (0, urls_1.printSubmissionDetailsUrls)(submissions);
89
+ log_1.default.newLine();
90
+ }
91
+ if (!flags.wait) {
92
+ return;
93
+ }
94
+ const builds = await (0, build_2.waitForBuildEndAsync)(startedBuilds.map(({ build }) => build.id));
95
+ (0, printBuildInfo_1.printBuildResults)(builds, flags.json);
96
+ const haveAllBuildsFailedOrCanceled = builds.every(build => (build === null || build === void 0 ? void 0 : build.status) && [generated_1.BuildStatus.Errored, generated_1.BuildStatus.Canceled].includes(build === null || build === void 0 ? void 0 : build.status));
97
+ if (haveAllBuildsFailedOrCanceled || !flags.autoSubmit) {
98
+ exitWithNonZeroCodeIfSomeBuildsFailed(builds);
99
+ }
100
+ else {
101
+ // the following function also exits with non zero code if any of the submissions failed
102
+ await (0, submit_1.waitToCompleteAsync)(submissions);
103
+ }
104
+ }
105
+ exports.runBuildAndSubmitAsync = runBuildAndSubmitAsync;
106
+ async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildProfile, }) {
107
+ const buildCtx = await (0, createContext_1.createBuildContextAsync)({
108
+ buildProfileName: buildProfile.profileName,
109
+ clearCache: flags.clearCache,
110
+ buildProfile: buildProfile.profile,
111
+ nonInteractive: flags.nonInteractive,
112
+ platform: buildProfile.platform,
113
+ projectDir,
114
+ skipProjectConfiguration: flags.skipProjectConfiguration,
115
+ localBuildOptions: flags.localBuildOptions,
116
+ });
117
+ if (moreBuilds) {
118
+ log_1.default.newLine();
119
+ const appPlatform = (0, AppPlatform_1.toAppPlatform)(buildProfile.platform);
120
+ log_1.default.log(`${platform_1.appPlatformEmojis[appPlatform]} ${chalk_1.default.bold(`${platform_1.appPlatformDisplayNames[appPlatform]} build`)}`);
121
+ }
122
+ if (buildCtx.workflow === eas_build_job_1.Workflow.MANAGED) {
123
+ if (!sdkVersionChecked) {
124
+ await (0, expoSdk_1.checkExpoSdkIsSupportedAsync)(buildCtx);
125
+ sdkVersionChecked = true;
126
+ }
127
+ if (!metroConfigValidated) {
128
+ await (0, metroConfig_1.validateMetroConfigForManagedWorkflowAsync)(buildCtx);
129
+ metroConfigValidated = true;
130
+ }
131
+ }
132
+ const build = await startBuildAsync(buildCtx);
133
+ return {
134
+ build,
135
+ buildCtx,
136
+ };
137
+ }
138
+ async function startBuildAsync(ctx) {
139
+ let sendBuildRequestAsync;
140
+ if (ctx.platform === eas_build_job_1.Platform.ANDROID) {
141
+ sendBuildRequestAsync = await (0, build_1.prepareAndroidBuildAsync)(ctx);
142
+ }
143
+ else {
144
+ sendBuildRequestAsync = await (0, build_3.prepareIosBuildAsync)(ctx);
145
+ }
146
+ return await sendBuildRequestAsync();
147
+ }
148
+ async function prepareAndStartSubmissionAsync({ build, buildCtx, moreBuilds, projectDir, buildProfile, submitProfile, nonInteractive, }) {
149
+ var _a, _b, _c;
150
+ const platform = (0, AppPlatform_1.toPlatform)(build.platform);
151
+ const submissionCtx = await (0, context_1.createSubmissionContextAsync)({
152
+ platform,
153
+ projectDir,
154
+ projectId: build.project.id,
155
+ profile: submitProfile,
156
+ archiveFlags: { id: build.id },
157
+ nonInteractive,
158
+ env: buildProfile.env,
159
+ credentialsCtx: buildCtx.credentialsCtx,
160
+ 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,
161
+ });
162
+ if (moreBuilds) {
163
+ log_1.default.newLine();
164
+ log_1.default.log(`${platform_1.appPlatformEmojis[build.platform]} ${chalk_1.default.bold(`${platform_1.appPlatformDisplayNames[build.platform]} submission`)}`);
165
+ }
166
+ return await (0, submit_1.submitAsync)(submissionCtx);
167
+ }
168
+ function exitWithNonZeroCodeIfSomeBuildsFailed(maybeBuilds) {
169
+ const failedBuilds = maybeBuilds.filter(i => i).filter(i => i.status === generated_1.BuildStatus.Errored);
170
+ if (failedBuilds.length > 0) {
171
+ process.exit(1);
172
+ }
173
+ }
@@ -2,7 +2,6 @@ import EasCommand from '../../commandUtils/EasCommand';
2
2
  import { CreateUpdateBranchForAppMutationVariables, UpdateBranch } from '../../graphql/generated';
3
3
  export declare function createUpdateBranchOnAppAsync({ appId, name, }: CreateUpdateBranchForAppMutationVariables): Promise<Pick<UpdateBranch, 'id' | 'name'>>;
4
4
  export default class BranchCreate extends EasCommand {
5
- static hidden: boolean;
6
5
  static description: string;
7
6
  static args: {
8
7
  name: string;
@@ -65,7 +65,6 @@ class BranchCreate extends EasCommand_1.default {
65
65
  }
66
66
  }
67
67
  exports.default = BranchCreate;
68
- BranchCreate.hidden = true;
69
68
  BranchCreate.description = 'Create a branch on the current project.';
70
69
  BranchCreate.args = [
71
70
  {
@@ -1,6 +1,5 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class BranchDelete extends EasCommand {
3
- static hidden: boolean;
4
3
  static description: string;
5
4
  static args: {
6
5
  name: string;
@@ -93,8 +93,7 @@ class BranchDelete extends EasCommand_1.default {
93
93
  }
94
94
  }
95
95
  exports.default = BranchDelete;
96
- BranchDelete.hidden = true;
97
- BranchDelete.description = 'Republish an update group';
96
+ BranchDelete.description = 'Delete a branch on the current project';
98
97
  BranchDelete.args = [
99
98
  {
100
99
  name: 'name',
@@ -4,7 +4,6 @@ export declare function listBranchesAsync({ projectId, }: {
4
4
  projectId: string;
5
5
  }): Promise<UpdateBranchFragment[]>;
6
6
  export default class BranchList extends EasCommand {
7
- static hidden: boolean;
8
7
  static description: string;
9
8
  static flags: {
10
9
  json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
@@ -51,7 +51,7 @@ class BranchList extends EasCommand_1.default {
51
51
  }
52
52
  else {
53
53
  const table = new cli_table3_1.default({
54
- head: ['branch', ...utils_1.UPDATE_COLUMNS],
54
+ head: ['Branch', ...utils_1.UPDATE_COLUMNS],
55
55
  wordWrap: true,
56
56
  });
57
57
  table.push(...branches.map(branch => {
@@ -77,7 +77,6 @@ class BranchList extends EasCommand_1.default {
77
77
  }
78
78
  }
79
79
  exports.default = BranchList;
80
- BranchList.hidden = true;
81
80
  BranchList.description = 'List all branches on this project.';
82
81
  BranchList.flags = {
83
82
  json: command_1.flags.boolean({
@@ -1,23 +1,6 @@
1
- import { flags } from '@oclif/command';
2
1
  import EasCommand from '../../commandUtils/EasCommand';
3
- import { PublishPlatform } from '../../project/publish';
4
- export declare const defaultPublishPlatforms: PublishPlatform[];
5
2
  export default class BranchPublish extends EasCommand {
6
- static hidden: boolean;
7
3
  static description: string;
8
- static args: {
9
- name: string;
10
- description: string;
11
- }[];
12
- static flags: {
13
- message: flags.IOptionFlag<string | undefined>;
14
- republish: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
15
- group: flags.IOptionFlag<string | undefined>;
16
- 'input-dir': flags.IOptionFlag<string>;
17
- 'skip-bundler': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
18
- platform: flags.IOptionFlag<string>;
19
- json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
20
- auto: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
21
- };
4
+ static hidden: boolean;
22
5
  runAsync(): Promise<void>;
23
6
  }