eas-cli 0.41.1 → 0.44.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 (113) hide show
  1. package/README.md +313 -157
  2. package/bin/dev +17 -0
  3. package/bin/dev.cmd +3 -0
  4. package/bin/run +3 -3
  5. package/build/build/android/UpdatesModule.d.ts +0 -1
  6. package/build/build/android/UpdatesModule.js +4 -37
  7. package/build/build/android/build.js +3 -3
  8. package/build/build/android/{configure.d.ts → syncProjectConfiguration.d.ts} +2 -3
  9. package/build/build/android/{configure.js → syncProjectConfiguration.js} +22 -23
  10. package/build/build/build.d.ts +1 -1
  11. package/build/build/build.js +6 -8
  12. package/build/build/configure.d.ts +12 -7
  13. package/build/build/configure.js +25 -99
  14. package/build/build/context.d.ts +0 -12
  15. package/build/build/createContext.d.ts +1 -2
  16. package/build/build/createContext.js +1 -2
  17. package/build/build/ios/UpdatesModule.d.ts +0 -1
  18. package/build/build/ios/UpdatesModule.js +8 -39
  19. package/build/build/ios/build.js +3 -3
  20. package/build/build/ios/{configure.d.ts → syncProjectConfiguration.d.ts} +1 -3
  21. package/build/build/ios/{configure.js → syncProjectConfiguration.js} +3 -18
  22. package/build/build/local.d.ts +1 -0
  23. package/build/build/local.js +2 -1
  24. package/build/build/runBuildAndSubmit.d.ts +0 -1
  25. package/build/build/runBuildAndSubmit.js +4 -2
  26. package/build/build/utils/devClient.js +3 -3
  27. package/build/commandUtils/EasCommand.d.ts +2 -1
  28. package/build/commandUtils/EasCommand.js +7 -4
  29. package/build/commands/account/login.d.ts +1 -0
  30. package/build/commands/account/login.js +1 -0
  31. package/build/commands/account/logout.d.ts +1 -0
  32. package/build/commands/account/logout.js +1 -0
  33. package/build/commands/account/view.d.ts +1 -0
  34. package/build/commands/account/view.js +1 -0
  35. package/build/commands/analytics.js +1 -1
  36. package/build/commands/branch/create.d.ts +1 -1
  37. package/build/commands/branch/create.js +11 -6
  38. package/build/commands/branch/delete.d.ts +1 -1
  39. package/build/commands/branch/delete.js +11 -5
  40. package/build/commands/branch/list.d.ts +1 -1
  41. package/build/commands/branch/list.js +8 -4
  42. package/build/commands/branch/rename.d.ts +3 -4
  43. package/build/commands/branch/rename.js +13 -8
  44. package/build/commands/branch/view.d.ts +1 -3
  45. package/build/commands/branch/view.js +35 -74
  46. package/build/commands/build/cancel.js +1 -1
  47. package/build/commands/build/configure.d.ts +1 -2
  48. package/build/commands/build/configure.js +38 -28
  49. package/build/commands/build/index.d.ts +12 -12
  50. package/build/commands/build/index.js +32 -21
  51. package/build/commands/build/inspect.d.ts +7 -7
  52. package/build/commands/build/inspect.js +31 -25
  53. package/build/commands/build/list.d.ts +13 -14
  54. package/build/commands/build/list.js +15 -15
  55. package/build/commands/build/view.d.ts +1 -1
  56. package/build/commands/build/view.js +3 -3
  57. package/build/commands/channel/create.d.ts +1 -1
  58. package/build/commands/channel/create.js +24 -19
  59. package/build/commands/channel/delete.d.ts +15 -0
  60. package/build/commands/channel/delete.js +124 -0
  61. package/build/commands/channel/edit.d.ts +2 -3
  62. package/build/commands/channel/edit.js +14 -9
  63. package/build/commands/channel/list.d.ts +1 -1
  64. package/build/commands/channel/list.js +17 -12
  65. package/build/commands/channel/rollout.d.ts +4 -5
  66. package/build/commands/channel/rollout.js +14 -10
  67. package/build/commands/channel/view.d.ts +1 -1
  68. package/build/commands/channel/view.js +19 -14
  69. package/build/commands/config.d.ts +2 -3
  70. package/build/commands/config.js +4 -4
  71. package/build/commands/device/list.d.ts +1 -2
  72. package/build/commands/device/list.js +3 -3
  73. package/build/commands/device/view.js +1 -1
  74. package/build/commands/secret/create.d.ts +4 -5
  75. package/build/commands/secret/create.js +6 -6
  76. package/build/commands/secret/delete.d.ts +1 -2
  77. package/build/commands/secret/delete.js +3 -3
  78. package/build/commands/submit.d.ts +9 -10
  79. package/build/commands/submit.js +13 -14
  80. package/build/commands/update/configure.js +1 -1
  81. package/build/commands/update/delete.d.ts +1 -1
  82. package/build/commands/update/delete.js +12 -7
  83. package/build/commands/update/index.d.ts +9 -10
  84. package/build/commands/update/index.js +29 -17
  85. package/build/commands/update/list.d.ts +10 -0
  86. package/build/commands/update/list.js +114 -0
  87. package/build/commands/update/view.d.ts +1 -1
  88. package/build/commands/update/view.js +25 -20
  89. package/build/commands/webhook/create.d.ts +3 -4
  90. package/build/commands/webhook/create.js +5 -5
  91. package/build/commands/webhook/delete.js +1 -1
  92. package/build/commands/webhook/list.d.ts +1 -2
  93. package/build/commands/webhook/list.js +3 -3
  94. package/build/commands/webhook/update.d.ts +4 -5
  95. package/build/commands/webhook/update.js +6 -6
  96. package/build/commands/webhook/view.js +1 -1
  97. package/build/credentials/ios/appstore/bundleIdCapabilities.js +0 -2
  98. package/build/credentials/ios/appstore/ensureAppExists.js +3 -1
  99. package/build/graphql/generated.d.ts +92 -30
  100. package/build/graphql/queries/UpdateQuery.d.ts +7 -0
  101. package/build/graphql/queries/UpdateQuery.js +85 -0
  102. package/build/index.d.ts +1 -1
  103. package/build/index.js +2 -2
  104. package/build/project/expoSdk.js +2 -2
  105. package/build/project/metroConfig.js +2 -2
  106. package/build/project/publish.js +1 -3
  107. package/build/user/actions.js +2 -2
  108. package/build/utils/expoCli.d.ts +3 -1
  109. package/build/utils/expoCli.js +13 -11
  110. package/build/vcs/clients/git.js +2 -2
  111. package/build/vcs/local.js +5 -1
  112. package/oclif.manifest.json +1 -1
  113. package/package.json +21 -14
