eas-cli 0.41.0 → 0.43.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 (92) hide show
  1. package/README.md +23 -465
  2. package/bin/dev +17 -0
  3. package/bin/dev.cmd +3 -0
  4. package/bin/run +3 -3
  5. package/build/api.d.ts +1 -0
  6. package/build/api.js +13 -1
  7. package/build/build/configure.js +3 -3
  8. package/build/build/local.js +1 -1
  9. package/build/build/utils/devClient.js +3 -3
  10. package/build/commandUtils/EasCommand.d.ts +2 -1
  11. package/build/commandUtils/EasCommand.js +7 -4
  12. package/build/commands/account/login.d.ts +1 -0
  13. package/build/commands/account/login.js +1 -0
  14. package/build/commands/account/logout.d.ts +1 -0
  15. package/build/commands/account/logout.js +1 -0
  16. package/build/commands/account/view.d.ts +1 -0
  17. package/build/commands/account/view.js +1 -0
  18. package/build/commands/analytics.js +1 -1
  19. package/build/commands/branch/create.d.ts +1 -2
  20. package/build/commands/branch/create.js +11 -7
  21. package/build/commands/branch/delete.d.ts +1 -2
  22. package/build/commands/branch/delete.js +12 -7
  23. package/build/commands/branch/list.d.ts +1 -2
  24. package/build/commands/branch/list.js +8 -5
  25. package/build/commands/branch/rename.d.ts +3 -5
  26. package/build/commands/branch/rename.js +13 -9
  27. package/build/commands/branch/view.d.ts +1 -2
  28. package/build/commands/branch/view.js +33 -29
  29. package/build/commands/build/cancel.js +1 -1
  30. package/build/commands/build/configure.d.ts +1 -2
  31. package/build/commands/build/configure.js +3 -3
  32. package/build/commands/build/index.d.ts +11 -12
  33. package/build/commands/build/index.js +20 -19
  34. package/build/commands/build/inspect.d.ts +7 -7
  35. package/build/commands/build/inspect.js +31 -24
  36. package/build/commands/build/list.d.ts +13 -14
  37. package/build/commands/build/list.js +15 -15
  38. package/build/commands/build/view.d.ts +1 -1
  39. package/build/commands/build/view.js +3 -3
  40. package/build/commands/channel/create.d.ts +1 -2
  41. package/build/commands/channel/create.js +24 -20
  42. package/build/commands/channel/delete.d.ts +15 -0
  43. package/build/commands/channel/delete.js +124 -0
  44. package/build/commands/channel/edit.d.ts +2 -4
  45. package/build/commands/channel/edit.js +14 -10
  46. package/build/commands/channel/list.d.ts +1 -2
  47. package/build/commands/channel/list.js +17 -13
  48. package/build/commands/channel/rollout.d.ts +4 -5
  49. package/build/commands/channel/rollout.js +14 -10
  50. package/build/commands/channel/view.d.ts +1 -2
  51. package/build/commands/channel/view.js +19 -15
  52. package/build/commands/config.d.ts +2 -3
  53. package/build/commands/config.js +4 -4
  54. package/build/commands/device/list.d.ts +1 -2
  55. package/build/commands/device/list.js +3 -3
  56. package/build/commands/device/view.js +1 -1
  57. package/build/commands/diagnostics.js +1 -0
  58. package/build/commands/secret/create.d.ts +4 -5
  59. package/build/commands/secret/create.js +6 -6
  60. package/build/commands/secret/delete.d.ts +1 -2
  61. package/build/commands/secret/delete.js +3 -3
  62. package/build/commands/submit.d.ts +9 -10
  63. package/build/commands/submit.js +13 -14
  64. package/build/commands/update/configure.d.ts +0 -3
  65. package/build/commands/update/configure.js +4 -10
  66. package/build/commands/update/delete.d.ts +1 -2
  67. package/build/commands/update/delete.js +12 -8
  68. package/build/commands/update/index.d.ts +9 -11
  69. package/build/commands/update/index.js +30 -18
  70. package/build/commands/update/view.d.ts +1 -2
  71. package/build/commands/update/view.js +25 -21
  72. package/build/commands/webhook/create.d.ts +3 -4
  73. package/build/commands/webhook/create.js +5 -5
  74. package/build/commands/webhook/delete.js +1 -1
  75. package/build/commands/webhook/list.d.ts +1 -2
  76. package/build/commands/webhook/list.js +3 -3
  77. package/build/commands/webhook/update.d.ts +4 -5
  78. package/build/commands/webhook/update.js +6 -6
  79. package/build/commands/webhook/view.js +1 -1
  80. package/build/graphql/generated.d.ts +33 -0
  81. package/build/index.d.ts +1 -1
  82. package/build/index.js +2 -2
  83. package/build/project/expoSdk.js +2 -2
  84. package/build/project/metroConfig.js +2 -2
  85. package/build/project/publish.js +1 -3
  86. package/build/submit/ios/IosSubmitCommand.js +6 -1
  87. package/build/user/actions.js +2 -2
  88. package/build/utils/expoCli.d.ts +3 -1
  89. package/build/utils/expoCli.js +13 -11
  90. package/build/vcs/clients/git.js +2 -2
  91. package/oclif.manifest.json +1 -1
  92. package/package.json +20 -13
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.handleDeprecatedEasJsonAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const eas_json_1 = require("@expo/eas-json");
6
- const command_1 = require("@oclif/command");
7
- const errors_1 = require("@oclif/errors");
6
+ const core_1 = require("@oclif/core");
8
7
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
9
8
  const figures_1 = (0, tslib_1.__importDefault)(require("figures"));
