@capawesome/cli 1.0.0 → 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,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.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
+
12
+ ## [1.0.1](https://github.com/capawesome-team/cli/compare/v1.0.0...v1.0.1) (2024-11-01)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **apps:** `--ios-min` option was ignored ([d2de664](https://github.com/capawesome-team/cli/commit/d2de66481f7b54e44fc52eac6d1c868e82499160))
18
+ * **apps:** `--rollout` option was ignored ([5f1b2d8](https://github.com/capawesome-team/cli/commit/5f1b2d85a77d6a99e123dc690d947a740e864d6e))
19
+
5
20
  ## [1.0.0](https://github.com/capawesome-team/cli/compare/v0.0.17...v1.0.0) (2024-11-01)
6
21
 
7
22
 
@@ -98,7 +98,7 @@ exports.default = (0, citty_1.defineCommand)({
98
98
  let iosMin = ctx.args.iosMin;
99
99
  let path = ctx.args.path;
100
100
  let privateKey = ctx.args.privateKey;
101
- let rollout = ctx.args.rollout;
101
+ let rolloutAsString = ctx.args.rollout;
102
102
  let url = ctx.args.url;
103
103
  // Validate the expiration days
104
104
  let expiresAt;
@@ -112,6 +112,16 @@ exports.default = (0, citty_1.defineCommand)({
112
112
  expiresAtDate.setDate(expiresAtDate.getDate() + expiresInDaysAsNumber);
113
113
  expiresAt = expiresAtDate.toISOString();
114
114
  }
115
+ // Validate the rollout percentage
116
+ let rolloutPercentage = 1;
117
+ if (rolloutAsString) {
118
+ const rolloutAsNumber = parseFloat(rolloutAsString);
119
+ if (isNaN(rolloutAsNumber) || rolloutAsNumber < 0 || rolloutAsNumber > 1) {
120
+ consola_1.default.error('Rollout percentage must be a number between 0 and 1.');
121
+ return;
122
+ }
123
+ rolloutPercentage = rolloutAsNumber;
124
+ }
115
125
  if (!path && !url) {
116
126
  path = yield (0, prompt_1.prompt)('Enter the path to the app bundle:', {
117
127
  type: 'text',
@@ -195,7 +205,8 @@ exports.default = (0, citty_1.defineCommand)({
195
205
  maxAndroidAppVersionCode: androidMax,
196
206
  maxIosAppVersionCode: iosMax,
197
207
  minAndroidAppVersionCode: androidMin,
198
- minIosAppVersionCode: androidMin,
208
+ minIosAppVersionCode: iosMin,
209
+ rolloutPercentage,
199
210
  });
200
211
  appBundleId = response.id;
201
212
  if (path) {
@@ -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.0",
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",