@@ -4,6 +4,7 @@ export interface LocalBuildOptions {
4
4
  skipCleanup?: boolean;
5
5
  skipNativeBuild?: boolean;
6
6
  artifactsDir?: string;
7
+ artifactPath?: string;
7
8
  workingdir?: string;
8
9
  verbose?: boolean;
9
10
  }
@@ -6,7 +6,7 @@ const spawn_async_1 = (0, tslib_1.__importDefault)(require("@expo/spawn-async"))
6
6
  const semver_1 = (0, tslib_1.__importDefault)(require("semver"));
7
7
  const ora_1 = require("../ora");
8
8
  const PLUGIN_PACKAGE_NAME = 'eas-cli-local-build-plugin';
9
- const PLUGIN_PACKAGE_VERSION = '0.0.56';
9
+ const PLUGIN_PACKAGE_VERSION = '0.0.58';
10
10
  async function runLocalBuildAsync(job, options) {
11
11
  var _a;
12
12
  const { command, args } = await getCommandAndArgsAsync(job);
@@ -32,6 +32,7 @@ async function runLocalBuildAsync(job, options) {
32
32
  : {}),
33
33
  ...(options.skipNativeBuild ? { EAS_LOCAL_BUILD_SKIP_NATIVE_BUILD: '1' } : {}),
34
34
  ...(options.artifactsDir ? { EAS_LOCAL_BUILD_ARTIFACTS_DIR: options.artifactsDir } : {}),
35
+ ...(options.artifactPath ? { EAS_LOCAL_BUILD_ARTIFACT_PATH: options.artifactPath } : {}),
35
36
  },
36
37
  });
37
38
  childProcess = spawnPromise.child;
@@ -2,7 +2,6 @@ import { RequestedPlatform } from '../platform';
2
2
  import { LocalBuildOptions } from './local';