10
9
  const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
@@ -21,7 +20,7 @@ const vcs_1 = require("../../vcs");
21
20
  const git_1 = (0, tslib_1.__importDefault)(require("../../vcs/clients/git"));
22
21
  class Build extends EasCommand_1.default {
23
22
  async runAsync() {
24
- const { flags: rawFlags } = this.parse(Build);
23
+ const { flags: rawFlags } = await this.parse(Build);
25
24
  if (rawFlags.json) {
26
25
  (0, json_1.enableJsonOutput)();
27
26
  }
@@ -34,22 +33,24 @@ class Build extends EasCommand_1.default {
34
33
  var _a;
35
34
  const nonInteractive = flags['non-interactive'];
36
35
  if (!flags.platform && nonInteractive) {
37
- (0, errors_1.error)('--platform is required when building in non-interactive mode', { exit: 1 });
36
+ core_1.Errors.error('--platform is required when building in non-interactive mode', { exit: 1 });
38
37
  }
39
38
  if (flags.json && !nonInteractive) {
40
- (0, errors_1.error)('--json is allowed only when building in non-interactive mode', { exit: 1 });
39
+ core_1.Errors.error('--json is allowed only when building in non-interactive mode', { exit: 1 });
41
40
  }
42
41
  const requestedPlatform = await (0, platform_1.selectRequestedPlatformAsync)(flags.platform);
43
42
  if (flags.local) {
44
43
  if (flags['auto-submit'] || flags['auto-submit-with-profile'] !== undefined) {
45
44
  // TODO: implement this
46
- (0, errors_1.error)('Auto-submits are not yet supported when building locally', { exit: 1 });
45
+ core_1.Errors.error('Auto-submits are not yet supported when building locally', { exit: 1 });
47
46
  }
48
47
  if (requestedPlatform === platform_1.RequestedPlatform.All) {
49
- (0, errors_1.error)('Builds for multiple platforms are not supported with flag --local', { exit: 1 });
48
+ core_1.Errors.error('Builds for multiple platforms are not supported with flag --local', {
49
+ exit: 1,
50
+ });
50
51
  }
51
52
  else if (process.platform !== 'darwin' && requestedPlatform === platform_1.RequestedPlatform.Ios) {
52
- (0, errors_1.error)('Unsupported platform, macOS is required to build apps for iOS', { exit: 1 });
53
+ core_1.Errors.error('Unsupported platform, macOS is required to build apps for iOS', { exit: 1 });
53
54
  }
54
55
  }
55
56
  if (flags['skip-credentials-check']) {
@@ -78,49 +79,49 @@ class Build extends EasCommand_1.default {
78
79
  exports.default = Build;
79
80
  Build.description = 'Start a build';
80
81
  Build.flags = {
81
- platform: command_1.flags.enum({
82
+ platform: core_1.Flags.enum({
82
83
  char: 'p',
83
84
  options: ['android', 'ios', 'all'],
84
85
  }),
85
- 'skip-credentials-check': command_1.flags.boolean({
86
+ 'skip-credentials-check': core_1.Flags.boolean({
86
87
  default: false,
87
88
  hidden: true,
88
89
  }),
89
- json: command_1.flags.boolean({
90
+ json: core_1.Flags.boolean({
90
91
  description: 'Enable JSON output, non-JSON messages will be printed to stderr',
91
92
  default: false,
92
93
  }),
93
- 'skip-project-configuration': command_1.flags.boolean({
94
+ 'skip-project-configuration': core_1.Flags.boolean({
94
95
  default: false,
95
96
  description: 'Skip project configuration',
96
97
  }),
97
- profile: command_1.flags.string({
98
+ profile: core_1.Flags.string({
98
99
  description: 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
99
100
  helpValue: 'PROFILE_NAME',
100
101
  }),
101
- 'non-interactive': command_1.flags.boolean({
102
+ 'non-interactive': core_1.Flags.boolean({
102
103
  default: false,
103
104
  description: 'Run command in non-interactive mode',
104
105
  }),
105
- local: command_1.flags.boolean({
106
+ local: core_1.Flags.boolean({
106
107
  default: false,
107
108
  description: 'Run build locally [experimental]',
108
109
  }),
109
- wait: command_1.flags.boolean({
110
+ wait: core_1.Flags.boolean({
110
111
  default: true,
111
112
  allowNo: true,
112
113
  description: 'Wait for build(s) to complete',
113
114
  }),
114
- 'clear-cache': command_1.flags.boolean({
115
+ 'clear-cache': core_1.Flags.boolean({
115
116
  default: false,
116
117
  description: 'Clear cache before the build',
117
118
  }),
118
- 'auto-submit': command_1.flags.boolean({
119
+ 'auto-submit': core_1.Flags.boolean({
119
120
  default: false,
120
121
  description: 'Submit on build complete using the submit profile with the same name as the build profile',
121
122
  exclusive: ['auto-submit-with-profile'],
122
123
  }),
123
- 'auto-submit-with-profile': command_1.flags.string({
124
+ 'auto-submit-with-profile': core_1.Flags.string({
124
125
  description: 'Submit on build complete using the submit profile with provided name',
125
126
  helpValue: 'PROFILE_NAME',
126
127
  exclusive: ['auto-submit'],
@@ -1,4 +1,3 @@
1
- import { flags } from '@oclif/command';
2
1
  import EasCommand from '../../commandUtils/EasCommand';
3
2
  import { RequestedPlatform } from '../../platform';
4
3
  declare enum InspectStage {
@@ -9,14 +8,15 @@ declare enum InspectStage {
9
8
  export default class BuildInspect extends EasCommand {
10
9
  static description: string;
11
10
  static flags: {
12
- platform: flags.IOptionFlag<RequestedPlatform>;
13
- profile: flags.IOptionFlag<string | undefined>;
14
- stage: flags.IOptionFlag<InspectStage>;
15
- output: flags.IOptionFlag<string>;
16
- force: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
17
- verbose: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
11
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<RequestedPlatform>;
12
+ profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
13
+ stage: import("@oclif/core/lib/interfaces").OptionFlag<InspectStage>;
14
+ output: import("@oclif/core/lib/interfaces").OptionFlag<string>;
15
+ force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
16
+ verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
18
17
  };
19
18
  runAsync(): Promise<void>;
20
19
  private prepareOutputDirAsync;
20
+ private copyToOutputDirAsync;
21
21
  }
22
22
  export {};
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const command_1 = require("@oclif/command");
4
+ const core_1 = require("@oclif/core");
5
5
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
6
6
  const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
7
7
  const path_1 = (0, tslib_1.__importDefault)(require("path"));
@@ -26,18 +26,21 @@ const STAGE_DESCRIPTION = `Stage of the build you want to inspect.
26
26
  post-build - builds the native project and leaves the output directory for inspection`;
27
27
  class BuildInspect extends EasCommand_1.default {
28
28
  async runAsync() {
29
- const { flags } = this.parse(BuildInspect);
29
+ const { flags } = await this.parse(BuildInspect);
30
30
  const outputDirectory = path_1.default.resolve(process.cwd(), flags.output);
31
+ const tmpWorkingdir = path_1.default.join((0, paths_1.getTmpDirectory)(), (0, uuid_1.v4)());
32
+ if (flags.force && process.cwd().startsWith(outputDirectory)) {
33
+ throw new Error(`This operation is not allowed, it would delete all files in ${outputDirectory} including the current project.`);
34
+ }
31
35
  await this.prepareOutputDirAsync(outputDirectory, flags.force);
32
36
  if (flags.stage === InspectStage.ARCHIVE) {
33
37
  const vcs = (0, vcs_1.getVcsClient)();
34
38
  await vcs.ensureRepoExistsAsync();
35
- await vcs.makeShallowCopyAsync(outputDirectory);
36
- log_1.default.withTick(`Project saved to ${outputDirectory}`);
39
+ await vcs.makeShallowCopyAsync(tmpWorkingdir);
40
+ await this.copyToOutputDirAsync(tmpWorkingdir, outputDirectory);
37
41
  }
38
42
  else {
39
43
  const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
40
- const tmpWorkingdir = path_1.default.join((0, paths_1.getTmpDirectory)(), (0, uuid_1.v4)());
41
44
  try {
42
45
  await (0, runBuildAndSubmit_1.runBuildAndSubmitAsync)(projectDir, {
43
46
  skipProjectConfiguration: false,
@@ -68,19 +71,7 @@ class BuildInspect extends EasCommand_1.default {
68
71
  }
69
72
  }
70
73
  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
- }
74
+ await this.copyToOutputDirAsync(path_1.default.join(tmpWorkingdir, 'build'), outputDirectory);
84
75
  }
85
76
  }
86
77
  }
@@ -95,35 +86,51 @@ class BuildInspect extends EasCommand_1.default {
95
86
  }
96
87
  await fs_extra_1.default.mkdirp(outputDir);
97
88
  }
89
+ async copyToOutputDirAsync(src, dst) {
90
+ const spinner = (0, ora_1.ora)().start(`Copying project directory to ${dst}`);
91
+ try {
92
+ if (await fs_extra_1.default.pathExists(src)) {
93
+ await fs_extra_1.default.copy(src, dst);
94
+ }
95
+ await fs_extra_1.default.remove(src);
96
+ spinner.succeed(`Project directory saved to ${dst}`);
97
+ }
98
+ catch (err) {
99
+ spinner.fail();
100
+ throw err;
101
+ }
102
+ }
98
103
  }
99
104
  exports.default = BuildInspect;
100
105
  BuildInspect.description = 'Inspect the state of the project at specific build stages. Useful for troubleshooting.';
101
106
  BuildInspect.flags = {
102
- platform: command_1.flags.enum({
107
+ platform: core_1.Flags.enum({
103
108
  char: 'p',
104
109
  options: [platform_1.RequestedPlatform.Android, platform_1.RequestedPlatform.Ios],
105
110
  required: true,
106
111
  }),
107
- profile: command_1.flags.string({
112
+ profile: core_1.Flags.string({
108
113
  description: 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
109
114
  helpValue: 'PROFILE_NAME',
110
115
  }),
111
- stage: command_1.flags.enum({
116
+ stage: core_1.Flags.enum({
112
117
  char: 's',
113
118
  description: STAGE_DESCRIPTION,
114
119
  options: [InspectStage.ARCHIVE, InspectStage.PRE_BUILD, InspectStage.POST_BUILD],
115
120
  required: true,
116
121
  }),
117
- output: command_1.flags.string({
122
+ output: core_1.Flags.string({
123
+ char: 'o',
118
124
  description: 'Output directory.',
119
125
  required: true,
120
126
  helpValue: 'OUTPUT_DIRECTORY',
121
127
  }),
122
- force: command_1.flags.boolean({
128
+ force: core_1.Flags.boolean({
123
129
  description: 'Delete OUTPUT_DIRECTORY if it already exists.',
124
130
  default: false,
125
131
  }),
126
- verbose: command_1.flags.boolean({
132
+ verbose: core_1.Flags.boolean({
133
+ char: 'v',
127
134
  default: false,
128
135
  }),
129
136
  };
@@ -1,23 +1,22 @@
1
- import { flags } from '@oclif/command';
2
1
  import { BuildDistributionType, BuildStatus } from '../../build/types';
3
2
  import EasCommand from '../../commandUtils/EasCommand';
4
3
  import { RequestedPlatform } from '../../platform';
5
4
  export default class BuildList extends EasCommand {
6
5
  static description: string;
7
6
  static flags: {
8
- platform: flags.IOptionFlag<RequestedPlatform>;
9
- json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
10
- status: flags.IOptionFlag<BuildStatus>;
11
- distribution: flags.IOptionFlag<BuildDistributionType>;
12
- channel: flags.IOptionFlag<string | undefined>;
13
- appVersion: flags.IOptionFlag<string | undefined>;
14
- appBuildVersion: flags.IOptionFlag<string | undefined>;
15
- sdkVersion: flags.IOptionFlag<string | undefined>;
16
- runtimeVersion: flags.IOptionFlag<string | undefined>;
17
- appIdentifier: flags.IOptionFlag<string | undefined>;
18
- buildProfile: flags.IOptionFlag<string | undefined>;
19
- gitCommitHash: flags.IOptionFlag<string | undefined>;
20
- limit: import("@oclif/parser/lib/flags").IOptionFlag<number | undefined>;
7
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<RequestedPlatform>;
8
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ status: import("@oclif/core/lib/interfaces").OptionFlag<BuildStatus>;
10
+ distribution: import("@oclif/core/lib/interfaces").OptionFlag<BuildDistributionType>;
11
+ channel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
12
+ appVersion: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
13
+ appBuildVersion: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
14
+ sdkVersion: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
15
+ runtimeVersion: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
16
+ appIdentifier: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
17
+ buildProfile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
18
+ gitCommitHash: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
19
+ limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
21
20
  };
22
21
  runAsync(): Promise<void>;
23
22
  }
@@ -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 types_1 = require("../../build/types");
8
8
  const formatBuild_1 = require("../../build/utils/formatBuild");
@@ -16,7 +16,7 @@ const projectUtils_1 = require("../../project/projectUtils");
16
16
  const json_1 = require("../../utils/json");
17
17
  class BuildList extends EasCommand_1.default {
18
18
  async runAsync() {
19
- const { flags } = this.parse(BuildList);
19
+ const { flags } = await this.parse(BuildList);
20
20
  const { json, platform: requestedPlatform, status: buildStatus, distribution: buildDistribution, limit = 10, } = flags;
21
21
  if (json) {
22
22
  (0, json_1.enableJsonOutput)();
@@ -76,13 +76,13 @@ class BuildList extends EasCommand_1.default {
76
76
  exports.default = BuildList;
77
77
  BuildList.description = 'list all builds for your project';
78
78
  BuildList.flags = {
79
- platform: command_1.flags.enum({
79
+ platform: core_1.Flags.enum({
80
80
  options: [platform_1.RequestedPlatform.All, platform_1.RequestedPlatform.Android, platform_1.RequestedPlatform.Ios],
81
81
  }),
82
- json: command_1.flags.boolean({
82
+ json: core_1.Flags.boolean({
83
83
  description: 'Enable JSON output, non-JSON messages will be printed to stderr',
84
84
  }),
85
- status: command_1.flags.enum({
85
+ status: core_1.Flags.enum({
86
86
  options: [
87
87
  types_1.BuildStatus.NEW,
88
88
  types_1.BuildStatus.IN_QUEUE,
@@ -92,22 +92,22 @@ BuildList.flags = {
92
92
  types_1.BuildStatus.CANCELED,
93
93
  ],
94
94
  }),
95
- distribution: command_1.flags.enum({
95
+ distribution: core_1.Flags.enum({
96
96
  options: [
97
97
  types_1.BuildDistributionType.STORE,
98
98
  types_1.BuildDistributionType.INTERNAL,
99
99
  types_1.BuildDistributionType.SIMULATOR,
100
100
  ],
101
101
  }),
102
- channel: command_1.flags.string(),
103
- appVersion: command_1.flags.string(),
104
- appBuildVersion: command_1.flags.string(),
105
- sdkVersion: command_1.flags.string(),
106
- runtimeVersion: command_1.flags.string(),
107
- appIdentifier: command_1.flags.string(),
108
- buildProfile: command_1.flags.string(),
109
- gitCommitHash: command_1.flags.string(),
110
- limit: command_1.flags.integer(),
102
+ channel: core_1.Flags.string(),
103
+ appVersion: core_1.Flags.string(),
104
+ appBuildVersion: core_1.Flags.string(),
105
+ sdkVersion: core_1.Flags.string(),
106
+ runtimeVersion: core_1.Flags.string(),
107
+ appIdentifier: core_1.Flags.string(),
108
+ buildProfile: core_1.Flags.string(),
109
+ gitCommitHash: core_1.Flags.string(),
110
+ limit: core_1.Flags.integer(),
111
111
  };
112
112
  const toAppPlatform = (requestedPlatform) => {
113
113
  if (!requestedPlatform || requestedPlatform === platform_1.RequestedPlatform.All) {
@@ -5,7 +5,7 @@ export default class BuildView extends EasCommand {
5
5
  name: string;
6
6
  }[];
7
7
  static flags: {
8
- json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
8
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
9
  };
10
10
  runAsync(): Promise<void>;
11
11
  }
@@ -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 formatBuild_1 = require("../../build/utils/formatBuild");
7
7
  const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
8
8
  const BuildQuery_1 = require("../../graphql/queries/BuildQuery");
@@ -12,7 +12,7 @@ const projectUtils_1 = require("../../project/projectUtils");
12
12
  const json_1 = require("../../utils/json");
13
13
  class BuildView extends EasCommand_1.default {
14
14
  async runAsync() {
15
- const { args: { BUILD_ID: buildId }, flags, } = this.parse(BuildView);
15
+ const { args: { BUILD_ID: buildId }, flags, } = await this.parse(BuildView);
16
16
  if (flags.json) {
17
17
  (0, json_1.enableJsonOutput)();
18
18
  }
@@ -62,7 +62,7 @@ exports.default = BuildView;
62
62
  BuildView.description = 'view a build for your project';
63
63
  BuildView.args = [{ name: 'BUILD_ID' }];
64
64
  BuildView.flags = {
65
- json: command_1.flags.boolean({
65
+ json: core_1.Flags.boolean({
66
66
  description: 'Enable JSON output, non-JSON messages will be printed to stderr',
67
67
  }),
68
68
  };
@@ -6,7 +6,6 @@ export declare function createUpdateChannelOnAppAsync({ appId, channelName, bran
6
6
  branchId: string;
7
7
  }): Promise<CreateUpdateChannelOnAppMutation>;
8
8
  export default class ChannelCreate extends EasCommand {
9
- static hidden: boolean;
10
9
  static description: string;
11
10
  static args: {
12
11
  name: string;
@@ -14,7 +13,7 @@ export default class ChannelCreate extends EasCommand {
14
13
  description: string;
15
14
  }[];
16
15
  static flags: {
17
- json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
16
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
18
17
  };
19
18
  runAsync(): Promise<void>;
20
19
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createUpdateChannelOnAppAsync = 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"));
@@ -12,6 +12,7 @@ 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
14
  const formatFields_1 = (0, tslib_1.__importDefault)(require("../../utils/formatFields"));
15
+ const json_1 = require("../../utils/json");
15
16
  const create_1 = require("../branch/create");
16
17
  async function createUpdateChannelOnAppAsync({ appId, channelName, branchId, }) {
17
18
  // Point the new channel at a branch with its same name.
@@ -40,7 +41,10 @@ async function createUpdateChannelOnAppAsync({ appId, channelName, branchId, })
40
41
  exports.createUpdateChannelOnAppAsync = createUpdateChannelOnAppAsync;
41
42
  class ChannelCreate extends EasCommand_1.default {
42
43
  async runAsync() {
43
- let { args: { name: channelName }, flags: { json: jsonFlag }, } = this.parse(ChannelCreate);
44
+ let { args: { name: channelName }, flags: { json: jsonFlag }, } = await this.parse(ChannelCreate);
45
+ if (jsonFlag) {
46
+ (0, json_1.enableJsonOutput)();
47
+ }
44
48
  const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
45
49
  const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
46
50
  const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
@@ -83,27 +87,27 @@ class ChannelCreate extends EasCommand_1.default {
83
87
  throw new Error(`Could not create channel with name ${channelName} on app with id ${projectId}`);
84
88
  }
85
89
  if (jsonFlag) {
86
- log_1.default.log(JSON.stringify(newChannel));
87
- return;
90
+ (0, json_1.printJsonOnlyOutput)(newChannel);
91
+ }
92
+ else {
93
+ log_1.default.addNewLineIfNone();
94
+ log_1.default.withTick(`Created a new channel on project ${chalk_1.default.bold(await (0, projectUtils_1.getProjectFullNameAsync)(exp))}`);
95
+ log_1.default.log((0, formatFields_1.default)([
96
+ { label: 'Name', value: newChannel.name },
97
+ { label: 'ID', value: newChannel.id },
98
+ ]));
99
+ log_1.default.addNewLineIfNone();
100
+ log_1.default.withTick(`${branchMessage} and have pointed the channel at it.`);
101
+ log_1.default.log((0, formatFields_1.default)([
102
+ { label: 'Name', value: newChannel.name },
103
+ { label: 'ID', value: branchId },
104
+ ]));
105
+ log_1.default.addNewLineIfNone();
106
+ log_1.default.log(chalk_1.default.bold('You can now update your app by publishing!'));
88
107
  }
89
- log_1.default.addNewLineIfNone();
90
- log_1.default.withTick(`Created a new channel on project ${chalk_1.default.bold(await (0, projectUtils_1.getProjectFullNameAsync)(exp))}`);
91
- log_1.default.log((0, formatFields_1.default)([
92
- { label: 'Name', value: newChannel.name },
93
- { label: 'ID', value: newChannel.id },
94
- ]));
95
- log_1.default.addNewLineIfNone();
96
- log_1.default.withTick(`${branchMessage} and have pointed the channel at it.`);
97
- log_1.default.log((0, formatFields_1.default)([
98
- { label: 'Name', value: newChannel.name },
99
- { label: 'ID', value: branchId },
100
- ]));
101
- log_1.default.addNewLineIfNone();
102
- log_1.default.log(chalk_1.default.bold('You can now update your app by publishing!'));
103
108
  }
104
109
  }
105
110
  exports.default = ChannelCreate;
106
- ChannelCreate.hidden = true;
107
111
  ChannelCreate.description = 'Create a channel on the current project.';
108
112
  ChannelCreate.args = [
109
113
  {
@@ -113,7 +117,7 @@ ChannelCreate.args = [
113
117
  },
114
118
  ];
115
119
  ChannelCreate.flags = {
116
- json: command_1.flags.boolean({
120
+ json: core_1.Flags.boolean({
117
121
  description: 'print output as a JSON object with the new channel ID, name and branch mapping.',
118
122
  default: false,
119
123
  }),
@@ -0,0 +1,15 @@
1
+ import EasCommand from '../../commandUtils/EasCommand';
2
+ export default class ChannelDelete extends EasCommand {
3
+ static hidden: boolean;
4
+ static description: string;
5
+ static args: {
6
+ name: string;
7
+ required: boolean;
8
+ description: string;
9
+ }[];
10
+ static flags: {
11
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
+ };
14
+ runAsync(): Promise<void>;
15
+ }
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const config_1 = require("@expo/config");
5
+ const core_1 = require("@oclif/core");
6
+ const graphql_tag_1 = (0, tslib_1.__importDefault)(require("graphql-tag"));
7
+ const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
8
+ const client_1 = require("../../graphql/client");
9
+ const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
10
+ const projectUtils_1 = require("../../project/projectUtils");
11
+ const prompts_1 = require("../../prompts");
12
+ const json_1 = require("../../utils/json");
13
+ class ChannelDelete extends EasCommand_1.default {
14
+ async runAsync() {
15
+ var _a, _b;
16
+ const { args: { name: nameArg }, flags: { json: jsonFlag, 'non-interactive': nonInteractiveFlag }, } = await this.parse(ChannelDelete);
17
+ if (jsonFlag && !nonInteractiveFlag) {
18
+ throw new Error('--json is allowed only in non-interactive mode');
19
+ }
20
+ if (jsonFlag) {
21
+ (0, json_1.enableJsonOutput)();
22
+ }
23
+ const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
24
+ const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
25
+ const fullName = await (0, projectUtils_1.getProjectFullNameAsync)(exp);
26
+ const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
27
+ let name;
28
+ if (nameArg) {
29
+ name = nameArg;
30
+ }
31
+ else {
32
+ if (nonInteractiveFlag) {
33
+ throw new Error('Channel name must be set when running in non-interactive mode');
34
+ }
35
+ name = (await (0, prompts_1.promptAsync)({
36
+ type: 'text',
37
+ name: 'name',
38
+ message: 'Please enter the name of the channel to delete:',
39
+ validate: (value) => (value ? true : 'Channel name may not be empty.'),
40
+ })).name;
41
+ }
42
+ const data = await getChannelInfoAsync({ appId: projectId, name });
43
+ const channelId = (_b = (_a = data.app) === null || _a === void 0 ? void 0 : _a.byId.updateChannelByName) === null || _b === void 0 ? void 0 : _b.id;
44
+ if (!channelId) {
45
+ throw new Error(`Could not find channel ${name} on ${fullName}`);
46
+ }
47
+ if (!nonInteractiveFlag) {
48
+ log_1.default.addNewLineIfNone();
49
+ log_1.default.warn(`You are about to permamently delete channel: "${name}".\nThis action is irreversible.`);
50
+ log_1.default.newLine();
51
+ const confirmed = await (0, prompts_1.toggleConfirmAsync)({ message: 'Are you sure you wish to proceed?' });
52
+ if (!confirmed) {
53
+ log_1.default.error(`Canceled deletion of channel: "${name}".`);
54
+ process.exit(1);
55
+ }
56
+ }
57
+ const deletionResult = await deleteChannelOnAppAsync({
58
+ channelId,
59
+ });
60
+ if (jsonFlag) {
61
+ (0, json_1.printJsonOnlyOutput)(deletionResult);
62
+ }
63
+ else {
64
+ log_1.default.withTick(`️Deleted channel "${name}".`);
65
+ }
66
+ }
67
+ }
68
+ exports.default = ChannelDelete;
69
+ ChannelDelete.hidden = true;
70
+ ChannelDelete.description = 'Delete a channel on the current project';
71
+ ChannelDelete.args = [
72
+ {
73
+ name: 'name',
74
+ required: false,
75
+ description: 'Name of the channel to delete',
76
+ },
77
+ ];
78
+ ChannelDelete.flags = {
79
+ json: core_1.Flags.boolean({
80
+ description: `Delete a channel on the current project`,
81
+ default: false,
82
+ }),
83
+ 'non-interactive': core_1.Flags.boolean({
84
+ default: false,
85
+ description: 'Run command in non-interactive mode',
86
+ }),
87
+ };
88
+ async function getChannelInfoAsync({ appId, name, }) {
89
+ const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
90
+ .query((0, graphql_tag_1.default) `
91
+ query GetChannelInfo($appId: String!, $name: String!) {
92
+ app {
93
+ byId(appId: $appId) {
94
+ id
95
+ updateChannelByName(name: $name) {
96
+ id
97
+ name
98
+ }
99
+ }
100
+ }
101
+ }
102
+ `, {
103
+ appId,
104
+ name,
105
+ }, { additionalTypenames: ['UpdateChannel'] })
106
+ .toPromise());
107
+ return data;
108
+ }
109
+ async function deleteChannelOnAppAsync({ channelId, }) {
110
+ const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
111
+ .mutation((0, graphql_tag_1.default) `
112
+ mutation DeleteUpdateChannel($channelId: ID!) {
113
+ updateChannel {
114
+ deleteUpdateChannel(channelId: $channelId) {
115
+ id
116
+ }
117
+ }
118
+ }
119
+ `, {
120
+ channelId,
121
+ })
122
+ .toPromise());
123
+ return data.updateChannel.deleteUpdateChannel;
124
+ }