@capawesome/cli 1.3.2 → 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 +12 -0
- package/dist/commands/apps/bundles/create.js +33 -6
- package/dist/services/app-bundles.js +4 -29
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
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
|
+
|
|
5
17
|
## [1.3.2](https://github.com/capawesome-team/cli/compare/v1.3.1...v1.3.2) (2024-12-30)
|
|
6
18
|
|
|
7
19
|
|
|
@@ -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
|
|
97
|
-
let
|
|
98
|
-
let
|
|
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
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
});
|
package/package.json
CHANGED