@capawesome/cli 1.8.1 → 1.9.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [1.9.0](https://github.com/capawesome-team/cli/compare/v1.8.1...v1.9.0) (2025-04-17)
6
+
7
+
8
+ ### Features
9
+
10
+ * add `--ignore-errors` option to `apps:channels:create` command ([#48](https://github.com/capawesome-team/cli/issues/48)) ([3bfb65e](https://github.com/capawesome-team/cli/commit/3bfb65e3c6f9915a6a67b31525b1737497408d59))
11
+ * add `--name` option to `apps:channels:create` ([#46](https://github.com/capawesome-team/cli/issues/46)) ([d6190b7](https://github.com/capawesome-team/cli/commit/d6190b7c9617a0d197d062aa21d01fe26d6e172f))
12
+ * add support for `CAPAWESOME_CLOUD_TOKEN` env variable ([5a8de4c](https://github.com/capawesome-team/cli/commit/5a8de4c9230112e71f74ee72888a86de18d67be7)), closes [#28](https://github.com/capawesome-team/cli/issues/28)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * `apps:bundles:create` command should always ask for a channel ([#47](https://github.com/capawesome-team/cli/issues/47)) ([fcd97a3](https://github.com/capawesome-team/cli/commit/fcd97a38a64599a8013da94e2f4ef3cdf2b641e5))
18
+ * **apps:channels:delete:** skip prompt in CI environment ([c455e15](https://github.com/capawesome-team/cli/commit/c455e15b711706a9422fc18fbec142f5fe86776d))
19
+
5
20
  ## [1.8.1](https://github.com/capawesome-team/cli/compare/v1.8.0...v1.8.1) (2025-04-07)
6
21
 
7
22
 
@@ -183,7 +183,6 @@ exports.default = (0, citty_1.defineCommand)({
183
183
  consola_1.default.error('It is not yet possible to provide a URL when creating a bundle with an artifact type of `manifest`.');
184
184
  process.exit(1);
185
185
  }
186
- // Let the user select an app and channel if not provided
187
186
  if (!appId) {
188
187
  const apps = yield apps_1.default.findAll();
189
188
  if (apps.length === 0) {
@@ -199,19 +198,19 @@ exports.default = (0, citty_1.defineCommand)({
199
198
  consola_1.default.error('You must select an app to deploy to.');
200
199
  process.exit(1);
201
200
  }
202
- if (!channelName) {
203
- const promptChannel = yield (0, prompt_1.prompt)('Do you want to deploy to a specific channel?', {
204
- type: 'select',
205
- options: ['Yes', 'No'],
201
+ }
202
+ if (!channelName) {
203
+ const promptChannel = yield (0, prompt_1.prompt)('Do you want to deploy to a specific channel?', {
204
+ type: 'select',
205
+ options: ['Yes', 'No'],
206
+ });
207
+ if (promptChannel === 'Yes') {
208
+ channelName = yield (0, prompt_1.prompt)('Enter the channel name:', {
209
+ type: 'text',
206
210
  });
207
- if (promptChannel === 'Yes') {
208
- channelName = yield (0, prompt_1.prompt)('Enter the channel name:', {
209
- type: 'text',
210
- });
211
- if (!channelName) {
212
- consola_1.default.error('The channel name must be at least one character long.');
213
- process.exit(1);
214
- }
211
+ if (!channelName) {
212
+ consola_1.default.error('The channel name must be at least one character long.');
213
+ process.exit(1);
215
214
  }
216
215
  }
217
216
  }
@@ -31,6 +31,10 @@ exports.default = (0, citty_1.defineCommand)({
31
31
  type: 'string',
32
32
  description: 'Maximum number of bundles that can be assigned to the channel. If more bundles are assigned, the oldest bundles will be automatically deleted.',
33
33
  },
34
+ ignoreErrors: {
35
+ type: 'boolean',
36
+ description: 'Whether to ignore errors or not.',
37
+ },
34
38
  name: {
35
39
  type: 'string',
36
40
  description: 'Name of the channel.',
@@ -39,7 +43,12 @@ exports.default = (0, citty_1.defineCommand)({
39
43
  run: (ctx) => __awaiter(void 0, void 0, void 0, function* () {
40
44
  let appId = ctx.args.appId;
41
45
  let bundleLimitAsString = ctx.args.bundleLimit;
46
+ let ignoreErrors = ctx.args.ignoreErrors;
42
47
  let name = ctx.args.name;
48
+ // Convert ignoreErrors to boolean
49
+ if (typeof ignoreErrors === 'string') {
50
+ ignoreErrors = ignoreErrors.toLowerCase() === 'true';
51
+ }
43
52
  // Validate the app ID
44
53
  if (!appId) {
45
54
  const apps = yield apps_1.default.findAll();
@@ -78,7 +87,7 @@ exports.default = (0, citty_1.defineCommand)({
78
87
  catch (error) {
79
88
  const message = (0, error_1.getMessageFromUnknownError)(error);
80
89
  consola_1.default.error(message);
81
- process.exit(1);
90
+ process.exit(ignoreErrors ? 0 : 1);
82
91
  }
83
92
  }),
84
93
  });
@@ -16,6 +16,7 @@ const citty_1 = require("citty");
16
16
  const consola_1 = __importDefault(require("consola"));
17
17
  const app_channels_1 = __importDefault(require("../../../services/app-channels"));
18
18
  const apps_1 = __importDefault(require("../../../services/apps"));
19
+ const ci_1 = require("../../../utils/ci");
19
20
  const error_1 = require("../../../utils/error");
20
21
  const prompt_1 = require("../../../utils/prompt");
21
22
  exports.default = (0, citty_1.defineCommand)({
@@ -29,11 +30,17 @@ exports.default = (0, citty_1.defineCommand)({
29
30
  },
30
31
  channelId: {
31
32
  type: 'string',
32
- description: 'ID of the channel.',
33
+ description: 'ID of the channel. Either the ID or name of the channel must be provided.',
34
+ },
35
+ name: {
36
+ type: 'string',
37
+ description: 'Name of the channel. Either the ID or name of the channel must be provided.',
33
38
  },
34
39
  },
35
40
  run: (ctx) => __awaiter(void 0, void 0, void 0, function* () {
36
41
  let appId = ctx.args.appId;
42
+ let channelId = ctx.args.channelId;
43
+ let channelName = ctx.args.name;
37
44
  if (!appId) {
38
45
  const apps = yield apps_1.default.findAll();
39
46
  if (!apps.length) {
@@ -46,26 +53,24 @@ exports.default = (0, citty_1.defineCommand)({
46
53
  options: apps.map((app) => ({ label: app.name, value: app.id })),
47
54
  });
48
55
  }
49
- let channel = ctx.args.channel;
50
- if (!channel) {
51
- channel = yield (0, prompt_1.prompt)('Enter the channel name:', {
56
+ if (!channelId && !channelName) {
57
+ channelName = yield (0, prompt_1.prompt)('Enter the channel name:', {
52
58
  type: 'text',
53
59
  });
54
60
  }
55
- if (typeof channel !== 'string') {
56
- consola_1.default.error('Channel name must be a string.');
57
- process.exit(1);
58
- }
59
- const confirmed = yield (0, prompt_1.prompt)('Are you sure you want to delete this channel?', {
60
- type: 'confirm',
61
- });
62
- if (!confirmed) {
63
- return;
61
+ if (!(0, ci_1.isRunningInCi)()) {
62
+ const confirmed = yield (0, prompt_1.prompt)('Are you sure you want to delete this channel?', {
63
+ type: 'confirm',
64
+ });
65
+ if (!confirmed) {
66
+ return;
67
+ }
64
68
  }
65
69
  try {
66
70
  yield app_channels_1.default.delete({
67
71
  appId,
68
- name: channel,
72
+ id: channelId,
73
+ name: channelName,
69
74
  });
70
75
  consola_1.default.success('Channel deleted successfully.');
71
76
  }
@@ -30,14 +30,23 @@ class AppChannelsServiceImpl {
30
30
  }
31
31
  delete(data) {
32
32
  return __awaiter(this, void 0, void 0, function* () {
33
- yield this.httpClient.delete(`/v1/apps/${data.appId}/channels`, {
34
- headers: {
35
- Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
36
- },
37
- params: {
38
- name: data.name,
39
- },
40
- });
33
+ if (data.id) {
34
+ yield this.httpClient.delete(`/v1/apps/${data.appId}/channels/${data.id}`, {
35
+ headers: {
36
+ Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
37
+ },
38
+ });
39
+ }
40
+ else if (data.name) {
41
+ yield this.httpClient.delete(`/v1/apps/${data.appId}/channels`, {
42
+ headers: {
43
+ Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
44
+ },
45
+ params: {
46
+ name: data.name,
47
+ },
48
+ });
49
+ }
41
50
  });
42
51
  }
43
52
  }
@@ -9,7 +9,7 @@ class AuthorizationServiceImpl {
9
9
  this.userConfig = userConfig;
10
10
  }
11
11
  getCurrentAuthorizationToken() {
12
- return this.userConfig.read().token || process.env.CAPAWESOME_TOKEN || null;
12
+ return this.userConfig.read().token || process.env.CAPAWESOME_CLOUD_TOKEN || process.env.CAPAWESOME_TOKEN || null;
13
13
  }
14
14
  hasAuthorizationToken() {
15
15
  return !!this.getCurrentAuthorizationToken();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capawesome/cli",
3
- "version": "1.8.1",
3
+ "version": "1.9.0",
4
4
  "description": "The Capawesome Cloud Command Line Interface (CLI) to manage Live Updates and more.",
5
5
  "scripts": {
6
6
  "build": "patch-package && rimraf ./dist && tsc",