eas-cli 0.38.2 → 0.41.0

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 (57) hide show
  1. package/README.md +64 -31
  2. package/build/build/build.js +3 -3
  3. package/build/build/context.d.ts +2 -1
  4. package/build/build/createContext.d.ts +3 -2
  5. package/build/build/createContext.js +3 -3
  6. package/build/build/local.d.ts +9 -1
  7. package/build/build/local.js +35 -5
  8. package/build/build/metadata.js +14 -0
  9. package/build/build/runBuildAndSubmit.d.ts +15 -0
  10. package/build/build/runBuildAndSubmit.js +173 -0
  11. package/build/commands/branch/list.js +1 -1
  12. package/build/commands/branch/publish.d.ts +1 -18
  13. package/build/commands/branch/publish.js +2 -358
  14. package/build/commands/build/configure.js +1 -1
  15. package/build/commands/build/index.d.ts +0 -5
  16. package/build/commands/build/index.js +8 -159
  17. package/build/commands/build/inspect.d.ts +22 -0
  18. package/build/commands/build/inspect.js +129 -0
  19. package/build/commands/channel/edit.js +1 -1
  20. package/build/commands/channel/view.js +3 -3
  21. package/build/commands/credentials.js +1 -7
  22. package/build/commands/diagnostics.d.ts +1 -0
  23. package/build/commands/diagnostics.js +19 -1
  24. package/build/commands/submit.js +1 -1
  25. package/build/commands/update/configure.d.ts +8 -0
  26. package/build/commands/update/configure.js +81 -0
  27. package/build/commands/update/index.d.ts +20 -0
  28. package/build/commands/update/index.js +384 -0
  29. package/build/credentials/context.d.ts +5 -0
  30. package/build/credentials/context.js +12 -7
  31. package/build/credentials/ios/actions/AscApiKeyUtils.js +1 -1
  32. package/build/credentials/ios/appstore/ensureAppExists.js +3 -3
  33. package/build/credentials/manager/ManageAndroid.d.ts +3 -3
  34. package/build/credentials/manager/ManageAndroid.js +21 -13
  35. package/build/credentials/manager/ManageIos.d.ts +3 -3
  36. package/build/credentials/manager/ManageIos.js +23 -13
  37. package/build/credentials/manager/SelectBuildProfileFromEasJson.d.ts +2 -3
  38. package/build/credentials/manager/SelectBuildProfileFromEasJson.js +3 -6
  39. package/build/credentials/manager/SelectPlatform.d.ts +1 -2
  40. package/build/credentials/manager/SelectPlatform.js +3 -3
  41. package/build/graphql/generated.d.ts +31 -11
  42. package/build/graphql/generated.js +6 -1
  43. package/build/graphql/types/Submission.js +1 -0
  44. package/build/project/expoSdk.d.ts +3 -0
  45. package/build/project/expoSdk.js +30 -0
  46. package/build/project/ios/target.js +32 -7
  47. package/build/prompts.d.ts +3 -3
  48. package/build/submit/context.js +0 -1
  49. package/build/submit/ios/AppProduce.js +3 -3
  50. package/build/submit/ios/IosSubmitCommand.js +1 -1
  51. package/build/submit/utils/urls.js +1 -1
  52. package/build/submit/utils/wait.js +1 -1
  53. package/build/update/utils.js +5 -5
  54. package/build/utils/profiles.d.ts +1 -1
  55. package/build/utils/profiles.js +80 -30
  56. package/oclif.manifest.json +1 -1
  57. package/package.json +10 -9
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const command_1 = require("@oclif/command");
5
+ const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
6
+ const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
7
+ const path_1 = (0, tslib_1.__importDefault)(require("path"));
8
+ const uuid_1 = require("uuid");
9
+ const runBuildAndSubmit_1 = require("../../build/runBuildAndSubmit");
10
+ const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
11
+ const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
12
+ const ora_1 = require("../../ora");
13
+ const platform_1 = require("../../platform");
14
+ const projectUtils_1 = require("../../project/projectUtils");
15
+ const paths_1 = require("../../utils/paths");
16
+ const vcs_1 = require("../../vcs");
17
+ var InspectStage;
18
+ (function (InspectStage) {
19
+ InspectStage["ARCHIVE"] = "archive";
20
+ InspectStage["PRE_BUILD"] = "pre-build";
21
+ InspectStage["POST_BUILD"] = "post-build";
22
+ })(InspectStage || (InspectStage = {}));
23
+ const STAGE_DESCRIPTION = `Stage of the build you want to inspect.
24
+ archive - builds the project archive that would be uploaded to EAS when building
25
+ pre-build - prepares the project to be built with Gradle/Xcode. Does not run the native build.
26
+ post-build - builds the native project and leaves the output directory for inspection`;
27
+ class BuildInspect extends EasCommand_1.default {
28
+ async runAsync() {
29
+ const { flags } = this.parse(BuildInspect);
30
+ const outputDirectory = path_1.default.resolve(process.cwd(), flags.output);
31
+ await this.prepareOutputDirAsync(outputDirectory, flags.force);
32
+ if (flags.stage === InspectStage.ARCHIVE) {
33
+ const vcs = (0, vcs_1.getVcsClient)();
34
+ await vcs.ensureRepoExistsAsync();
35
+ await vcs.makeShallowCopyAsync(outputDirectory);
36
+ log_1.default.withTick(`Project saved to ${outputDirectory}`);
37
+ }
38
+ else {
39
+ const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
40
+ const tmpWorkingdir = path_1.default.join((0, paths_1.getTmpDirectory)(), (0, uuid_1.v4)());
41
+ try {
42
+ await (0, runBuildAndSubmit_1.runBuildAndSubmitAsync)(projectDir, {
43
+ skipProjectConfiguration: false,
44
+ nonInteractive: false,
45
+ wait: true,
46
+ clearCache: false,
47
+ json: false,
48
+ autoSubmit: false,
49
+ requestedPlatform: flags.platform,
50
+ profile: flags.profile,
51
+ localBuildOptions: {
52
+ enable: true,
53
+ ...(flags.stage === InspectStage.PRE_BUILD ? { skipNativeBuild: true } : {}),
54
+ ...(flags.stage === InspectStage.POST_BUILD ? { skipCleanup: true } : {}),
55
+ verbose: flags.verbose,
56
+ workingdir: tmpWorkingdir,
57
+ artifactsDir: path_1.default.join(tmpWorkingdir, 'artifacts'),
58
+ },
59
+ });
60
+ if (!flags.verbose) {
61
+ log_1.default.log(chalk_1.default.green('Build successful'));
62
+ }
63
+ }
64
+ catch (err) {
65
+ if (!flags.verbose) {
66
+ log_1.default.error('Build failed');
67
+ log_1.default.error(`Re-run this command with ${chalk_1.default.bold('--verbose')} flag to see the logs`);
68
+ }
69
+ }
70
+ finally {
71
+ const spinner = (0, ora_1.ora)().start(`Copying project build directory to ${outputDirectory}`);
72
+ try {
73
+ const tmpBuildDirectory = path_1.default.join(tmpWorkingdir, 'build');
74
+ if (await fs_extra_1.default.pathExists(tmpBuildDirectory)) {
75
+ await fs_extra_1.default.copy(tmpBuildDirectory, outputDirectory);
76
+ }
77
+ await fs_extra_1.default.remove(tmpWorkingdir);
78
+ spinner.succeed(`Project build directory saved to ${outputDirectory}`);
79
+ }
80
+ catch (err) {
81
+ spinner.fail();
82
+ throw err;
83
+ }
84
+ }
85
+ }
86
+ }
87
+ async prepareOutputDirAsync(outputDir, force) {
88
+ if (await fs_extra_1.default.pathExists(outputDir)) {
89
+ if (force) {
90
+ await fs_extra_1.default.remove(outputDir);
91
+ }
92
+ else {
93
+ throw new Error(`Directory ${outputDir} already exists`);
94
+ }
95
+ }
96
+ await fs_extra_1.default.mkdirp(outputDir);
97
+ }
98
+ }
99
+ exports.default = BuildInspect;
100
+ BuildInspect.description = 'Inspect the state of the project at specific build stages. Useful for troubleshooting.';
101
+ BuildInspect.flags = {
102
+ platform: command_1.flags.enum({
103
+ char: 'p',
104
+ options: [platform_1.RequestedPlatform.Android, platform_1.RequestedPlatform.Ios],
105
+ required: true,
106
+ }),
107
+ profile: command_1.flags.string({
108
+ description: 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
109
+ helpValue: 'PROFILE_NAME',
110
+ }),
111
+ stage: command_1.flags.enum({
112
+ char: 's',
113
+ description: STAGE_DESCRIPTION,
114
+ options: [InspectStage.ARCHIVE, InspectStage.PRE_BUILD, InspectStage.POST_BUILD],
115
+ required: true,
116
+ }),
117
+ output: command_1.flags.string({
118
+ description: 'Output directory.',
119
+ required: true,
120
+ helpValue: 'OUTPUT_DIRECTORY',
121
+ }),
122
+ force: command_1.flags.boolean({
123
+ description: 'Delete OUTPUT_DIRECTORY if it already exists.',
124
+ default: false,
125
+ }),
126
+ verbose: command_1.flags.boolean({
127
+ default: false,
128
+ }),
129
+ };
@@ -54,7 +54,7 @@ async function updateChannelBranchMappingAsync({ channelId, branchMapping, }) {
54
54
  .toPromise());
