eas-cli 2.5.1 → 2.7.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 (150) hide show
  1. package/README.md +8 -1095
  2. package/build/branch/queries.d.ts +8 -1
  3. package/build/branch/queries.js +53 -23
  4. package/build/build/android/build.js +1 -0
  5. package/build/build/ios/build.js +1 -0
  6. package/build/build/local.js +1 -1
  7. package/build/build/queries.d.ts +11 -1
  8. package/build/build/queries.js +39 -1
  9. package/build/build/validate.d.ts +1 -0
  10. package/build/build/validate.js +121 -1
  11. package/build/channel/queries.d.ts +11 -0
  12. package/build/channel/queries.js +51 -9
  13. package/build/channel/utils.js +22 -22
  14. package/build/commandUtils/context/LoggedInContextField.d.ts +3 -0
  15. package/build/commandUtils/context/LoggedInContextField.js +9 -1
  16. package/build/commandUtils/context/MaybeLoggedInContextField.d.ts +3 -0
  17. package/build/commandUtils/context/MaybeLoggedInContextField.js +9 -1
  18. package/build/commandUtils/context/contextUtils/createGraphqlClient.d.ts +2 -2
  19. package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +1 -1
  20. package/build/commandUtils/gating/FeatureGateEnvOverrides.d.ts +7 -0
  21. package/build/commandUtils/gating/FeatureGateEnvOverrides.js +35 -0
  22. package/build/commandUtils/gating/FeatureGateKey.d.ts +4 -0
  23. package/build/commandUtils/gating/FeatureGateKey.js +11 -0
  24. package/build/commandUtils/gating/FeatureGateTestOverrides.d.ts +5 -0
  25. package/build/commandUtils/gating/FeatureGateTestOverrides.js +17 -0
  26. package/build/commandUtils/gating/FeatureGating.d.ts +16 -0
  27. package/build/commandUtils/gating/FeatureGating.js +55 -0
  28. package/build/commandUtils/pagination.d.ts +4 -3
  29. package/build/commands/branch/create.d.ts +0 -3
  30. package/build/commands/branch/create.js +2 -27
  31. package/build/commands/branch/list.d.ts +1 -1
  32. package/build/commands/branch/view.d.ts +1 -1
  33. package/build/commands/build/configure.d.ts +1 -1
  34. package/build/commands/build/index.d.ts +2 -2
  35. package/build/commands/build/list.d.ts +4 -4
  36. package/build/commands/build/list.js +2 -15
  37. package/build/commands/build/run.d.ts +21 -0
  38. package/build/commands/build/run.js +149 -0
  39. package/build/commands/build/version/set.d.ts +1 -1
  40. package/build/commands/build/version/sync.d.ts +1 -1
  41. package/build/commands/channel/create.d.ts +0 -7
  42. package/build/commands/channel/create.js +4 -31
  43. package/build/commands/channel/list.d.ts +1 -1
  44. package/build/commands/channel/view.d.ts +1 -1
  45. package/build/commands/config.d.ts +1 -1
  46. package/build/commands/credentials.d.ts +1 -1
  47. package/build/commands/device/list.d.ts +1 -1
  48. package/build/commands/metadata/lint.d.ts +12 -0
  49. package/build/commands/metadata/lint.js +72 -0
  50. package/build/commands/metadata/pull.js +20 -9
  51. package/build/commands/metadata/push.js +20 -9
  52. package/build/commands/secret/create.d.ts +1 -1
  53. package/build/commands/secret/list.js +12 -17
  54. package/build/commands/submit.d.ts +1 -1
  55. package/build/commands/update/configure.d.ts +1 -0
  56. package/build/commands/update/configure.js +10 -216
  57. package/build/commands/update/index.d.ts +3 -9
  58. package/build/commands/update/index.js +136 -143
  59. package/build/commands/update/list.d.ts +1 -1
  60. package/build/commands/webhook/create.d.ts +1 -1
  61. package/build/commands/webhook/list.d.ts +1 -1
  62. package/build/commands/webhook/update.d.ts +1 -1
  63. package/build/devices/actions/create/inputMethod.js +2 -15
  64. package/build/devices/utils/formatDevice.d.ts +2 -0
  65. package/build/devices/utils/formatDevice.js +32 -7
  66. package/build/env.d.ts +8 -0
  67. package/build/env.js +8 -0
  68. package/build/graphql/generated.d.ts +100 -23
  69. package/build/graphql/generated.js +10 -2
  70. package/build/graphql/mutations/KeystoreGenerationUrlMutation.js +1 -1
  71. package/build/graphql/queries/UserQuery.js +2 -2
  72. package/build/graphql/types/Build.js +2 -0
  73. package/build/log.d.ts +1 -0
  74. package/build/log.js +3 -0
  75. package/build/metadata/apple/rules/index.d.ts +1 -0
  76. package/build/metadata/apple/rules/index.js +6 -0
  77. package/build/metadata/apple/rules/infoKeywordLength.d.ts +6 -0
  78. package/build/metadata/apple/rules/infoKeywordLength.js +35 -0
  79. package/build/metadata/apple/rules/infoRestrictedWords.d.ts +6 -0
  80. package/build/metadata/apple/rules/infoRestrictedWords.js +57 -0
  81. package/build/metadata/apple/tasks/index.d.ts +1 -2
  82. package/build/metadata/apple/tasks/index.js +1 -1
  83. package/build/metadata/auth.d.ts +21 -0
  84. package/build/metadata/auth.js +33 -0
  85. package/build/metadata/config/issue.d.ts +21 -0
  86. package/build/metadata/config/issue.js +9 -0
  87. package/build/metadata/config/resolve.d.ts +27 -0
  88. package/build/metadata/{config.js → config/resolve.js} +24 -25
  89. package/build/metadata/config/schema.d.ts +7 -0
  90. package/build/metadata/config/schema.js +2 -0
  91. package/build/metadata/config/validate.d.ts +3 -0
  92. package/build/metadata/config/validate.js +47 -0
  93. package/build/metadata/download.d.ts +11 -2
  94. package/build/metadata/download.js +14 -9
  95. package/build/metadata/errors.d.ts +3 -3
  96. package/build/metadata/errors.js +3 -1
  97. package/build/metadata/upload.d.ts +11 -2
  98. package/build/metadata/upload.js +16 -11
  99. package/build/metadata/utils/ajv.d.ts +10 -0
  100. package/build/metadata/utils/ajv.js +30 -0
  101. package/build/metadata/utils/telemetry.js +6 -6
  102. package/build/project/projectUtils.d.ts +3 -1
  103. package/build/project/projectUtils.js +10 -3
  104. package/build/project/publish.d.ts +13 -10
  105. package/build/project/publish.js +68 -38
  106. package/build/project/workflow.d.ts +1 -0
  107. package/build/project/workflow.js +9 -1
  108. package/build/run/android/run.d.ts +1 -0
  109. package/build/run/android/run.js +9 -0
  110. package/build/run/ios/run.d.ts +1 -0
  111. package/build/run/ios/run.js +31 -0
  112. package/build/run/ios/simctl.d.ts +2 -0
  113. package/build/run/ios/simctl.js +8 -0
  114. package/build/run/ios/simulator.d.ts +21 -0
  115. package/build/run/ios/simulator.js +161 -0
  116. package/build/run/ios/systemRequirements.d.ts +1 -0
  117. package/build/run/ios/systemRequirements.js +82 -0
  118. package/build/run/ios/xcode.d.ts +4 -0
  119. package/build/run/ios/xcode.js +41 -0
  120. package/build/run/ios/xcrun.d.ts +4 -0
  121. package/build/run/ios/xcrun.js +68 -0
  122. package/build/run/run.d.ts +8 -0
  123. package/build/run/run.js +15 -0
  124. package/build/submit/ArchiveSource.js +12 -16
  125. package/build/submit/utils/summary.d.ts +1 -1
  126. package/build/update/configure.d.ts +22 -0
  127. package/build/update/configure.js +200 -0
  128. package/build/update/queries.js +30 -39
  129. package/build/update/utils.d.ts +8 -1
  130. package/build/update/utils.js +35 -1
  131. package/build/utils/buildDistribution.d.ts +3 -0
  132. package/build/utils/buildDistribution.js +20 -0
  133. package/build/utils/download.d.ts +2 -0
  134. package/build/utils/download.js +114 -0
  135. package/build/utils/expoCli.d.ts +6 -0
  136. package/build/utils/expoCli.js +46 -1
  137. package/build/utils/expodash/filter.d.ts +2 -0
  138. package/build/utils/expodash/filter.js +8 -0
  139. package/build/utils/expodash/memoize.d.ts +2 -0
  140. package/build/utils/expodash/memoize.js +17 -0
  141. package/build/utils/formatFields.d.ts +3 -2
  142. package/build/utils/image.d.ts +6 -0
  143. package/build/utils/image.js +107 -0
  144. package/build/utils/statuspageService.js +1 -0
  145. package/oclif.manifest.json +1 -1
  146. package/package.json +36 -30
  147. package/schema/metadata-0.json +1 -1
  148. package/build/metadata/config.d.ts +0 -41
  149. package/build/metadata/context.d.ts +0 -50
  150. package/build/metadata/context.js +0 -47
