@capawesome/cli 1.3.1 → 1.4.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,25 @@
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.4.0](https://github.com/capawesome-team/cli/compare/v1.3.2...v1.4.0) (2025-01-29)
6
+
7
+
8
+ ### Features
9
+
10
+ * **bundles:** support custom properties ([#31](https://github.com/capawesome-team/cli/issues/31)) ([405634b](https://github.com/capawesome-team/cli/commit/405634b8a46a77a72ea9812fb350f54ca79a8387))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * convert command arguments to string if not undefined ([b147e21](https://github.com/capawesome-team/cli/commit/b147e214b4ee0da3babc82773b1426162f753c36)), closes [#33](https://github.com/capawesome-team/cli/issues/33)
16
+
17
+ ## [1.3.2](https://github.com/capawesome-team/cli/compare/v1.3.1...v1.3.2) (2024-12-30)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * npm error `patch-package: command not found` ([ed3513a](https://github.com/capawesome-team/cli/commit/ed3513a63d89d20da76e969d2b5a11f876b7da76)), closes [#23](https://github.com/capawesome-team/cli/issues/23)
23
+
5
24
  ## [1.3.1](https://github.com/capawesome-team/cli/compare/v1.3.0...v1.3.1) (2024-12-30)
6
25
 
7
26
 
@@ -52,6 +52,10 @@ exports.default = (0, citty_1.defineCommand)({
52
52
  type: 'string',
53
53
  description: 'Channel to associate the bundle with.',
54
54
  },
55
+ customProperty: {
56
+ type: 'string',
57
+ description: 'A custom property to assign to the bundle. Must be in the format `key=value`. Can be specified multiple times.',
58
+ },
55
59
  expiresInDays: {
56
60
  type: 'string',
57
61
  description: 'The number of days until the bundle is automatically deleted.',
@@ -86,19 +90,20 @@ exports.default = (0, citty_1.defineCommand)({
86
90
  consola_1.default.error('You must be logged in to run this command.');
87
91
  process.exit(1);
88
92
  }
89
- let androidMax = ctx.args.androidMax;
90
- let androidMin = ctx.args.androidMin;
93
+ let androidMax = ctx.args.androidMax === undefined ? undefined : ctx.args.androidMax + ''; // Convert to string
94
+ let androidMin = ctx.args.androidMin === undefined ? undefined : ctx.args.androidMin + ''; // Convert to string
91
95
  let appId = ctx.args.appId;
92
96
  let artifactType = ctx.args.artifactType === 'manifest' || ctx.args.artifactType === 'zip'
93
97
  ? ctx.args.artifactType
94
98
  : 'zip';
95
99
  let channelName = ctx.args.channel;
96
- let expiresInDays = ctx.args.expiresInDays;
97
- let iosMax = ctx.args.iosMax;
98
- let iosMin = ctx.args.iosMin;
100
+ let customProperty = ctx.args.customProperty;
101
+ let expiresInDays = ctx.args.expiresInDays === undefined ? undefined : ctx.args.expiresInDays + ''; // Convert to string
102
+ let iosMax = ctx.args.iosMax === undefined ? undefined : ctx.args.iosMax + ''; // Convert to string
103
+ let iosMin = ctx.args.iosMin === undefined ? undefined : ctx.args.iosMin + ''; // Convert to string
99
104
  let path = ctx.args.path;
100
105
  let privateKey = ctx.args.privateKey;
101
- let rolloutAsString = ctx.args.rollout;
106
+ let rolloutAsString = ctx.args.rollout === undefined ? undefined : ctx.args.rollout + ''; // Convert to string
102
107
  let url = ctx.args.url;
103
108
  // Validate the expiration days
104
109
  let expiresAt;
@@ -200,6 +205,7 @@ exports.default = (0, citty_1.defineCommand)({
200
205
  appId,
201
206
  artifactType,
202
207
  channelName,
208
+ customProperties: parseCustomProperties(customProperty),
203
209
  expiresAt: expiresAt,
204
210
  url,
205
211
  maxAndroidAppVersionCode: androidMax,
@@ -315,3 +321,24 @@ const uploadZip = (options) => __awaiter(void 0, void 0, void 0, function* () {
315
321
  appBundleFileId: result.id,
316
322
  };
317
323
  });
324
+ const parseCustomProperties = (customProperty) => {
325
+ let customProperties;
326
+ if (customProperty) {
327
+ customProperties = {};
328
+ if (Array.isArray(customProperty)) {
329
+ for (const property of customProperty) {
330
+ const [key, value] = property.split('=');
331
+ if (key && value) {
332
+ customProperties[key] = value;
333
+ }
334
+ }
335
+ }
336
+ else {
337
+ const [key, value] = customProperty.split('=');
338
+ if (key && value) {
339
+ customProperties[key] = value;
340
+ }
341
+ }
342
+ }
343
+ return customProperties;
344
+ };
@@ -12,7 +12,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const form_data_1 = __importDefault(require("form-data"));
16
15
  const http_client_1 = __importDefault(require("../utils/http-client"));
17
16
  const authorization_service_1 = __importDefault(require("./authorization-service"));
18
17
  class AppBundlesServiceImpl {
@@ -21,34 +20,10 @@ class AppBundlesServiceImpl {
21
20
  }
22
21
  create(dto) {
23
22
  return __awaiter(this, void 0, void 0, function* () {
24
- const formData = new form_data_1.default();
25
- formData.append('artifactType', dto.artifactType);
26
- if (dto.channelName) {
27
- formData.append('channelName', dto.channelName);
28
- }
29
- if (dto.expiresAt) {
30
- formData.append('expiresAt', dto.expiresAt);
31
- }
32
- if (dto.url) {
33
- formData.append('url', dto.url);
34
- }
35
- if (dto.maxAndroidAppVersionCode) {
36
- formData.append('maxAndroidAppVersionCode', dto.maxAndroidAppVersionCode);
37
- }
38
- if (dto.maxIosAppVersionCode) {
39
- formData.append('maxIosAppVersionCode', dto.maxIosAppVersionCode);
40
- }
41
- if (dto.minAndroidAppVersionCode) {
42
- formData.append('minAndroidAppVersionCode', dto.minAndroidAppVersionCode);
43
- }
44
- if (dto.minIosAppVersionCode) {
45
- formData.append('minIosAppVersionCode', dto.minIosAppVersionCode);
46
- }
47
- if (dto.rolloutPercentage) {
48
- formData.append('rolloutPercentage', dto.rolloutPercentage.toString());
49
- }
50
- const response = yield this.httpClient.post(`/apps/${dto.appId}/bundles`, formData, {
51
- headers: Object.assign({ Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}` }, formData.getHeaders()),
23
+ const response = yield this.httpClient.post(`/apps/${dto.appId}/bundles`, dto, {
24
+ headers: {
25
+ Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
26
+ },
52
27
  });
53
28
  return response.data;
54
29
  });
@@ -13,16 +13,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.passwordPrompt = exports.prompt = void 0;
16
- const consola_1 = __importDefault(require("consola"));
17
16
  const prompts_1 = require("@clack/prompts");
18
- /**
19
- * This is a workaround for the issue with consola.prompt not detecting command cancellation.
20
- *
21
- * @see https://github.com/unjs/consola/issues/251#issuecomment-1810269084
22
- */
17
+ const consola_1 = __importDefault(require("consola"));
23
18
  const prompt = (message, options) => __awaiter(void 0, void 0, void 0, function* () {
19
+ options = Object.assign(Object.assign({}, (options || {})), { cancel: 'symbol' });
24
20
  const response = yield consola_1.default.prompt(message, options);
25
- if (response && response.toString() === 'Symbol(clack:cancel)') {
21
+ // See https://github.com/unjs/consola/pull/325#issue-2751614453
22
+ if (response === Symbol.for('cancel')) {
26
23
  process.exit(0);
27
24
  }
28
25
  return response;
package/package.json CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "name": "@capawesome/cli",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "The Capawesome Cloud Command Line Interface (CLI) to manage Live Updates and more.",
5
5
  "scripts": {
6
- "build": "rimraf ./dist && tsc",
6
+ "build": "patch-package && rimraf ./dist && tsc",
7
7
  "start": "npm run build && node ./dist/index.js",
8
8
  "lint": "npm run prettier -- --check",
9
9
  "fmt": "npm run prettier -- --write",
10
10
  "prettier": "prettier \"**/*.{css,html,ts,js}\"",
11
11
  "prepublishOnly": "npm run build",
12
- "release": "commit-and-tag-version",
13
- "postinstall": "patch-package"
12
+ "release": "commit-and-tag-version"
14
13
  },
15
14
  "bin": {
16
15
  "capawesome": "./dist/index.js"
@@ -47,7 +46,7 @@
47
46
  "axios": "1.7.7",
48
47
  "c12": "2.0.1",
49
48
  "citty": "0.1.6",
50
- "consola": "3.2.3",
49
+ "consola": "3.3.0",
51
50
  "form-data": "4.0.1",
52
51
  "rc9": "2.1.2",
53
52
  "semver": "7.6.3"