@capawesome/cli 1.0.1 → 1.1.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,13 @@
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.1.0](https://github.com/capawesome-team/cli/compare/v1.0.1...v1.1.0) (2024-11-01)
6
+
7
+
8
+ ### Features
9
+
10
+ * **apps:** add `--bundle-limit` option ([#18](https://github.com/capawesome-team/cli/issues/18)) ([b20d33c](https://github.com/capawesome-team/cli/commit/b20d33cb0504c4bd83fec62fe40317b996357ef0))
11
+
5
12
  ## [1.0.1](https://github.com/capawesome-team/cli/compare/v1.0.0...v1.0.1) (2024-11-01)
6
13
 
7
14
 
@@ -14,10 +14,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const citty_1 = require("citty");
16
16
  const consola_1 = __importDefault(require("consola"));
17
- const prompt_1 = require("../../../utils/prompt");
18
- const apps_1 = __importDefault(require("../../../services/apps"));
19
17
  const app_channels_1 = __importDefault(require("../../../services/app-channels"));
18
+ const apps_1 = __importDefault(require("../../../services/apps"));
20
19
  const error_1 = require("../../../utils/error");
20
+ const prompt_1 = require("../../../utils/prompt");
21
21
  exports.default = (0, citty_1.defineCommand)({
22
22
  meta: {
23
23
  description: 'Create a new app channel.',
@@ -27,6 +27,10 @@ exports.default = (0, citty_1.defineCommand)({
27
27
  type: 'string',
28
28
  description: 'ID of the app.',
29
29
  },
30
+ bundleLimit: {
31
+ type: 'string',
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
+ },
30
34
  name: {
31
35
  type: 'string',
32
36
  description: 'Name of the channel.',
@@ -34,6 +38,9 @@ exports.default = (0, citty_1.defineCommand)({
34
38
  },
35
39
  run: (ctx) => __awaiter(void 0, void 0, void 0, function* () {
36
40
  let appId = ctx.args.appId;
41
+ let bundleLimitAsString = ctx.args.bundleLimit;
42
+ let name = ctx.args.name;
43
+ // Validate the app ID
37
44
  if (!appId) {
38
45
  const apps = yield apps_1.default.findAll();
39
46
  if (!apps.length) {
@@ -46,7 +53,16 @@ exports.default = (0, citty_1.defineCommand)({
46
53
  options: apps.map((app) => ({ label: app.name, value: app.id })),
47
54
  });
48
55
  }
49
- let name = ctx.args.name;
56
+ // Validate the bundle limit
57
+ let bundleLimit;
58
+ if (bundleLimitAsString) {
59
+ bundleLimit = parseInt(bundleLimitAsString, 10);
60
+ if (isNaN(bundleLimit)) {
61
+ consola_1.default.error('The bundle limit must be a number.');
62
+ return;
63
+ }
64
+ }
65
+ // Validate the channel name
50
66
  if (!name) {
51
67
  name = yield (0, prompt_1.prompt)('Enter the name of the channel:', { type: 'text' });
52
68
  }
@@ -54,6 +70,7 @@ exports.default = (0, citty_1.defineCommand)({
54
70
  const response = yield app_channels_1.default.create({
55
71
  appId,
56
72
  name,
73
+ totalAppBundleLimit: bundleLimit,
57
74
  });
58
75
  consola_1.default.success('Channel created successfully.');
59
76
  consola_1.default.info(`Channel ID: ${response.id}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capawesome/cli",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "The Capawesome Cloud Command Line Interface (CLI) to manage Live Updates and more.",
5
5
  "scripts": {
6
6
  "build": "rimraf ./dist && tsc",