55
55
  const channel = data.updateChannel.editUpdateChannel;
56
56
  if (!channel) {
57
- throw new Error(`Could not fine channel with id ${channelId}`);
57
+ throw new Error(`Could not find a channel with id: ${channelId}`);
58
58
  }
59
59
  return data.updateChannel.editUpdateChannel;
60
60
  }
@@ -133,7 +133,7 @@ function logChannelDetails(channel) {
133
133
  : []),
134
134
  (0, utils_1.formatUpdate)(update),
135
135
  (_a = update === null || update === void 0 ? void 0 : update.runtimeVersion) !== null && _a !== void 0 ? _a : 'N/A',
136
- (_b = update === null || update === void 0 ? void 0 : update.group) !== null && _b !== void 0 ? _b : 'N/A,',
136
+ (_b = update === null || update === void 0 ? void 0 : update.group) !== null && _b !== void 0 ? _b : 'N/A',
137
137
  (0, utils_1.getPlatformsForGroup)({
138
138
  updates: branch.updates,
139
139
  group: (_c = branch.updates[0]) === null || _c === void 0 ? void 0 : _c.group,
@@ -168,7 +168,7 @@ class ChannelView extends EasCommand_1.default {
168
168
  });
169
169
  const channel = (_a = getUpdateChannelByNameForAppresult.app) === null || _a === void 0 ? void 0 : _a.byId.updateChannelByName;
170
170
  if (!channel) {
171
- throw new Error(`Could not fine channel with name ${channelName}`);
171
+ throw new Error(`Could not find a channel with name: ${channelName}`);
172
172
  }
173
173
  if (jsonFlag) {
174
174
  log_1.default.log(JSON.stringify(channel));
@@ -181,7 +181,7 @@ class ChannelView extends EasCommand_1.default {
181
181
  { label: 'ID', value: channel.id },
182
182
  ]));