@@ -5,7 +5,7 @@ export default class BuildList extends EasCommand {
5
5
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
6
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
7
  offset: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
8
- limit: any;
8
+ limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
9
9
  'apple-team-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
10
10
  };
11
11
  static contextDefinition: {
@@ -0,0 +1,12 @@
1
+ import EasCommand from '../../commandUtils/EasCommand';
2
+ export default class MetadataLint extends EasCommand {
3
+ static description: string;
4
+ static flags: {
5
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
+ profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
7
+ };
8
+ static contextDefinition: {
9
+ projectDir: import("../../commandUtils/context/ProjectDirContextField").default;
10
+ };
11
+ runAsync(): Promise<void>;
12
+ }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const tslib_1 = require("tslib");
5
+ const eas_build_job_1 = require("@expo/eas-build-job");
6
+ const eas_json_1 = require("@expo/eas-json");
7
+ const core_1 = require("@oclif/core");
8
+ const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
9
+ const log_1 = tslib_1.__importDefault(require("../../log"));
10
+ const resolve_1 = require("../../metadata/config/resolve");
11
+ const errors_1 = require("../../metadata/errors");
12
+ const json_1 = require("../../utils/json");
13
+ const profiles_1 = require("../../utils/profiles");
14
+ class MetadataLint extends EasCommand_1.default {
15
+ async runAsync() {
16
+ const { flags } = await this.parse(MetadataLint);
17
+ const { projectDir } = await this.getContextAsync(MetadataLint, {
18
+ nonInteractive: true,
19
+ });
20
+ if (flags.json) {
21
+ (0, json_1.enableJsonOutput)();
22
+ }
23
+ else {
24
+ log_1.default.warn('EAS Metadata is in beta and subject to breaking changes.');
25
+ }
26
+ const submitProfiles = await (0, profiles_1.getProfilesAsync)({
27
+ type: 'submit',
28
+ easJsonAccessor: new eas_json_1.EasJsonAccessor(projectDir),
29
+ platforms: [eas_build_job_1.Platform.IOS],
30
+ profileName: flags.profile,
31
+ });
32
+ if (submitProfiles.length !== 1) {
33
+ throw new Error('Metadata only supports iOS and a single submit profile.');
34
+ }
35
+ const submitProfile = submitProfiles[0].profile;
36
+ try {
37
+ await (0, resolve_1.loadConfigAsync)({ projectDir, profile: submitProfile });
38
+ if (flags.json) {
39
+ return (0, json_1.printJsonOnlyOutput)([]);
40
+ }
41
+ log_1.default.log('✅ Store configuration is valid.');
42
+ }
43
+ catch (error) {
44
+ if (!(error instanceof errors_1.MetadataValidationError)) {
45
+ throw error;
46
+ }
47
+ if (flags.json) {
48
+ return (0, json_1.printJsonOnlyOutput)(error.errors);
49
+ }
50
+ (0, errors_1.logMetadataValidationError)(error);
51
+ log_1.default.addNewLineIfNone();
52
+ }
53
+ }
54
+ }
55
+ exports.default = MetadataLint;
56
+ _a = MetadataLint;
57
+ MetadataLint.description = 'validate the local store configuration';
58
+ MetadataLint.flags = {
59
+ json: core_1.Flags.boolean({
60
+ description: 'Enable JSON output, non-JSON messages will be printed to stderr',
61
+ default: false,
62
+ }),
63
+ profile: core_1.Flags.string({
64
+ description: 'Name of the submit profile from eas.json. Defaults to "production" if defined in eas.json.',
65
+ }),
66
+ };
67
+ MetadataLint.contextDefinition = {
68
+ // The metadata lint command is created to integrate in other dev tooling, like vscode-expo.
69
+ // These integrations might spam this command, so we avoid communicating with our services here.
70
+ // Note that this is an exception and you should normally use `ProjectConfig` instead.
71
+ ..._a.ContextOptions.ProjectDir,
72
+ };
@@ -2,6 +2,8 @@
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const tslib_1 = require("tslib");
5
+ const eas_build_job_1 = require("@expo/eas-build-job");
6
+ const eas_json_1 = require("@expo/eas-json");
5
7
  const core_1 = require("@oclif/core");
6
8
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
9
  const path_1 = tslib_1.__importDefault(require("path"));
@@ -9,9 +11,9 @@ const configure_1 = require("../../build/configure");
9
11
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
10
12
  const context_1 = require("../../credentials/context");
11
13
  const log_1 = tslib_1.__importStar(require("../../log"));
12
- const context_2 = require("../../metadata/context");
13
14
  const download_1 = require("../../metadata/download");
14
15
  const errors_1 = require("../../metadata/errors");
16
+ const profiles_1 = require("../../utils/profiles");
15
17
  class MetadataPull extends EasCommand_1.default {
16
18
  async runAsync() {
17
19
  log_1.default.warn('EAS Metadata is in beta and subject to breaking changes.');
@@ -21,6 +23,16 @@ class MetadataPull extends EasCommand_1.default {
21
23
  });
22
24
  // this command is interactive (all nonInteractive flags passed to utility functions are false)
23
25
  await (0, configure_1.ensureProjectConfiguredAsync)({ projectDir, nonInteractive: false });
26
+ const submitProfiles = await (0, profiles_1.getProfilesAsync)({
27
+ type: 'submit',
28
+ easJsonAccessor: new eas_json_1.EasJsonAccessor(projectDir),
29
+ platforms: [eas_build_job_1.Platform.IOS],
30
+ profileName: flags.profile,
31
+ });
32
+ if (submitProfiles.length !== 1) {
33
+ throw new Error('Metadata only supports iOS and a single submit profile.');
34
+ }
35
+ const submitProfile = submitProfiles[0].profile;
24
36
  const credentialsCtx = new context_1.CredentialsContext({
25
37
  projectInfo: { exp, projectId },
26
38
  projectDir,
@@ -29,15 +41,14 @@ class MetadataPull extends EasCommand_1.default {
29
41
  analytics,
30
42
  nonInteractive: false,
31
43
  });
32
- const metadataCtx = await (0, context_2.createMetadataContextAsync)({
33
- credentialsCtx,
34
- analytics,
35
- projectDir,
36
- exp,
37
- profileName: flags.profile,
38
- });
39
44
  try {
40
- const filePath = await (0, download_1.downloadMetadataAsync)(metadataCtx);
45
+ const filePath = await (0, download_1.downloadMetadataAsync)({
46
+ analytics,
47
+ exp,
48
+ credentialsCtx,
49
+ projectDir,
50
+ profile: submitProfile,
51
+ });
41
52
  const relativePath = path_1.default.relative(process.cwd(), filePath);
42
53
  log_1.default.addNewLineIfNone();
43
54
  log_1.default.log(`🎉 Your store config is ready.
@@ -2,14 +2,16 @@
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const tslib_1 = require("tslib");
5
+ const eas_build_job_1 = require("@expo/eas-build-job");
6
+ const eas_json_1 = require("@expo/eas-json");
5
7
  const core_1 = require("@oclif/core");
6
8
  const configure_1 = require("../../build/configure");
7
9
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
8
10
  const context_1 = require("../../credentials/context");
9
11
  const log_1 = tslib_1.__importStar(require("../../log"));
10
- const context_2 = require("../../metadata/context");
11
12
  const errors_1 = require("../../metadata/errors");
12
13
  const upload_1 = require("../../metadata/upload");
14
+ const profiles_1 = require("../../utils/profiles");
13
15
  class MetadataPush extends EasCommand_1.default {
14
16
  async runAsync() {
15
17
  log_1.default.warn('EAS Metadata is in beta and subject to breaking changes.');
@@ -19,6 +21,16 @@ class MetadataPush extends EasCommand_1.default {
19
21
  });
20
22
  // this command is interactive (all nonInteractive flags passed to utility functions are false)
21
23
  await (0, configure_1.ensureProjectConfiguredAsync)({ projectDir, nonInteractive: false });
24
+ const submitProfiles = await (0, profiles_1.getProfilesAsync)({
25
+ type: 'submit',
26
+ easJsonAccessor: new eas_json_1.EasJsonAccessor(projectDir),
27
+ platforms: [eas_build_job_1.Platform.IOS],
28
+ profileName: flags.profile,
29
+ });
30
+ if (submitProfiles.length !== 1) {
31
+ throw new Error('Metadata only supports iOS and a single submit profile.');
32
+ }
33
+ const submitProfile = submitProfiles[0].profile;
22
34
  const credentialsCtx = new context_1.CredentialsContext({
23
35
  projectInfo: { exp, projectId },
24
36
  projectDir,
@@ -27,15 +39,14 @@ class MetadataPush extends EasCommand_1.default {
27
39
  analytics,
28
40
  nonInteractive: false,
29
41
  });
30
- const metadataCtx = await (0, context_2.createMetadataContextAsync)({
31
- credentialsCtx,
32
- analytics,
33
- projectDir,
34
- exp,
35
- profileName: flags.profile,
36
- });
37
42
  try {
38
- const { appleLink } = await (0, upload_1.uploadMetadataAsync)(metadataCtx);
43
+ const { appleLink } = await (0, upload_1.uploadMetadataAsync)({
44
+ analytics,
45
+ exp,
46
+ credentialsCtx,
47
+ projectDir,
48
+ profile: submitProfile,
49
+ });
39
50
  log_1.default.addNewLineIfNone();
40
51
  log_1.default.log(`🎉 Store configuration is synced with the app stores.
41
52
 
@@ -8,7 +8,7 @@ export default class EnvironmentSecretCreate extends EasCommand {
8
8
  scope: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentSecretScope>;
9
9
  name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
10
10
  value: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
11
- type: import("@oclif/core/lib/interfaces").OptionFlag<SecretType>;
11
+ type: import("@oclif/core/lib/interfaces").OptionFlag<SecretType | undefined>;
12
12
  force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
13
  };
14
14
  static contextDefinition: {
@@ -3,34 +3,19 @@ var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const tslib_1 = require("tslib");
5
5
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
- const cli_table3_1 = tslib_1.__importDefault(require("cli-table3"));
7
6
  const dateformat_1 = tslib_1.__importDefault(require("dateformat"));
8
7
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
9
8
  const EnvironmentSecretsQuery_1 = require("../../graphql/queries/EnvironmentSecretsQuery");
10
- const EnvironmentSecret_1 = require("../../graphql/types/EnvironmentSecret");
11
9
  const log_1 = tslib_1.__importDefault(require("../../log"));
10
+ const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields"));
12
11
  class EnvironmentSecretList extends EasCommand_1.default {
13
12
  async runAsync() {
14
13
  const { projectConfig: { projectId }, loggedIn: { graphqlClient }, } = await this.getContextAsync(EnvironmentSecretList, {
15
14
  nonInteractive: true,
16
15
  });
17
16
  const secrets = await EnvironmentSecretsQuery_1.EnvironmentSecretsQuery.allAsync(graphqlClient, projectId);
18
- const table = new cli_table3_1.default({
19
- head: ['Name', 'Type', 'Scope', 'ID', 'Updated at'],
20
- wordWrap: true,
21
- });
22
- for (const secret of secrets) {
23
- const { name, createdAt: updatedAt, scope, id, type } = secret;
24
- table.push([
25
- name,
26
- EnvironmentSecret_1.EnvironmentSecretTypeToSecretType[type],
27
- scope,
28
- id,
29
- (0, dateformat_1.default)(updatedAt, 'mmm dd HH:MM:ss'),
30
- ]);
31
- }
32
17
  log_1.default.log((0, chalk_1.default) `{bold Secrets for this account and project:}`);
33
- log_1.default.log(table.toString());
18
+ log_1.default.log(secrets.map(secret => formatSecret(secret)).join(`\n\n${chalk_1.default.dim('———')}\n\n`));
34
19
  }
35
20
  }
36
21
  exports.default = EnvironmentSecretList;
@@ -40,3 +25,13 @@ EnvironmentSecretList.contextDefinition = {
40
25
  ..._a.ContextOptions.ProjectConfig,
41
26
  ..._a.ContextOptions.LoggedIn,
42
27
  };
28
+ function formatSecret(secret) {
29
+ return (0, formatFields_1.default)([
30
+ { label: 'ID', value: secret.id },
31
+ { label: 'Name', value: secret.name },
32
+ { label: 'Scope', value: secret.scope },
33
+ { label: 'Type', value: secret.type },
34
+ // TODO: Figure out why do we name it updated, while it's created at?
35
+ { label: 'Updated at', value: (0, dateformat_1.default)(secret.createdAt, 'mmm dd HH:MM:ss') },
36
+ ]);
37
+ }
@@ -3,7 +3,7 @@ export default class Submit extends EasCommand {
3
3
  static description: string;
4
4
  static aliases: string[];
5
5
  static flags: {
6
- platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
6
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
7
7
  profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
8
8
  latest: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
9
  id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
@@ -2,6 +2,7 @@ import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class UpdateConfigure extends EasCommand {
3
3
  static description: string;
4
4
  static flags: {
5
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
5
6
  platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
6
7
  };
7
8
  static contextDefinition: {
@@ -2,59 +2,25 @@
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
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
5
  const core_1 = require("@oclif/core");
8
- const assert_1 = tslib_1.__importDefault(require("assert"));
9
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
10
- const api_1 = require("../../api");
11
6
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
12
- const generated_1 = require("../../graphql/generated");
13
- const log_1 = tslib_1.__importStar(require("../../log"));
14
- const platform_1 = require("../../platform");
15
- const projectUtils_1 = require("../../project/projectUtils");
16
- const workflow_1 = require("../../project/workflow");
17
- const UpdatesModule_1 = require("../../update/android/UpdatesModule");
18
- const UpdatesModule_2 = require("../../update/ios/UpdatesModule");
19
- const DEFAULT_MANAGED_RUNTIME_VERSION = { policy: 'sdkVersion' };
20
- const DEFAULT_BARE_RUNTIME_VERSION = '1.0.0';
7
+ const flags_1 = require("../../commandUtils/flags");
8
+ const log_1 = tslib_1.__importDefault(require("../../log"));
9
+ const configure_1 = require("../../update/configure");
21
10
  class UpdateConfigure extends EasCommand_1.default {
22
11
  async runAsync() {
23
- 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.');
24
12
  const { flags } = await this.parse(UpdateConfigure);
13
+ const platform = flags.platform;
25
14
  const { projectConfig: { projectId, exp, projectDir }, loggedIn: { graphqlClient }, } = await this.getContextAsync(UpdateConfigure, {
26
- nonInteractive: true,
15
+ nonInteractive: flags['non-interactive'],
27
16
  });
28
- const platform = flags.platform;
29
- if (!(0, projectUtils_1.isExpoUpdatesInstalledOrAvailable)(projectDir, exp.sdkVersion)) {
30
- await (0, projectUtils_1.installExpoUpdatesAsync)(projectDir);
31
- }
32
- const [androidWorkflow, iosWorkflow] = await Promise.all([
33
- (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.ANDROID),
34
- (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.IOS),
35
- ]);
36
- const updatedExp = await configureAppJSONForEASUpdateAsync({
37
- projectDir,
17
+ 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.');
18
+ await (0, configure_1.ensureEASUpdatesIsConfiguredAsync)(graphqlClient, {
38
19
  exp,
39
- platform,
40
- workflows: {
41
- android: androidWorkflow,
42
- ios: iosWorkflow,
43
- },
44
20
  projectId,
21
+ projectDir,
22
+ platform,
45
23
  });
46
- log_1.default.withTick(`Configured ${chalk_1.default.bold('app.json')} for EAS Update`);
47
- // configure native files for EAS Update
48
- if ([platform_1.RequestedPlatform.Android, platform_1.RequestedPlatform.All].includes(platform) &&
49
- androidWorkflow === eas_build_job_1.Workflow.GENERIC) {
50
- await (0, UpdatesModule_1.syncUpdatesConfigurationAsync)(graphqlClient, projectDir, updatedExp, projectId);
51
- log_1.default.withTick(`Configured ${chalk_1.default.bold('AndroidManifest.xml')} for EAS Update`);
52
- }
53
- if ([platform_1.RequestedPlatform.Ios, platform_1.RequestedPlatform.All].includes(platform) &&
54
- iosWorkflow === eas_build_job_1.Workflow.GENERIC) {
55
- await (0, UpdatesModule_2.syncUpdatesConfigurationAsync)(graphqlClient, projectDir, updatedExp, projectId);
56
- log_1.default.withTick(`Configured ${chalk_1.default.bold('Expo.plist')} for EAS Update`);
57
- }
58
24
  log_1.default.addNewLineIfNone();
59
25
  log_1.default.log(`🎉 Your app is configured to run EAS Update!`);
60
26
  }
@@ -69,181 +35,9 @@ UpdateConfigure.flags = {
69
35
  options: ['android', 'ios', 'all'],
70
36
  default: 'all',
71
37
  }),
38
+ ...flags_1.EASNonInteractiveFlag,
72
39
  };
73
40
  UpdateConfigure.contextDefinition = {
74
41
  ..._a.ContextOptions.ProjectConfig,
75
42
  ..._a.ContextOptions.LoggedIn,
76
43
  };
77
- async function configureAppJSONForEASUpdateAsync({ projectDir, exp, platform, workflows, projectId, }) {
78
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
79
- // this command is non-interactive in the way it was designed
80
- const easUpdateURL = (0, api_1.getEASUpdateURL)(projectId);
81
- const updates = { ...exp.updates, url: easUpdateURL };
82
- const androidDefaultRuntimeVersion = workflows['android'] === eas_build_job_1.Workflow.GENERIC
83
- ? DEFAULT_BARE_RUNTIME_VERSION
84
- : DEFAULT_MANAGED_RUNTIME_VERSION;
85
- const iosDefaultRuntimeVersion = workflows['ios'] === eas_build_job_1.Workflow.GENERIC
86
- ? DEFAULT_BARE_RUNTIME_VERSION
87
- : DEFAULT_MANAGED_RUNTIME_VERSION;
88
- const newAndroidRuntimeVersion = (_d = (_c = (_b = exp.android) === null || _b === void 0 ? void 0 : _b.runtimeVersion) !== null && _c !== void 0 ? _c : exp.runtimeVersion) !== null && _d !== void 0 ? _d : androidDefaultRuntimeVersion;
89
- const newIosRuntimeVersion = (_g = (_f = (_e = exp.ios) === null || _e === void 0 ? void 0 : _e.runtimeVersion) !== null && _f !== void 0 ? _f : exp.runtimeVersion) !== null && _g !== void 0 ? _g : iosDefaultRuntimeVersion;
90
- let newConfig;
91
- let newConfigOnlyAddedValues;
92
- switch (platform) {
93
- case platform_1.RequestedPlatform.All: {
94
- if (isRuntimeEqual(newAndroidRuntimeVersion, newIosRuntimeVersion)) {
95
- newConfig = {
96
- runtimeVersion: newAndroidRuntimeVersion,
97
- android: {
98
- ...exp.android,
99
- runtimeVersion: undefined,
100
- },
101
- ios: { ...exp.ios, runtimeVersion: undefined },
102
- updates,
103
- };
104
- newConfigOnlyAddedValues = {
105
- runtimeVersion: newAndroidRuntimeVersion,
106
- ...(exp.android && 'runtimeVersion' in exp.android
107
- ? {
108
- android: {
109
- runtimeVersion: '<remove this key>',
110
- },
111
- }
112
- : {}),
113
- ...(exp.ios && 'runtimeVersion' in exp.ios
114
- ? {
115
- ios: {
116
- runtimeVersion: '<remove this key>',
117
- },
118
- }
119
- : {}),
120
- updates: {
121
- url: easUpdateURL,
122
- },
123
- };
124
- }
125
- else {
126
- newConfig = {
127
- runtimeVersion: undefined,
128
- android: {
129
- ...exp.android,
130
- runtimeVersion: newAndroidRuntimeVersion,
131
- },
132
- ios: {
133
- ...exp.ios,
134
- runtimeVersion: newIosRuntimeVersion,
135
- },
136
- updates,
137
- };
138
- newConfigOnlyAddedValues = {
139
- ...('runtimeVersion' in exp
140
- ? {
141
- runtimeVersion: '<remove this key>', // top level runtime is redundant if it is specified in both android and ios
142
- }
143
- : {}),
144
- android: {
145
- runtimeVersion: newAndroidRuntimeVersion,
146
- },
147
- ios: {
148
- runtimeVersion: newIosRuntimeVersion,
149
- },
150
- updates: {
151
- url: easUpdateURL,
152
- },
153
- };
154
- }
155
- break;
156
- }
157
- case platform_1.RequestedPlatform.Android: {
158
- newConfig = {
159
- android: {
160
- ...exp.android,
161
- runtimeVersion: newAndroidRuntimeVersion,
162
- },
163
- updates,
164
- };
165
- newConfigOnlyAddedValues = {
166
- android: {
167
- runtimeVersion: newAndroidRuntimeVersion,
168
- },
169
- updates: {
170
- url: easUpdateURL,
171
- },
172
- };
173
- break;
174
- }
175
- case platform_1.RequestedPlatform.Ios: {
176
- newConfig = {
177
- ios: {
178
- ...exp.ios,
179
- runtimeVersion: newIosRuntimeVersion,
180
- },
181
- updates,
182
- };
183
- newConfigOnlyAddedValues = {
184
- ios: {
185
- runtimeVersion: newIosRuntimeVersion,
186
- },
187
- updates: {
188
- url: easUpdateURL,
189
- },
190
- };
191
- break;
192
- }
193
- default: {
194
- throw new Error(`Unsupported platform: ${platform}`);
195
- }
196
- }
197
- const result = await (0, config_1.modifyConfigAsync)(projectDir, newConfig);
198
- const preexistingAndroidRuntimeVersion = (_j = (_h = exp.android) === null || _h === void 0 ? void 0 : _h.runtimeVersion) !== null && _j !== void 0 ? _j : exp.runtimeVersion;
199
- const preexistingIosRuntimeVersion = (_l = (_k = exp.ios) === null || _k === void 0 ? void 0 : _k.runtimeVersion) !== null && _l !== void 0 ? _l : exp.runtimeVersion;
200
- switch (result.type) {
201
- case 'success':
202
- if ((_m = exp.updates) === null || _m === void 0 ? void 0 : _m.url) {
203
- if (exp.updates.url !== easUpdateURL) {
204
- log_1.default.withTick(`Overwrote "${(_o = exp.updates) === null || _o === void 0 ? void 0 : _o.url}" with "${easUpdateURL}" for the updates.url value in app.json`);
205
- }
206
- }
207
- else {
208
- log_1.default.withTick(`Set updates.url value, to "${easUpdateURL}" in app.json`);
209
- }
210
- if (!preexistingAndroidRuntimeVersion &&
211
- [platform_1.RequestedPlatform.Android, platform_1.RequestedPlatform.All].includes(platform)) {
212
- log_1.default.withTick(`Set ${platform_1.appPlatformDisplayNames[generated_1.AppPlatform.Android]} runtimeVersion to "${JSON.stringify((_q = (_p = newConfig.android) === null || _p === void 0 ? void 0 : _p.runtimeVersion) !== null && _q !== void 0 ? _q : newConfig.runtimeVersion)}" in app.json`);
213
- }
214
- if (!preexistingIosRuntimeVersion &&
215
- [platform_1.RequestedPlatform.Ios, platform_1.RequestedPlatform.All].includes(platform)) {
216
- log_1.default.withTick(`Set ${platform_1.appPlatformDisplayNames[generated_1.AppPlatform.Ios]} runtimeVersion to "${JSON.stringify((_s = (_r = newConfig.ios) === null || _r === void 0 ? void 0 : _r.runtimeVersion) !== null && _s !== void 0 ? _s : newConfig.runtimeVersion)}" in app.json`);
217
- }
218
- break;
219
- case 'warn': {
220
- log_1.default.addNewLineIfNone();
221
- 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)')}`);
222
- 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`);
223
- log_1.default.log(chalk_1.default.bold(JSON.stringify(newConfigOnlyAddedValues, null, 2)));
224
- log_1.default.addNewLineIfNone();
225
- if (workflows['android'] === eas_build_job_1.Workflow.GENERIC || workflows['ios'] === eas_build_job_1.Workflow.GENERIC) {
226
- log_1.default.warn(`You will also have to manually edit the projects ${chalk_1.default.bold('Expo.plist/AndroidManifest.xml')}. ${(0, log_1.learnMore)('https://expo.fyi/eas-update-config.md#native-configuration')}`);
227
- }
228
- log_1.default.addNewLineIfNone();
229
- throw new Error(result.message);
230
- }
231
- case 'fail':
232
- throw new Error(result.message);
233
- default:
234
- throw new Error('Unexpected result type from modifyConfigAsync');
235
- }
236
- (0, assert_1.default)(result.config, 'A successful result should have a config');
237
- return result.config.expo;
238
- }
239
- function isRuntimeEqual(runtimeVersionA, runtimeVersionB) {
240
- if (typeof runtimeVersionA === 'string' && typeof runtimeVersionB === 'string') {
241
- return runtimeVersionA === runtimeVersionB;
242
- }
243
- else if (typeof runtimeVersionA === 'object' && typeof runtimeVersionB === 'object') {
244
- return runtimeVersionA.policy === runtimeVersionB.policy;
245
- }
246
- else {
247
- return false;
248
- }
249
- }
@@ -1,12 +1,6 @@
1
+ import { Platform as PublishPlatform } from '@expo/config';
1
2
  import EasCommand from '../../commandUtils/EasCommand';
2
- import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
3
- import { ViewBranchQueryVariables } from '../../graphql/generated';
4
- import { PublishPlatform } from '../../project/publish';
5
- export declare const defaultPublishPlatforms: PublishPlatform[];
6
- export declare type PublishPlatformFlag = PublishPlatform | 'all';
7
- export declare function ensureBranchExistsAsync(graphqlClient: ExpoGraphqlClient, { appId, name: branchName }: ViewBranchQueryVariables): Promise<{
8
- branchId: string;
9
- }>;
3
+ export declare const defaultPublishPlatforms: Partial<PublishPlatform>[];
10
4
  export default class UpdatePublish extends EasCommand {
11
5
  static description: string;
12
6
  static flags: {
@@ -27,5 +21,5 @@ export default class UpdatePublish extends EasCommand {
27
21
  getDynamicProjectConfigAsync: import("../../commandUtils/context/DynamicProjectConfigContextField").DynamicProjectConfigContextField;
28
22
  };
29
23
  runAsync(): Promise<void>;
24
+ private sanitizeFlags;
30
25
  }
31
- export declare const truncatePublishUpdateMessage: (originalMessage: string) => string;