@capawesome/cli 2.0.1 → 2.0.3
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 +15 -0
- package/dist/index.js +6 -2
- package/dist/index.test.js +33 -0
- package/dist/utils/error.js +6 -0
- package/package.json +2 -2
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
|
+
## [2.0.3](https://github.com/capawesome-team/cli/compare/v2.0.2...v2.0.3) (2025-08-26)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* `--version` was no longer supported ([526819b](https://github.com/capawesome-team/cli/commit/526819bebb2e5296380183fa4ec331b364376718))
|
|
11
|
+
* do not capture HTTP errors ([83f93e2](https://github.com/capawesome-team/cli/commit/83f93e21fc706e3245f349891e76501385dea03b))
|
|
12
|
+
|
|
13
|
+
## [2.0.2](https://github.com/capawesome-team/cli/compare/v2.0.1...v2.0.2) (2025-08-24)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* improve error messages for 500 and 503 status codes ([769ee5d](https://github.com/capawesome-team/cli/commit/769ee5dbd6535b7b58f516165bc02dbe9c40c531))
|
|
19
|
+
|
|
5
20
|
## [2.0.1](https://github.com/capawesome-team/cli/compare/v2.0.0...v2.0.1) (2025-08-24)
|
|
6
21
|
|
|
7
22
|
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import updateService from './services/update.js';
|
|
|
4
4
|
import { getMessageFromUnknownError } from './utils/error.js';
|
|
5
5
|
import { defineConfig, processConfig, ZliError } from '@robingenz/zli';
|
|
6
6
|
import * as Sentry from '@sentry/node';
|
|
7
|
+
import { AxiosError } from 'axios';
|
|
7
8
|
import consola from 'consola';
|
|
8
9
|
import pkg from '../package.json' with { type: 'json' };
|
|
9
10
|
const config = defineConfig({
|
|
@@ -33,9 +34,12 @@ const config = defineConfig({
|
|
|
33
34
|
},
|
|
34
35
|
});
|
|
35
36
|
const captureException = async (error) => {
|
|
36
|
-
//
|
|
37
|
+
// Ignore errors from the CLI itself (e.g. "No command found.")
|
|
37
38
|
if (error instanceof ZliError) {
|
|
38
|
-
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
// Ignore failed HTTP requests
|
|
42
|
+
if (error instanceof AxiosError) {
|
|
39
43
|
return;
|
|
40
44
|
}
|
|
41
45
|
const environment = await configService.getValueForKey('ENVIRONMENT');
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineConfig, processConfig } from '@robingenz/zli';
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
+
import pkg from '../package.json' with { type: 'json' };
|
|
4
|
+
const config = defineConfig({
|
|
5
|
+
meta: {
|
|
6
|
+
name: pkg.name,
|
|
7
|
+
version: pkg.version,
|
|
8
|
+
description: pkg.description,
|
|
9
|
+
},
|
|
10
|
+
commands: {},
|
|
11
|
+
});
|
|
12
|
+
describe('CLI', () => {
|
|
13
|
+
let consoleSpy;
|
|
14
|
+
let processExitSpy;
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
|
|
17
|
+
processExitSpy = vi.spyOn(process, 'exit').mockImplementation(() => undefined);
|
|
18
|
+
});
|
|
19
|
+
afterEach(() => {
|
|
20
|
+
vi.restoreAllMocks();
|
|
21
|
+
});
|
|
22
|
+
it('should display version when --version flag is used', () => {
|
|
23
|
+
try {
|
|
24
|
+
processConfig(config, ['--version']);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
// The processConfig function calls process.exit which we mock
|
|
28
|
+
// so we continue execution and check the mocks
|
|
29
|
+
}
|
|
30
|
+
expect(consoleSpy).toHaveBeenCalledWith(pkg.version);
|
|
31
|
+
expect(processExitSpy).toHaveBeenCalledWith(0);
|
|
32
|
+
});
|
|
33
|
+
});
|
package/dist/utils/error.js
CHANGED
|
@@ -21,6 +21,12 @@ const getErrorMessageFromAxiosError = (error) => {
|
|
|
21
21
|
else if (error.response?.status === 403) {
|
|
22
22
|
message = 'You do not have permission to access this resource.';
|
|
23
23
|
}
|
|
24
|
+
else if (error.response?.status === 500) {
|
|
25
|
+
message = 'An internal server error has occurred. Please try again later.';
|
|
26
|
+
}
|
|
27
|
+
else if (error.response?.status === 503) {
|
|
28
|
+
message = 'The service is currently unavailable. Please try again later.';
|
|
29
|
+
}
|
|
24
30
|
else if (error.response?.data?.message) {
|
|
25
31
|
message = error.response?.data?.message;
|
|
26
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capawesome/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "The Capawesome Cloud Command Line Interface (CLI) to manage Live Updates and more.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@clack/prompts": "0.7.0",
|
|
52
|
-
"@robingenz/zli": "0.1.
|
|
52
|
+
"@robingenz/zli": "0.1.5",
|
|
53
53
|
"@sentry/node": "8.55.0",
|
|
54
54
|
"archiver": "7.0.1",
|
|
55
55
|
"axios": "1.8.4",
|