183
183
  log_1.default.addNewLineIfNone();
184
- log_1.default.log((0, chalk_1.default) `{bold Branches, pointed at by this channel, and their most recent update group:}`);
184
+ log_1.default.log((0, chalk_1.default) `{bold Branches pointed at this channel and their most recent update group:}`);
185
185
  logChannelDetails(channel);
186
186
  }
187
187
  }
@@ -2,16 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const EasCommand_1 = (0, tslib_1.__importDefault)(require("../commandUtils/EasCommand"));
5
- const context_1 = require("../credentials/context");
6
5
  const SelectPlatform_1 = require("../credentials/manager/SelectPlatform");
7
- const actions_1 = require("../user/actions");
8
6
  class Credentials extends EasCommand_1.default {
9
7
  async runAsync() {
10
- const ctx = new context_1.CredentialsContext({
11
- projectDir: process.cwd(),
12
- user: await (0, actions_1.ensureLoggedInAsync)(),
13
- });
14
- await new SelectPlatform_1.SelectPlatform().runAsync(ctx);
8
+ await new SelectPlatform_1.SelectPlatform().runAsync();
15
9
  }
16
10
  }
17
11
  exports.default = Credentials;
@@ -3,4 +3,5 @@ export default class Diagnostics extends EasCommand {
3
3
  static description: string;
4
4
  protected requiresAuthentication: boolean;
5
5
  runAsync(): Promise<void>;
6
+ private printWorkflowAsync;
6
7
  }
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ const eas_build_job_1 = require("@expo/eas-build-job");
4
5
  const envinfo_1 = (0, tslib_1.__importDefault)(require("envinfo"));
