@capawesome/cli 1.3.0 → 1.3.1
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 +7 -0
- package/dist/commands/apps/bundles/create.js +12 -11
- package/dist/commands/apps/bundles/delete.js +2 -1
- package/dist/commands/apps/bundles/update.js +3 -2
- package/dist/commands/apps/channels/create.js +3 -2
- package/dist/commands/apps/channels/delete.js +3 -2
- package/dist/commands/apps/create.js +2 -1
- package/dist/commands/apps/delete.js +3 -2
- package/dist/commands/apps/devices/delete.js +4 -3
- package/dist/commands/login.js +4 -2
- package/dist/commands/manifests/generate.js +2 -2
- package/dist/commands/whoami.js +2 -0
- package/package.json +4 -3
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.3.1](https://github.com/capawesome-team/cli/compare/v1.3.0...v1.3.1) (2024-12-30)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* exit with error code 1 ([#22](https://github.com/capawesome-team/cli/issues/22)) ([d05789e](https://github.com/capawesome-team/cli/commit/d05789e8e68b6bf6f0c48acadcdbe7c572a02593))
|
|
11
|
+
|
|
5
12
|
## [1.3.0](https://github.com/capawesome-team/cli/compare/v1.2.0...v1.3.0) (2024-12-21)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -84,7 +84,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
84
84
|
run: (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
85
85
|
if (!authorization_service_1.default.hasAuthorizationToken()) {
|
|
86
86
|
consola_1.default.error('You must be logged in to run this command.');
|
|
87
|
-
|
|
87
|
+
process.exit(1);
|
|
88
88
|
}
|
|
89
89
|
let androidMax = ctx.args.androidMax;
|
|
90
90
|
let androidMin = ctx.args.androidMin;
|
|
@@ -106,7 +106,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
106
106
|
const expiresInDaysAsNumber = parseInt(expiresInDays, 10);
|
|
107
107
|
if (isNaN(expiresInDaysAsNumber) || expiresInDaysAsNumber < 1) {
|
|
108
108
|
consola_1.default.error('Expires in days must be a number greater than 0.');
|
|
109
|
-
|
|
109
|
+
process.exit(1);
|
|
110
110
|
}
|
|
111
111
|
const expiresAtDate = new Date();
|
|
112
112
|
expiresAtDate.setDate(expiresAtDate.getDate() + expiresInDaysAsNumber);
|
|
@@ -118,7 +118,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
118
118
|
const rolloutAsNumber = parseFloat(rolloutAsString);
|
|
119
119
|
if (isNaN(rolloutAsNumber) || rolloutAsNumber < 0 || rolloutAsNumber > 1) {
|
|
120
120
|
consola_1.default.error('Rollout percentage must be a number between 0 and 1.');
|
|
121
|
-
|
|
121
|
+
process.exit(1);
|
|
122
122
|
}
|
|
123
123
|
rolloutPercentage = rolloutAsNumber;
|
|
124
124
|
}
|
|
@@ -128,27 +128,27 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
128
128
|
});
|
|
129
129
|
if (!path) {
|
|
130
130
|
consola_1.default.error('You must provide a path to the app bundle.');
|
|
131
|
-
|
|
131
|
+
process.exit(1);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
if (artifactType === 'manifest' && path) {
|
|
135
135
|
const pathIsDirectory = (0, file_1.isDirectory)(path);
|
|
136
136
|
if (!pathIsDirectory) {
|
|
137
137
|
consola_1.default.error('The path must be a folder when creating a bundle with an artifact type of `manifest`.');
|
|
138
|
-
|
|
138
|
+
process.exit(1);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
// Check if the path exists
|
|
142
142
|
const pathExists = yield (0, file_1.fileExistsAtPath)(path);
|
|
143
143
|
if (!pathExists) {
|
|
144
144
|
consola_1.default.error(`The path does not exist.`);
|
|
145
|
-
|
|
145
|
+
process.exit(1);
|
|
146
146
|
}
|
|
147
147
|
if (!appId) {
|
|
148
148
|
const apps = yield apps_1.default.findAll();
|
|
149
149
|
if (apps.length === 0) {
|
|
150
150
|
consola_1.default.error('You must create an app before creating a bundle.');
|
|
151
|
-
|
|
151
|
+
process.exit(1);
|
|
152
152
|
}
|
|
153
153
|
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
154
154
|
appId = yield (0, prompt_1.prompt)('Which app do you want to deploy to:', {
|
|
@@ -157,7 +157,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
157
157
|
});
|
|
158
158
|
if (!appId) {
|
|
159
159
|
consola_1.default.error('You must select an app to deploy to.');
|
|
160
|
-
|
|
160
|
+
process.exit(1);
|
|
161
161
|
}
|
|
162
162
|
if (!channelName) {
|
|
163
163
|
const promptChannel = yield (0, prompt_1.prompt)('Do you want to deploy to a specific channel?', {
|
|
@@ -170,7 +170,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
170
170
|
});
|
|
171
171
|
if (!channelName) {
|
|
172
172
|
consola_1.default.error('The channel name must be at least one character long.');
|
|
173
|
-
|
|
173
|
+
process.exit(1);
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
}
|
|
@@ -184,12 +184,12 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
184
184
|
}
|
|
185
185
|
else {
|
|
186
186
|
consola_1.default.error('Private key file not found.');
|
|
187
|
-
|
|
187
|
+
process.exit(1);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
else {
|
|
191
191
|
consola_1.default.error('Private key must be a path to a .pem file.');
|
|
192
|
-
|
|
192
|
+
process.exit(1);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
let appBundleId;
|
|
@@ -234,6 +234,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
234
234
|
}
|
|
235
235
|
const message = (0, error_1.getMessageFromUnknownError)(error);
|
|
236
236
|
consola_1.default.error(message);
|
|
237
|
+
process.exit(1);
|
|
237
238
|
}
|
|
238
239
|
}),
|
|
239
240
|
});
|
|
@@ -40,7 +40,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
40
40
|
const apps = yield apps_1.default.findAll();
|
|
41
41
|
if (!apps.length) {
|
|
42
42
|
consola_1.default.error('You must create an app before deleting a bundle.');
|
|
43
|
-
|
|
43
|
+
process.exit(1);
|
|
44
44
|
}
|
|
45
45
|
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
46
46
|
appId = yield (0, prompt_1.prompt)('Which app do you want to delete the bundle from?', {
|
|
@@ -71,6 +71,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
71
71
|
catch (error) {
|
|
72
72
|
const message = (0, error_1.getMessageFromUnknownError)(error);
|
|
73
73
|
consola_1.default.error(message);
|
|
74
|
+
process.exit(1);
|
|
74
75
|
}
|
|
75
76
|
}),
|
|
76
77
|
});
|
|
@@ -56,7 +56,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
56
56
|
run: (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
57
|
if (!authorization_service_1.default.hasAuthorizationToken()) {
|
|
58
58
|
consola_1.default.error('You must be logged in to run this command.');
|
|
59
|
-
|
|
59
|
+
process.exit(1);
|
|
60
60
|
}
|
|
61
61
|
// Prompt for missing arguments
|
|
62
62
|
const { androidMax, androidMin, rollout, iosMax, iosMin } = ctx.args;
|
|
@@ -66,7 +66,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
66
66
|
const apps = yield apps_1.default.findAll();
|
|
67
67
|
if (!apps.length) {
|
|
68
68
|
consola_1.default.error('You must create an app before updating a bundle.');
|
|
69
|
-
|
|
69
|
+
process.exit(1);
|
|
70
70
|
}
|
|
71
71
|
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
72
72
|
appId = yield (0, prompt_1.prompt)('Which app do you want to update the bundle for?', {
|
|
@@ -96,6 +96,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
96
96
|
catch (error) {
|
|
97
97
|
const message = (0, error_1.getMessageFromUnknownError)(error);
|
|
98
98
|
consola_1.default.error(message);
|
|
99
|
+
process.exit(1);
|
|
99
100
|
}
|
|
100
101
|
}),
|
|
101
102
|
});
|
|
@@ -45,7 +45,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
45
45
|
const apps = yield apps_1.default.findAll();
|
|
46
46
|
if (!apps.length) {
|
|
47
47
|
consola_1.default.error('You must create an app before creating a channel.');
|
|
48
|
-
|
|
48
|
+
process.exit(1);
|
|
49
49
|
}
|
|
50
50
|
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
51
51
|
appId = yield (0, prompt_1.prompt)('Which app do you want to create the channel for?', {
|
|
@@ -59,7 +59,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
59
59
|
bundleLimit = parseInt(bundleLimitAsString, 10);
|
|
60
60
|
if (isNaN(bundleLimit)) {
|
|
61
61
|
consola_1.default.error('The bundle limit must be a number.');
|
|
62
|
-
|
|
62
|
+
process.exit(1);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
// Validate the channel name
|
|
@@ -78,6 +78,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
78
78
|
catch (error) {
|
|
79
79
|
const message = (0, error_1.getMessageFromUnknownError)(error);
|
|
80
80
|
consola_1.default.error(message);
|
|
81
|
+
process.exit(1);
|
|
81
82
|
}
|
|
82
83
|
}),
|
|
83
84
|
});
|
|
@@ -38,7 +38,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
38
38
|
const apps = yield apps_1.default.findAll();
|
|
39
39
|
if (!apps.length) {
|
|
40
40
|
consola_1.default.error('You must create an app before deleting a channel.');
|
|
41
|
-
|
|
41
|
+
process.exit(1);
|
|
42
42
|
}
|
|
43
43
|
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
44
44
|
appId = yield (0, prompt_1.prompt)('Which app do you want to delete the channel from?', {
|
|
@@ -54,7 +54,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
54
54
|
}
|
|
55
55
|
if (typeof channel !== 'string') {
|
|
56
56
|
consola_1.default.error('Channel name must be a string.');
|
|
57
|
-
|
|
57
|
+
process.exit(1);
|
|
58
58
|
}
|
|
59
59
|
const confirmed = yield (0, prompt_1.prompt)('Are you sure you want to delete this channel?', {
|
|
60
60
|
type: 'confirm',
|
|
@@ -72,6 +72,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
72
72
|
catch (error) {
|
|
73
73
|
const message = (0, error_1.getMessageFromUnknownError)(error);
|
|
74
74
|
consola_1.default.error(message);
|
|
75
|
+
process.exit(1);
|
|
75
76
|
}
|
|
76
77
|
}),
|
|
77
78
|
});
|
|
@@ -14,9 +14,9 @@ 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
17
|
const apps_1 = __importDefault(require("../../services/apps"));
|
|
19
18
|
const error_1 = require("../../utils/error");
|
|
19
|
+
const prompt_1 = require("../../utils/prompt");
|
|
20
20
|
exports.default = (0, citty_1.defineCommand)({
|
|
21
21
|
meta: {
|
|
22
22
|
description: 'Create a new app.',
|
|
@@ -40,6 +40,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
40
40
|
catch (error) {
|
|
41
41
|
const message = (0, error_1.getMessageFromUnknownError)(error);
|
|
42
42
|
consola_1.default.error(message);
|
|
43
|
+
process.exit(1);
|
|
43
44
|
}
|
|
44
45
|
}),
|
|
45
46
|
});
|
|
@@ -14,9 +14,9 @@ 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
17
|
const apps_1 = __importDefault(require("../../services/apps"));
|
|
19
18
|
const error_1 = require("../../utils/error");
|
|
19
|
+
const prompt_1 = require("../../utils/prompt");
|
|
20
20
|
exports.default = (0, citty_1.defineCommand)({
|
|
21
21
|
meta: {
|
|
22
22
|
description: 'Delete an app.',
|
|
@@ -33,7 +33,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
33
33
|
const apps = yield apps_1.default.findAll();
|
|
34
34
|
if (!apps.length) {
|
|
35
35
|
consola_1.default.error('You must create an app before deleting it.');
|
|
36
|
-
|
|
36
|
+
process.exit(1);
|
|
37
37
|
}
|
|
38
38
|
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
39
39
|
appId = yield (0, prompt_1.prompt)('Which app do you want to delete?', {
|
|
@@ -54,6 +54,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
54
54
|
catch (error) {
|
|
55
55
|
const message = (0, error_1.getMessageFromUnknownError)(error);
|
|
56
56
|
consola_1.default.error(message);
|
|
57
|
+
process.exit(1);
|
|
57
58
|
}
|
|
58
59
|
}),
|
|
59
60
|
});
|
|
@@ -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 apps_1 = __importDefault(require("../../../services/apps"));
|
|
18
|
-
const prompt_1 = require("../../../utils/prompt");
|
|
19
17
|
const app_devices_1 = __importDefault(require("../../../services/app-devices"));
|
|
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: 'Delete an app device.',
|
|
@@ -38,7 +38,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
38
38
|
const apps = yield apps_1.default.findAll();
|
|
39
39
|
if (!apps.length) {
|
|
40
40
|
consola_1.default.error('You must create an app before deleting a device.');
|
|
41
|
-
|
|
41
|
+
process.exit(1);
|
|
42
42
|
}
|
|
43
43
|
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
44
44
|
appId = yield (0, prompt_1.prompt)('Which app do you want to delete the device from?', {
|
|
@@ -68,6 +68,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
68
68
|
catch (error) {
|
|
69
69
|
const message = (0, error_1.getMessageFromUnknownError)(error);
|
|
70
70
|
consola_1.default.error(message);
|
|
71
|
+
process.exit(1);
|
|
71
72
|
}
|
|
72
73
|
}),
|
|
73
74
|
});
|
package/dist/commands/login.js
CHANGED
|
@@ -40,7 +40,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
40
40
|
const password = (yield (0, prompt_1.passwordPrompt)('Enter your password:'));
|
|
41
41
|
if (!email || !password) {
|
|
42
42
|
consola_1.default.error('Invalid email or password.');
|
|
43
|
-
|
|
43
|
+
process.exit(1);
|
|
44
44
|
}
|
|
45
45
|
consola_1.default.start('Logging in...');
|
|
46
46
|
let sessionId;
|
|
@@ -53,7 +53,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
53
53
|
}
|
|
54
54
|
catch (error) {
|
|
55
55
|
consola_1.default.error('Invalid email or password.');
|
|
56
|
-
|
|
56
|
+
process.exit(1);
|
|
57
57
|
}
|
|
58
58
|
userConfig_1.default.write({
|
|
59
59
|
token: sessionId,
|
|
@@ -62,6 +62,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
62
62
|
}
|
|
63
63
|
else if (token.length === 0) {
|
|
64
64
|
consola_1.default.error('Please provide a valid token. You can create a token at https://cloud.capawesome.io/settings/tokens.');
|
|
65
|
+
process.exit(1);
|
|
65
66
|
}
|
|
66
67
|
else {
|
|
67
68
|
userConfig_1.default.write({
|
|
@@ -79,6 +80,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
79
80
|
'Invalid token. Please provide a valid token. You can create a token at https://cloud.capawesome.io/settings/tokens.';
|
|
80
81
|
}
|
|
81
82
|
consola_1.default.error(message);
|
|
83
|
+
process.exit(1);
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
86
|
}),
|
|
@@ -35,14 +35,14 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
35
35
|
});
|
|
36
36
|
if (!path) {
|
|
37
37
|
consola_1.default.error('You must provide a path to the web assets folder.');
|
|
38
|
-
|
|
38
|
+
process.exit(1);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
// Check if the path exists
|
|
42
42
|
const pathExists = yield (0, file_1.fileExistsAtPath)(path);
|
|
43
43
|
if (!pathExists) {
|
|
44
44
|
consola_1.default.error(`The path does not exist.`);
|
|
45
|
-
|
|
45
|
+
process.exit(1);
|
|
46
46
|
}
|
|
47
47
|
// Generate the manifest file
|
|
48
48
|
yield (0, manifest_1.generateManifestJson)(path);
|
package/dist/commands/whoami.js
CHANGED
|
@@ -35,10 +35,12 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
35
35
|
}
|
|
36
36
|
catch (error) {
|
|
37
37
|
consola_1.default.error('Token is invalid. Please sign in again.');
|
|
38
|
+
process.exit(1);
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
else {
|
|
41
42
|
consola_1.default.error('Not logged in.');
|
|
43
|
+
process.exit(1);
|
|
42
44
|
}
|
|
43
45
|
}),
|
|
44
46
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capawesome/cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
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",
|
|
@@ -9,7 +9,8 @@
|
|
|
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"
|
|
12
|
+
"release": "commit-and-tag-version",
|
|
13
|
+
"postinstall": "patch-package"
|
|
13
14
|
},
|
|
14
15
|
"bin": {
|
|
15
16
|
"capawesome": "./dist/index.js"
|
|
@@ -48,7 +49,6 @@
|
|
|
48
49
|
"citty": "0.1.6",
|
|
49
50
|
"consola": "3.2.3",
|
|
50
51
|
"form-data": "4.0.1",
|
|
51
|
-
"patch-package": "8.0.0",
|
|
52
52
|
"rc9": "2.1.2",
|
|
53
53
|
"semver": "7.6.3"
|
|
54
54
|
},
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"@types/node": "20.11.30",
|
|
59
59
|
"@types/semver": "7.5.8",
|
|
60
60
|
"commit-and-tag-version": "12.5.0",
|
|
61
|
+
"patch-package": "8.0.0",
|
|
61
62
|
"prettier": "3.3.3",
|
|
62
63
|
"rimraf": "6.0.1",
|
|
63
64
|
"typescript": "5.6.3"
|