3
3
  export interface BuildFlags {
4
4
  requestedPlatform: RequestedPlatform;
5
- skipProjectConfiguration: boolean;
6
5
  profile?: string;
7
6
  nonInteractive: boolean;
8
7
  wait: boolean;
@@ -30,7 +30,10 @@ async function runBuildAndSubmitAsync(projectDir, flags) {
30
30
  var _a;
31
31
  await (0, vcs_1.getVcsClient)().ensureRepoExistsAsync();
32
32
  await (0, repository_1.ensureRepoIsCleanAsync)(flags.nonInteractive);
33
- await (0, configure_1.ensureProjectConfiguredAsync)(projectDir, flags.requestedPlatform);
33
+ await (0, configure_1.ensureProjectConfiguredAsync)({
34
+ projectDir,
35
+ nonInteractive: flags.nonInteractive,
36
+ });
34
37
  const platforms = (0, platform_1.toPlatforms)(flags.requestedPlatform);
35
38
  const buildProfiles = await (0, profiles_1.getProfilesAsync)({
36
39
  type: 'build',
@@ -111,7 +114,6 @@ async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildP
111
114
  nonInteractive: flags.nonInteractive,
112
115
  platform: buildProfile.platform,
113
116
  projectDir,
114
- skipProjectConfiguration: flags.skipProjectConfiguration,
115
117
  localBuildOptions: flags.localBuildOptions,
116
118
  });
117
119
  if (moreBuilds) {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ensureExpoDevClientInstalledForDevClientBuildsAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const eas_build_job_1 = require("@expo/eas-build-job");
6
- const errors_1 = require("@oclif/errors");
6
+ const core_1 = require("@oclif/core");
7
7
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
8
8
  const resolve_from_1 = (0, tslib_1.__importDefault)(require("resolve-from"));
9
9
  const AppPlatform_1 = require("../../graphql/types/AppPlatform");
@@ -40,7 +40,7 @@ async function ensureExpoDevClientInstalledForDevClientBuildsAsync({ projectDir,
40
40
  await installExpoDevClientAsync(projectDir, { nonInteractive });
41
41
  }
42
42
  else {
43
- (0, errors_1.error)(`Install ${chalk_1.default.bold('expo-dev-client')} manually and come back later.`, {
43
+ core_1.Errors.error(`Install ${chalk_1.default.bold('expo-dev-client')} manually and come back later.`, {
44
44
  exit: 1,
45
45
  });
46
46
  }
@@ -58,7 +58,7 @@ async function ensureExpoDevClientInstalledForDevClientBuildsAsync({ projectDir,
58
58
  initial: false,
59
59
  });
60
60
  if (!shouldContinue) {
61
- (0, errors_1.error)('Come back later', { exit: 1 });
61
+ core_1.Errors.error('Come back later', { exit: 1 });
62
62
  }
63
63
  }
64
64
  }
@@ -1,10 +1,11 @@
1
- import { Command } from '@oclif/command';
1
+ import { Command } from '@oclif/core';
2
2
  export default abstract class EasCommand extends Command {
3
3
  /**
4
4
  * When user data is unavailable locally, determines if the command will
5
5
  * force the user to log in
6
6
  */
7
7
  protected requiresAuthentication: boolean;
8
+ protected mustBeRunInsideProject: boolean;
8
9
  protected abstract runAsync(): Promise<any>;
9
10
  run(): Promise<any>;
10
11
  finally(err: Error): Promise<any>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const eas_json_1 = require("@expo/eas-json");
5
- const command_1 = require("@oclif/command");
5
+ const core_1 = require("@oclif/core");
6
6
  const semver_1 = (0, tslib_1.__importDefault)(require("semver"));
7
7
  const rudderstackClient_1 = require("../analytics/rudderstackClient");
8
8
  const projectUtils_1 = require("../project/projectUtils");
@@ -11,7 +11,7 @@ const actions_1 = require("../user/actions");
11
11
  const easCli_1 = require("../utils/easCli");
12
12
  const vcs_1 = require("../vcs");
13
13
  const git_1 = (0, tslib_1.__importDefault)(require("../vcs/clients/git"));
14
- class EasCommand extends command_1.Command {
14
+ class EasCommand extends core_1.Command {
15
15
  constructor() {
16
16
  super(...arguments);
17
17
  /**
@@ -19,14 +19,17 @@ class EasCommand extends command_1.Command {
19
19
  * force the user to log in
20
20
  */
21
21
  this.requiresAuthentication = true;
22
+ this.mustBeRunInsideProject = true;
22
23
  }
23
24
  // eslint-disable-next-line async-protect/async-suffix
24
25
  async run() {
25
26
  var _a;
26
27
  await (0, rudderstackClient_1.initAsync)();
27
- await this.applyCliConfigAsync();
28
+ if (this.mustBeRunInsideProject) {
29
+ await this.applyCliConfigAsync();
30
+ }
28
31
  if (this.requiresAuthentication) {
29
- const { flags } = this.parse();
32
+ const { flags } = await this.parse();
30
33
  const nonInteractive = (_a = flags['non-interactive']) !== null && _a !== void 0 ? _a : false;
31
34
  await (0, actions_1.ensureLoggedInAsync)({ nonInteractive });
32
35
  }
@@ -2,6 +2,7 @@ import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class AccountLogin extends EasCommand {
3
3
  static description: string;
4
4
  static aliases: string[];
5
+ protected mustBeRunInsideProject: boolean;
5
6
  protected requiresAuthentication: boolean;
6
7
  runAsync(): Promise<void>;
7
8
  }
@@ -7,6 +7,7 @@ const actions_1 = require("../../user/actions");
7
7
  class AccountLogin extends EasCommand_1.default {
8
8
  constructor() {
9
9
  super(...arguments);
10
+ this.mustBeRunInsideProject = false;
10
11
  this.requiresAuthentication = false;
11
12
  }
12
13
  async runAsync() {
@@ -2,6 +2,7 @@ import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class AccountLogout extends EasCommand {
3
3
  static description: string;
4
4
  static aliases: string[];
5
+ protected mustBeRunInsideProject: boolean;
5
6
  protected requiresAuthentication: boolean;
6
7
  runAsync(): Promise<void>;
7
8
  }
@@ -7,6 +7,7 @@ const User_1 = require("../../user/User");
7
7
  class AccountLogout extends EasCommand_1.default {
8
8
  constructor() {
9
9
  super(...arguments);
10
+ this.mustBeRunInsideProject = false;
10
11
  this.requiresAuthentication = false;
11
12
  }
12
13
  async runAsync() {
@@ -2,6 +2,7 @@ import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class AccountView extends EasCommand {
3
3
  static description: string;
4
4
  static aliases: string[];
5
+ protected mustBeRunInsideProject: boolean;
5
6
  protected requiresAuthentication: boolean;
6
7
  runAsync(): Promise<void>;
7
8
  }
@@ -8,6 +8,7 @@ const User_1 = require("../../user/User");
8
8
  class AccountView extends EasCommand_1.default {
9
9
  constructor() {
10
10
  super(...arguments);
11
+ this.mustBeRunInsideProject = false;
11
12
  this.requiresAuthentication = false;
12
13
  }
13
14
  async runAsync() {
@@ -10,7 +10,7 @@ class AnalyticsView extends EasCommand_1.default {
10
10
  this.requiresAuthentication = false;
11
11
  }
12
12
  async runAsync() {
13
- const { STATUS: status } = this.parse(AnalyticsView).args;
13
+ const { STATUS: status } = (await this.parse(AnalyticsView)).args;
14
14
  if (status) {
15
15
  await UserSettings_1.default.setAsync('analyticsEnabled', status === 'on');
16
16
  log_1.default.withTick(`${status === 'on' ? 'Enabling' : 'Disabling'} analytics.`);
@@ -9,7 +9,7 @@ export default class BranchCreate extends EasCommand {
9
9
  description: string;
10
10
  }[];
11
11
  static flags: {
12
- json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
12
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
13
  };
14
14
  runAsync(): Promise<void>;
15
15
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createUpdateBranchOnAppAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const config_1 = require("@expo/config");
6
- const command_1 = require("@oclif/command");
6
+ const core_1 = require("@oclif/core");
7
7
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
8
8
  const graphql_tag_1 = (0, tslib_1.__importDefault)(require("graphql-tag"));
9
9
  const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
@@ -11,6 +11,7 @@ const client_1 = require("../../graphql/client");
11
11
  const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
12
12
  const projectUtils_1 = require("../../project/projectUtils");
13
13
  const prompts_1 = require("../../prompts");
14
+ const json_1 = require("../../utils/json");
14
15
  const vcs_1 = require("../../vcs");
15
16
  async function createUpdateBranchOnAppAsync({ appId, name, }) {
16
17
  const result = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
@@ -37,7 +38,10 @@ async function createUpdateBranchOnAppAsync({ appId, name, }) {
37
38
  exports.createUpdateBranchOnAppAsync = createUpdateBranchOnAppAsync;
38
39
  class BranchCreate extends EasCommand_1.default {
39
40
  async runAsync() {
40
- let { args: { name }, flags, } = this.parse(BranchCreate);
41
+ let { args: { name }, flags, } = await this.parse(BranchCreate);
42
+ if (flags.json) {
43
+ (0, json_1.enableJsonOutput)();
44
+ }
41
45
  const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
42
46
  const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
43
47
  const fullName = await (0, projectUtils_1.getProjectFullNameAsync)(exp);
@@ -58,10 +62,11 @@ class BranchCreate extends EasCommand_1.default {
58
62
  }
59
63
  const newBranch = await createUpdateBranchOnAppAsync({ appId: projectId, name });
60
64
  if (flags.json) {
61
- log_1.default.log(newBranch);
62
- return;
65
+ (0, json_1.printJsonOnlyOutput)(newBranch);
66
+ }
67
+ else {
68
+ log_1.default.withTick(`️Created a new branch: ${chalk_1.default.bold(newBranch.name)} on project ${chalk_1.default.bold(fullName)}.`);
63
69
  }
64
- log_1.default.withTick(`️Created a new branch: ${chalk_1.default.bold(newBranch.name)} on project ${chalk_1.default.bold(fullName)}.`);
65
70
  }
66
71
  }
67
72
  exports.default = BranchCreate;
@@ -74,7 +79,7 @@ BranchCreate.args = [
74
79
  },
75
80
  ];
76
81
  BranchCreate.flags = {
77
- json: command_1.flags.boolean({
82
+ json: core_1.Flags.boolean({
78
83
  description: 'return a json with the new branch ID and name.',
79
84
  default: false,
80
85
  }),
@@ -7,7 +7,7 @@ export default class BranchDelete extends EasCommand {
7
7
  description: string;
8
8
  }[];
9
9
  static flags: {
10
- json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
10
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
11
  };
12
12
  runAsync(): Promise<void>;
13
13
  }
@@ -2,7 +2,7 @@
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 command_1 = require("@oclif/command");
5
+ const core_1 = require("@oclif/core");
6
6
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
7
7
  const graphql_tag_1 = (0, tslib_1.__importDefault)(require("graphql-tag"));
8
8
  const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
@@ -10,6 +10,7 @@ const client_1 = require("../../graphql/client");
10
10
  const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
11
11
  const projectUtils_1 = require("../../project/projectUtils");
12
12
  const prompts_1 = require("../../prompts");
13
+ const json_1 = require("../../utils/json");
13
14
  async function getBranchInfoAsync({ appId, name, }) {
14
15
  const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
15
16
  .query((0, graphql_tag_1.default) `
@@ -50,7 +51,10 @@ async function deleteBranchOnAppAsync({ branchId, }) {
50
51
  class BranchDelete extends EasCommand_1.default {
51
52
  async runAsync() {
52
53
  var _a, _b;
53
- let { args: { name }, flags: { json: jsonFlag }, } = this.parse(BranchDelete);
54
+ let { args: { name }, flags: { json: jsonFlag }, } = await this.parse(BranchDelete);
55
+ if (jsonFlag) {
56
+ (0, json_1.enableJsonOutput)();
57
+ }
54
58
  const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
55
59
  const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
56
60
  const fullName = await (0, projectUtils_1.getProjectFullNameAsync)(exp);
@@ -87,9 +91,11 @@ class BranchDelete extends EasCommand_1.default {
87
91
  branchId,
88
92
  });
89
93
  if (jsonFlag) {
90
- log_1.default.log(JSON.stringify(deletionResult));
94
+ (0, json_1.printJsonOnlyOutput)(deletionResult);
95
+ }
96
+ else {
97
+ log_1.default.withTick(`️Deleted branch "${name}" and all of its updates on project ${chalk_1.default.bold(fullName)}.`);
91
98
  }
92
- log_1.default.withTick(`️Deleted branch "${name}" and all of its updates on project ${chalk_1.default.bold(fullName)}.`);
93
99
  }
94
100
  }
95
101
  exports.default = BranchDelete;
@@ -102,7 +108,7 @@ BranchDelete.args = [
102
108
  },
103
109
  ];
104
110
  BranchDelete.flags = {
105
- json: command_1.flags.boolean({
111
+ json: core_1.Flags.boolean({
106
112
  description: `return JSON with the edited branch's ID and name.`,
107
113
  default: false,
108
114
  }),
@@ -6,7 +6,7 @@ export declare function listBranchesAsync({ projectId, }: {
6
6
  export default class BranchList extends EasCommand {
7
7
  static description: string;
8
8
  static flags: {
9
- json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
9
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
10
  };
11
11
  runAsync(): Promise<void>;
12
12
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.listBranchesAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const config_1 = require("@expo/config");
6
- const command_1 = require("@oclif/command");
6
+ const core_1 = require("@oclif/core");
7
7
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
8
8
  const cli_table3_1 = (0, tslib_1.__importDefault)(require("cli-table3"));
9
9
  const graphql_1 = require("graphql");
@@ -14,6 +14,7 @@ const UpdateBranch_1 = require("../../graphql/types/UpdateBranch");
14
14
  const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
15
15
  const projectUtils_1 = require("../../project/projectUtils");
16
16
  const utils_1 = require("../../update/utils");
17
+ const json_1 = require("../../utils/json");
17
18
  const BRANCHES_LIMIT = 10000;
18
19
  async function listBranchesAsync({ projectId, }) {
19
20
  var _a, _b;
@@ -41,13 +42,16 @@ async function listBranchesAsync({ projectId, }) {
41
42
  exports.listBranchesAsync = listBranchesAsync;
42
43
  class BranchList extends EasCommand_1.default {
43
44
  async runAsync() {
44
- const { flags } = this.parse(BranchList);
45
+ const { flags } = await this.parse(BranchList);
46
+ if (flags.json) {
47
+ (0, json_1.enableJsonOutput)();
48
+ }
45
49
  const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
46
50
  const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
47
51
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
48
52
  const branches = await listBranchesAsync({ projectId });
49
53
  if (flags.json) {
50
- log_1.default.log(JSON.stringify(branches, null, 2));
54
+ (0, json_1.printJsonOnlyOutput)(branches);
51
55
  }
52
56
  else {
53
57
  const table = new cli_table3_1.default({
@@ -79,7 +83,7 @@ class BranchList extends EasCommand_1.default {
79
83
  exports.default = BranchList;
80
84
  BranchList.description = 'List all branches on this project.';
81
85
  BranchList.flags = {
82
- json: command_1.flags.boolean({
86
+ json: core_1.Flags.boolean({
83
87
  description: 'return output as JSON',
84
88
  default: false,
85
89
  }),
@@ -1,11 +1,10 @@
1
- import { flags } from '@oclif/command';
2
1
  import EasCommand from '../../commandUtils/EasCommand';
3
2
  export default class BranchRename extends EasCommand {
4
3
  static description: string;
5
4
  static flags: {
6
- from: flags.IOptionFlag<string | undefined>;
7
- to: flags.IOptionFlag<string | undefined>;
8
- json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
5
+ from: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
6
+ to: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
7
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
8
  };
10
9
  runAsync(): Promise<void>;
11
10
  }
@@ -2,7 +2,7 @@
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 command_1 = require("@oclif/command");
5
+ const core_1 = require("@oclif/core");
6
6
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
7
7
  const graphql_tag_1 = (0, tslib_1.__importDefault)(require("graphql-tag"));
8
8
  const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
@@ -10,6 +10,7 @@ const client_1 = require("../../graphql/client");
10
10
  const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
11
11
  const projectUtils_1 = require("../../project/projectUtils");
12
12
  const prompts_1 = require("../../prompts");
13
+ const json_1 = require("../../utils/json");
13
14
  async function renameUpdateBranchOnAppAsync({ appId, name, newName, }) {
14
15
  const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
15
16
  .mutation((0, graphql_tag_1.default) `
@@ -33,7 +34,10 @@ async function renameUpdateBranchOnAppAsync({ appId, name, newName, }) {
33
34
  }
34
35
  class BranchRename extends EasCommand_1.default {
35
36
  async runAsync() {
36
- let { flags: { json: jsonFlag, from: currentName, to: newName }, } = this.parse(BranchRename);
37
+ let { flags: { json: jsonFlag, from: currentName, to: newName }, } = await this.parse(BranchRename);
38
+ if (jsonFlag) {
39
+ (0, json_1.enableJsonOutput)();
40
+ }
37
41
  const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
38
42
  const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
39
43
  const fullName = await (0, projectUtils_1.getProjectFullNameAsync)(exp);
@@ -68,24 +72,25 @@ class BranchRename extends EasCommand_1.default {
68
72
  newName: newName,
69
73
  });
70
74
  if (jsonFlag) {
71
- log_1.default.log(JSON.stringify(editedBranch));
72
- return;
75
+ (0, json_1.printJsonOnlyOutput)(editedBranch);
76
+ }
77
+ else {
78
+ log_1.default.withTick(`️Renamed branch from ${currentName} to ${chalk_1.default.bold(editedBranch.name)} on project ${chalk_1.default.bold(fullName)}.`);
73
79
  }
74
- log_1.default.withTick(`️Renamed branch from ${currentName} to ${chalk_1.default.bold(editedBranch.name)} on project ${chalk_1.default.bold(fullName)}.`);
75
80
  }
76
81
  }
77
82
  exports.default = BranchRename;
78
83
  BranchRename.description = 'Rename a branch.';
79
84
  BranchRename.flags = {
80
- from: command_1.flags.string({
85
+ from: core_1.Flags.string({
81
86
  description: 'current name of the branch.',
82
87
  required: false,
83
88
  }),
84
- to: command_1.flags.string({
89
+ to: core_1.Flags.string({
85
90
  description: 'new name of the branch.',
86
91
  required: false,
87
92
  }),
88
- json: command_1.flags.boolean({
93
+ json: core_1.Flags.boolean({
89
94
  description: `return a json with the edited branch's ID and name.`,
90
95
  default: false,
91
96
  }),
@@ -1,6 +1,4 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
- import { ViewBranchQuery, ViewBranchQueryVariables } from '../../graphql/generated';
3
- export declare function viewUpdateBranchAsync({ appId, name, }: Pick<ViewBranchQueryVariables, 'appId' | 'name'>): Promise<ViewBranchQuery>;
4
2
  export default class BranchView extends EasCommand {
5
3
  static description: string;
6
4
  static args: {
@@ -9,7 +7,7 @@ export default class BranchView extends EasCommand {
9
7
  description: string;
10
8
  }[];
11
9
  static flags: {
12
- json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
10
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
11
  };
14
12
  runAsync(): Promise<void>;
15
13
  }
@@ -1,65 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.viewUpdateBranchAsync = void 0;
4
3
  const tslib_1 = require("tslib");
5
4
  const config_1 = require("@expo/config");
6
- const command_1 = require("@oclif/command");
5
+ const core_1 = require("@oclif/core");
7
6
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
8
7
  const cli_table3_1 = (0, tslib_1.__importDefault)(require("cli-table3"));
9
- const graphql_tag_1 = (0, tslib_1.__importDefault)(require("graphql-tag"));
10
8
  const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
11
- const client_1 = require("../../graphql/client");
9
+ const UpdateQuery_1 = require("../../graphql/queries/UpdateQuery");
12
10
  const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
13
11
  const projectUtils_1 = require("../../project/projectUtils");
14
12
  const prompts_1 = require("../../prompts");
15
13
  const utils_1 = require("../../update/utils");
16
14
  const groupBy_1 = (0, tslib_1.__importDefault)(require("../../utils/expodash/groupBy"));
17
15
  const formatFields_1 = (0, tslib_1.__importDefault)(require("../../utils/formatFields"));
18
- const PAGE_LIMIT = 10000;
19
- async function viewUpdateBranchAsync({ appId, name, }) {
20
- const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
21
- .query((0, graphql_tag_1.default) `
22
- query ViewBranch($appId: String!, $name: String!, $limit: Int!) {
23
- app {
24
- byId(appId: $appId) {
25
- id
26
- updateBranchByName(name: $name) {
27
- id
28
- name
29
- updates(offset: 0, limit: $limit) {
30
- id
31
- group
32
- message
33
- createdAt
34
- runtimeVersion
35
- platform
36
- manifestFragment
37
- actor {
38
- id
39
- ... on User {
40
- username
41
- }
42
- ... on Robot {
43
- firstName
44
- }
45
- }
46
- }
47
- }
48
- }
49
- }
50
- }
51
- `, {
52
- appId,
53
- name,
54
- limit: PAGE_LIMIT,
55
- }, { additionalTypenames: ['UpdateBranch', 'Update'] })
56
- .toPromise());
57
- return data;
58
- }
59
- exports.viewUpdateBranchAsync = viewUpdateBranchAsync;
16
+ const json_1 = require("../../utils/json");
60
17
  class BranchView extends EasCommand_1.default {
61
18
  async runAsync() {
62
- let { args: { name }, flags: { json: jsonFlag }, } = this.parse(BranchView);
19
+ let { args: { name }, flags: { json: jsonFlag }, } = await this.parse(BranchView);
20
+ if (jsonFlag) {
21
+ (0, json_1.enableJsonOutput)();
22
+ }
63
23
  const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
64
24
  const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
65
25
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
@@ -75,7 +35,7 @@ class BranchView extends EasCommand_1.default {
75
35
  validate: value => (value ? true : validationMessage),
76
36
  }));
77
37
  }
78
- const { app } = await viewUpdateBranchAsync({
38
+ const { app } = await UpdateQuery_1.UpdateQuery.viewBranchAsync({
79
39
  appId: projectId,
80
40
  name,
81
41
  });
@@ -85,33 +45,34 @@ class BranchView extends EasCommand_1.default {
85
45
  }
86
46
  const updates = Object.values((0, groupBy_1.default)(UpdateBranch.updates, u => u.group)).map(group => group[0]);
87
47
  if (jsonFlag) {
88
- log_1.default.log(JSON.stringify({ ...UpdateBranch, updates }));
89
- return;
48
+ (0, json_1.printJsonOnlyOutput)({ ...UpdateBranch, updates });
90
49
  }
91
- const groupTable = new cli_table3_1.default({
92
- head: utils_1.UPDATE_COLUMNS,
93
- wordWrap: true,
94
- });
95
- for (const update of updates) {
96
- groupTable.push([
97
- (0, utils_1.formatUpdate)(update),
98
- update.runtimeVersion,
99
- update.group,
100
- (0, utils_1.getPlatformsForGroup)({
101
- updates: UpdateBranch.updates,
102
- group: update.group,
103
- }),
104
- ]);
50
+ else {
51
+ const groupTable = new cli_table3_1.default({
52
+ head: utils_1.UPDATE_COLUMNS,
53
+ wordWrap: true,
54
+ });
55
+ for (const update of updates) {
56
+ groupTable.push([
57
+ (0, utils_1.formatUpdate)(update),
58
+ update.runtimeVersion,
59
+ update.group,
60
+ (0, utils_1.getPlatformsForGroup)({
61
+ updates: UpdateBranch.updates,
62
+ group: update.group,
63
+ }),
64
+ ]);
65
+ }
66
+ log_1.default.addNewLineIfNone();
67
+ log_1.default.log(chalk_1.default.bold('Branch:'));
68
+ log_1.default.log((0, formatFields_1.default)([
69
+ { label: 'Name', value: UpdateBranch.name },
70
+ { label: 'ID', value: UpdateBranch.id },
71
+ ]));
72
+ log_1.default.addNewLineIfNone();
73
+ log_1.default.log(chalk_1.default.bold('Recently published update groups:'));
74
+ log_1.default.log(groupTable.toString());
105
75
  }
106
- log_1.default.addNewLineIfNone();
107
- log_1.default.log(chalk_1.default.bold('Branch:'));
108
- log_1.default.log((0, formatFields_1.default)([
109
- { label: 'Name', value: UpdateBranch.name },
110
- { label: 'ID', value: UpdateBranch.id },
111
- ]));
112
- log_1.default.addNewLineIfNone();
113
- log_1.default.log(chalk_1.default.bold('Recently published update groups:'));
114
- log_1.default.log(groupTable.toString());
115
76
  }
116
77
  }
117
78
  exports.default = BranchView;
@@ -124,7 +85,7 @@ BranchView.args = [
124
85
  },
125
86
  ];
126
87
  BranchView.flags = {
127
- json: command_1.flags.boolean({
88
+ json: core_1.Flags.boolean({
128
89
  description: `return a json with the branch's ID name and recent update groups.`,
129
90
  default: false,
130
91
  }),
@@ -90,7 +90,7 @@ async function ensureBuildExistsAsync(buildId) {
90
90
  }
91
91
  class BuildCancel extends EasCommand_1.default {
92
92
  async runAsync() {
93
- const { BUILD_ID: buildIdFromArg } = this.parse(BuildCancel).args;
93
+ const { BUILD_ID: buildIdFromArg } = (await this.parse(BuildCancel)).args;
94
94
  const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
95
95
  const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
96
96
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
@@ -1,9 +1,8 @@
1
- import { flags } from '@oclif/command';
2
1
  import EasCommand from '../../commandUtils/EasCommand';
3
2
  export default class BuildConfigure extends EasCommand {
4
3
  static description: string;
5
4
  static flags: {
6
- platform: flags.IOptionFlag<string>;
5
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
7
6
  };
8
7
  runAsync(): Promise<void>;
9
8
  }