5
6
  const EasCommand_1 = (0, tslib_1.__importDefault)(require("../commandUtils/EasCommand"));
6
7
  const log_1 = (0, tslib_1.__importDefault)(require("../log"));
8
+ const projectUtils_1 = require("../project/projectUtils");
9
+ const workflow_1 = require("../project/workflow");
7
10
  const easCli_1 = require("../utils/easCli");
8
11
  class Diagnostics extends EasCommand_1.default {
9
12
  constructor() {
@@ -30,7 +33,22 @@ class Diagnostics extends EasCommand_1.default {
30
33
  }, {
31
34
  title: `EAS CLI ${easCli_1.easCliVersion} environment info`,
32
35
  });
33
- log_1.default.log(info);
36
+ log_1.default.log(info.trimEnd());
37
+ await this.printWorkflowAsync();
38
+ log_1.default.newLine();
39
+ }
40
+ async printWorkflowAsync() {
41
+ const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
42
+ const androidWorkflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.ANDROID);
43
+ const iosWorkflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.IOS);
44
+ if (androidWorkflow === iosWorkflow) {
45
+ log_1.default.log(` Project workflow: ${androidWorkflow}`);
46
+ }
47
+ else {
48
+ log_1.default.log(` Project Workflow:`);
49
+ log_1.default.log(` Android: ${androidWorkflow}`);
50
+ log_1.default.log(` iOS: ${iosWorkflow}`);
51
+ }
34
52
  }
35
53
  }
36
54
  exports.default = Diagnostics;
@@ -74,7 +74,7 @@ class Submit extends EasCommand_1.default {
74
74
  }
75
75
  }
76
76
  exports.default = Submit;
