@capawesome/cli 2.1.4 → 2.1.5
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 +8 -0
- package/dist/commands/login.js +5 -0
- package/dist/commands/login.test.js +3 -0
- package/dist/index.js +2 -2
- package/dist/utils/error.js +8 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
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.1.5](https://github.com/capawesome-team/cli/compare/v2.1.4...v2.1.5) (2025-09-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **error:** improve network error handling ([500ed94](https://github.com/capawesome-team/cli/commit/500ed94eff85538531e1a16906a33f4af6437998))
|
|
11
|
+
* **login:** throw error in CI if not token was provided ([#78](https://github.com/capawesome-team/cli/issues/78)) ([eda17c6](https://github.com/capawesome-team/cli/commit/eda17c691d807d1a4e76d83e91790f729c42385d))
|
|
12
|
+
|
|
5
13
|
## [2.1.4](https://github.com/capawesome-team/cli/compare/v2.1.3...v2.1.4) (2025-08-31)
|
|
6
14
|
|
|
7
15
|
|
package/dist/commands/login.js
CHANGED
|
@@ -8,6 +8,7 @@ import { defineCommand, defineOptions } from '@robingenz/zli';
|
|
|
8
8
|
import { AxiosError } from 'axios';
|
|
9
9
|
import consola from 'consola';
|
|
10
10
|
import open from 'open';
|
|
11
|
+
import { isCI } from 'std-env';
|
|
11
12
|
import { z } from 'zod';
|
|
12
13
|
export default defineCommand({
|
|
13
14
|
description: 'Sign in to the Capawesome Cloud Console.',
|
|
@@ -18,6 +19,10 @@ export default defineCommand({
|
|
|
18
19
|
const consoleBaseUrl = await configService.getValueForKey('CONSOLE_BASE_URL');
|
|
19
20
|
let { token: sessionIdOrToken } = options;
|
|
20
21
|
if (sessionIdOrToken === undefined) {
|
|
22
|
+
if (isCI) {
|
|
23
|
+
consola.error('You must provide a token when running in CI mode.');
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
21
26
|
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
22
27
|
const authenticationMethod = await prompt('How would you like to authenticate Capawesome CLI?', {
|
|
23
28
|
type: 'select',
|
|
@@ -17,6 +17,9 @@ vi.mock('@/services/config.js');
|
|
|
17
17
|
vi.mock('open');
|
|
18
18
|
vi.mock('consola');
|
|
19
19
|
vi.mock('@/utils/prompt.js');
|
|
20
|
+
vi.mock('std-env', () => ({
|
|
21
|
+
isCI: false,
|
|
22
|
+
}));
|
|
20
23
|
describe('login', () => {
|
|
21
24
|
const mockUserConfig = vi.mocked(userConfig);
|
|
22
25
|
const mockSessionCodesService = vi.mocked(sessionCodesService);
|
package/dist/index.js
CHANGED
|
@@ -6,8 +6,8 @@ import { defineConfig, processConfig, ZliError } from '@robingenz/zli';
|
|
|
6
6
|
import * as Sentry from '@sentry/node';
|
|
7
7
|
import { AxiosError } from 'axios';
|
|
8
8
|
import consola from 'consola';
|
|
9
|
-
import { ZodError } from 'zod';
|
|
10
9
|
import { createRequire } from 'module';
|
|
10
|
+
import { ZodError } from 'zod';
|
|
11
11
|
const require = createRequire(import.meta.url);
|
|
12
12
|
const pkg = require('../package.json');
|
|
13
13
|
const config = defineConfig({
|
|
@@ -55,7 +55,7 @@ const captureException = async (error) => {
|
|
|
55
55
|
}
|
|
56
56
|
Sentry.init({
|
|
57
57
|
dsn: 'https://19f30f2ec4b91899abc33818568ceb42@o4507446340747264.ingest.de.sentry.io/4508506426966096',
|
|
58
|
-
release: pkg.version
|
|
58
|
+
release: `capawesome-team-cli@${pkg.version}`,
|
|
59
59
|
});
|
|
60
60
|
if (process.argv.slice(2).length > 0) {
|
|
61
61
|
Sentry.setTag('cli_command', process.argv.slice(2)[0]);
|
package/dist/utils/error.js
CHANGED
|
@@ -15,7 +15,14 @@ export const getMessageFromUnknownError = (error) => {
|
|
|
15
15
|
};
|
|
16
16
|
const getErrorMessageFromAxiosError = (error) => {
|
|
17
17
|
let message = 'An unknown network error has occurred.';
|
|
18
|
-
if (error.response
|
|
18
|
+
if (!error.response &&
|
|
19
|
+
(error.code === 'ENOTFOUND' ||
|
|
20
|
+
error.code === 'ECONNREFUSED' ||
|
|
21
|
+
error.code === 'ENETUNREACH' ||
|
|
22
|
+
error.message.includes('Network Error'))) {
|
|
23
|
+
message = 'No connection could be established. Please check your internet connection and try again.';
|
|
24
|
+
}
|
|
25
|
+
else if (error.response?.status === 401) {
|
|
19
26
|
message = 'Your token is no longer valid. Please sign in again.';
|
|
20
27
|
}
|
|
21
28
|
else if (error.response?.status === 403) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capawesome/cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"description": "The Capawesome Cloud Command Line Interface (CLI) to manage Live Updates and more.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"lint": "npm run prettier -- --check",
|
|
13
13
|
"fmt": "npm run prettier -- --write",
|
|
14
14
|
"prettier": "prettier \"**/*.{css,html,ts,js}\"",
|
|
15
|
-
"sentry:releases:new": "sentry-cli releases new
|
|
16
|
-
"sentry:releases:set-commits": "sentry-cli releases set-commits
|
|
17
|
-
"sentry:releases:finalize": "sentry-cli releases finalize
|
|
15
|
+
"sentry:releases:new": "sentry-cli releases new capawesome-team-cli@$npm_package_version --org genz-it-solutions-gmbh --project capawesome-team-cli",
|
|
16
|
+
"sentry:releases:set-commits": "sentry-cli releases set-commits capawesome-team-cli@$npm_package_version --auto --org genz-it-solutions-gmbh --project capawesome-team-cli",
|
|
17
|
+
"sentry:releases:finalize": "sentry-cli releases finalize capawesome-team-cli@$npm_package_version --org genz-it-solutions-gmbh --project capawesome-team-cli",
|
|
18
18
|
"release": "commit-and-tag-version",
|
|
19
19
|
"prepublishOnly": "npm run build && npm run sentry:releases:new && npm run sentry:releases:set-commits",
|
|
20
20
|
"postpublish": "npm run sentry:releases:finalize"
|