77
- Submit.description = `submit build archive to app store
77
+ Submit.description = `Submit build archive to App Store Connect
78
78
  See how to configure submits with eas.json: ${(0, log_1.link)('https://docs.expo.dev/submit/eas-json/')}`;
79
79
  Submit.aliases = ['build:submit'];
80
80
  Submit.flags = {
@@ -0,0 +1,8 @@
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 hidden: boolean;
6
+ static description: string;
7
+ runAsync(): Promise<void>;
8
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEASUpdateURLAsync = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const config_1 = require("@expo/config");
6
+ const eas_build_job_1 = require("@expo/eas-build-job");
7
+ const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
8
+ const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
9
+ const log_1 = (0, tslib_1.__importStar)(require("../../log"));
10
+ const projectUtils_1 = require("../../project/projectUtils");
11
+ const workflow_1 = require("../../project/workflow");
12
+ const EAS_UPDATE_URL = 'https://u.expo.dev';
13
+ const DEFAULT_MANAGED_RUNTIME_VERSION = { policy: 'sdkVersion' };
14
+ const DEFAULT_BARE_RUNTIME_VERSION = '1.0.0';
15
+ async function getEASUpdateURLAsync(exp) {
16
+ const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
17
+ return new URL(projectId, EAS_UPDATE_URL).href;
18
+ }
19
+ exports.getEASUpdateURLAsync = getEASUpdateURLAsync;
20
+ async function configureProjectForEASUpdateAsync(projectDir, exp, isBare) {
21
+ var _a, _b;
22
+ const easUpdateURL = await getEASUpdateURLAsync(exp);
23
+ const preexistingRuntimeVersion = exp.runtimeVersion;
24
+ const defaultRuntimeVersion = isBare
25
+ ? DEFAULT_BARE_RUNTIME_VERSION
26
+ : DEFAULT_MANAGED_RUNTIME_VERSION;
27
+ const result = await (0, config_1.modifyConfigAsync)(projectDir, {
28
+ runtimeVersion: preexistingRuntimeVersion !== null && preexistingRuntimeVersion !== void 0 ? preexistingRuntimeVersion : defaultRuntimeVersion,
29
+ updates: { ...exp.updates, url: easUpdateURL },
30
+ });
31
+ switch (result.type) {
32
+ case 'success':
33
+ if ((_a = exp.updates) === null || _a === void 0 ? void 0 : _a.url) {
34
+ if (exp.updates.url !== easUpdateURL) {
35
+ log_1.default.withTick(`Overwrote "${(_b = exp.updates) === null || _b === void 0 ? void 0 : _b.url}" with "${easUpdateURL}" for the updates.url value in app.json`);
36
+ }
37
+ }
38
+ else {
39
+ log_1.default.withTick(`Set updates.url value, to "${easUpdateURL}" in app.json`);
40
+ }
41
+ if (!preexistingRuntimeVersion) {
42
+ log_1.default.withTick(`Set runtimeVersion to "${JSON.stringify(defaultRuntimeVersion)}" in app.json`);
43
+ }
44
+ break;
45
+ case 'warn': {
46
+ log_1.default.addNewLineIfNone();
47
+ log_1.default.warn(`It looks like you are using a dynamic configuration! ${(0, log_1.learnMore)('https://docs.expo.dev/workflow/configuration/#dynamic-configuration-with-appconfigjs)')}`);
48
+ log_1.default.warn(`In order to finish configuring your project for EAS Update, you are going to need manually add the following to your app.config.js:\n${(0, log_1.learnMore)('https://expo.fyi/eas-update-config.md')}\n`);
49
+ log_1.default.log(chalk_1.default.bold(`{\n updates": {\n "url": "${easUpdateURL}"\n },\n "runtimeVersion": {\n "policy": "sdkVersion"\n }\n}`));
50
+ log_1.default.addNewLineIfNone();
51
+ throw new Error(result.message);
52
+ }
53
+ case 'fail':
54
+ throw new Error(result.message);
55
+ default:
56
+ throw new Error('Unexpected result type from modifyConfigAsync');
57
+ }
58
+ }
59
+ class UpdateConfigure extends EasCommand_1.default {
60
+ async runAsync() {
61
+ log_1.default.log('💡 The following process will configure your project to run EAS Update. These changes only apply to your local project files and you can safely revert them at any time.');
62
+ const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
63
+ const { exp } = (0, config_1.getConfig)(projectDir, {
64
+ skipSDKVersionRequirement: true,
65
+ });
66
+ const hasAndroidNativeProject = (await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.ANDROID)) === eas_build_job_1.Workflow.GENERIC;
67
+ const hasIosNativeProject = (await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.IOS)) === eas_build_job_1.Workflow.GENERIC;
68
+ const isBare = hasAndroidNativeProject || hasIosNativeProject;
69
+ await configureProjectForEASUpdateAsync(projectDir, exp, isBare);
70
+ log_1.default.addNewLineIfNone();
71
+ if (isBare) {
72
+ log_1.default.log(`🧐 It seems you are on the bare workflow! Please also update your native files. You can do this by either running ${chalk_1.default.bold('eas build:configure')} or manually editing Expo.plist/AndroidManifest.xml. ${(0, log_1.learnMore)('https://expo.fyi/eas-update-config.md#native-configuration')}`);
73
+ }
74
+ else {
75
+ log_1.default.log(`🎉 Your app is configured to run EAS Update!`);
76
+ }
77
+ }
78
+ }
79
+ exports.default = UpdateConfigure;
80
+ UpdateConfigure.hidden = true;
81
+ UpdateConfigure.description = 'Configure the project to support EAS Update.';
@@ -0,0 +1,20 @@
1
+ import { flags } from '@oclif/command';
2
+ import EasCommand from '../../commandUtils/EasCommand';
3
+ import { PublishPlatform } from '../../project/publish';
4
+ export declare const defaultPublishPlatforms: PublishPlatform[];
5
+ export default class UpdatePublish extends EasCommand {
6
+ static hidden: boolean;
7
+ static description: string;
8
+ static flags: {
9
+ branch: flags.IOptionFlag<string | undefined>;
10
+ message: flags.IOptionFlag<string | undefined>;
11
+ republish: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
12
+ group: flags.IOptionFlag<string | undefined>;
13
+ 'input-dir': flags.IOptionFlag<string>;
14
+ 'skip-bundler': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
15
+ platform: flags.IOptionFlag<string>;
16
+ json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
17
+ auto: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
18
+ };
19
+ runAsync(): Promise<void>;
20
+ }