Skip to content

Commit e4d1ac3

Browse files
authored
Merge pull request #1480 from contentstack/staging
DX | 31-07-2024 | Release
2 parents 815910b + eb17776 commit e4d1ac3

File tree

44 files changed

+966
-769
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+966
-769
lines changed

package-lock.json

Lines changed: 569 additions & 559 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/contentstack-audit/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-audit
1919
$ csdx COMMAND
2020
running command...
2121
$ csdx (--version|-v)
22-
@contentstack/cli-audit/1.6.3 darwin-arm64 node-v22.2.0
22+
@contentstack/cli-audit/1.6.4 darwin-arm64 node-v22.2.0
2323
$ csdx --help [COMMAND]
2424
USAGE
2525
$ csdx COMMAND
@@ -267,7 +267,7 @@ EXAMPLES
267267
$ csdx plugins
268268
```
269269

270-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/index.ts)_
270+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.9/src/commands/plugins/index.ts)_
271271

272272
## `csdx plugins:add PLUGIN`
273273

@@ -341,7 +341,7 @@ EXAMPLES
341341
$ csdx plugins:inspect myplugin
342342
```
343343

344-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/inspect.ts)_
344+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.9/src/commands/plugins/inspect.ts)_
345345

346346
## `csdx plugins:install PLUGIN`
347347

@@ -390,7 +390,7 @@ EXAMPLES
390390
$ csdx plugins:install someuser/someplugin
391391
```
392392

393-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/install.ts)_
393+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.9/src/commands/plugins/install.ts)_
394394

395395
## `csdx plugins:link PATH`
396396

@@ -420,7 +420,7 @@ EXAMPLES
420420
$ csdx plugins:link myplugin
421421
```
422422

423-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/link.ts)_
423+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.9/src/commands/plugins/link.ts)_
424424

425425
## `csdx plugins:remove [PLUGIN]`
426426

@@ -461,7 +461,7 @@ FLAGS
461461
--reinstall Reinstall all plugins after uninstalling.
462462
```
463463

464-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/reset.ts)_
464+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.9/src/commands/plugins/reset.ts)_
465465

466466
## `csdx plugins:uninstall [PLUGIN]`
467467

@@ -489,7 +489,7 @@ EXAMPLES
489489
$ csdx plugins:uninstall myplugin
490490
```
491491

492-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/uninstall.ts)_
492+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.9/src/commands/plugins/uninstall.ts)_
493493

494494
## `csdx plugins:unlink [PLUGIN]`
495495

@@ -533,5 +533,5 @@ DESCRIPTION
533533
Update installed plugins.
534534
```
535535

536-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/update.ts)_
536+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.9/src/commands/plugins/update.ts)_
537537
<!-- commandsstop -->

packages/contentstack-audit/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentstack/cli-audit",
3-
"version": "1.6.3",
3+
"version": "1.6.4",
44
"description": "Contentstack audit plugin",
55
"author": "Contentstack CLI",
66
"homepage": "https://github.com/contentstack/cli",
@@ -18,8 +18,8 @@
1818
"/oclif.manifest.json"
1919
],
2020
"dependencies": {
21-
"@contentstack/cli-command": "~1.2.18",
22-
"@contentstack/cli-utilities": "~1.6.3",
21+
"@contentstack/cli-command": "~1.2.19",
22+
"@contentstack/cli-utilities": "~1.7.0",
2323
"@oclif/plugin-help": "^5",
2424
"@oclif/plugin-plugins": "^5.0.0",
2525
"chalk": "^4.1.2",

packages/contentstack-auth/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-auth
1818
$ csdx COMMAND
1919
running command...
2020
$ csdx (--version)
21-
@contentstack/cli-auth/1.3.19 darwin-arm64 node-v22.2.0
21+
@contentstack/cli-auth/1.3.20 darwin-arm64 node-v22.2.0
2222
$ csdx --help [COMMAND]
2323
USAGE
2424
$ csdx COMMAND

packages/contentstack-auth/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-auth",
33
"description": "Contentstack CLI plugin for authentication activities",
4-
"version": "1.3.19",
4+
"version": "1.3.20",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"scripts": {
@@ -22,8 +22,8 @@
2222
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
2323
},
2424
"dependencies": {
25-
"@contentstack/cli-command": "~1.2.18",
26-
"@contentstack/cli-utilities": "~1.6.3",
25+
"@contentstack/cli-command": "~1.2.19",
26+
"@contentstack/cli-utilities": "~1.7.0",
2727
"chalk": "^4.0.0",
2828
"debug": "^4.1.1",
2929
"inquirer": "8.2.4",

packages/contentstack-auth/src/commands/auth/login.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {
55
authHandler as oauthHandler,
66
flags,
77
managementSDKClient,
8-
FlagInput
8+
FlagInput,
9+
formatError
910
} from '@contentstack/cli-utilities';
1011
import { User } from '../../interfaces';
1112
import { authHandler, interactive } from '../../utils';
@@ -64,18 +65,7 @@ export default class LoginCommand extends BaseCommand<typeof LoginCommand> {
6465
await this.login(username, password);
6566
}
6667
} catch (error) {
67-
let errorMessage = '';
68-
if (error) {
69-
if (error.message) {
70-
if (error.message.message) {
71-
errorMessage = error.message.message;
72-
} else {
73-
errorMessage = error.message;
74-
}
75-
} else {
76-
errorMessage = error;
77-
}
78-
}
68+
let errorMessage = formatError(error) || 'Something went wrong while logging. Please try again.';
7969
this.logger.error('login failed', errorMessage);
8070
cliux.error('CLI_AUTH_LOGIN_FAILED');
8171
cliux.error(errorMessage);

packages/contentstack-auth/src/commands/auth/logout.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
authHandler as oauthHandler,
88
managementSDKClient,
99
FlagInput,
10+
formatError,
1011
} from '@contentstack/cli-utilities';
1112

1213
import { authHandler } from '../../utils';
@@ -54,7 +55,7 @@ export default class LogoutCommand extends BaseCommand<typeof LogoutCommand> {
5455
if (await oauthHandler.isAuthorisationTypeBasic()) {
5556
await authHandler.logout(configHandler.get('authtoken'));
5657
} else if (await oauthHandler.isAuthorisationTypeOAuth()) {
57-
await oauthHandler.oauthLogout()
58+
await oauthHandler.oauthLogout();
5859
}
5960
cliux.loader('');
6061
this.logger.info('successfully logged out');
@@ -63,18 +64,7 @@ export default class LogoutCommand extends BaseCommand<typeof LogoutCommand> {
6364
cliux.success('CLI_AUTH_LOGOUT_ALREADY');
6465
}
6566
} catch (error) {
66-
let errorMessage = '';
67-
if (error) {
68-
if (error.message) {
69-
if (error.message.message) {
70-
errorMessage = error.message.message;
71-
} else {
72-
errorMessage = error.message;
73-
}
74-
} else {
75-
errorMessage = error;
76-
}
77-
}
67+
let errorMessage = formatError(error) || 'Something went wrong while logging out. Please try again.';
7868

7969
this.logger.error('Logout failed', errorMessage);
8070
cliux.print('CLI_AUTH_LOGOUT_FAILED', { color: 'yellow' });

packages/contentstack-auth/src/commands/auth/tokens/add.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
HttpClient,
99
messageHandler,
1010
Flags,
11+
formatError,
1112
} from '@contentstack/cli-utilities';
1213
import { askTokenType } from '../../../utils/interactive';
1314
import { BaseCommand } from '../../../base-command';
@@ -159,9 +160,10 @@ export default class TokensAddCommand extends BaseCommand<typeof TokensAddComman
159160
cliux.success('CLI_AUTH_TOKENS_ADD_SUCCESS');
160161
}
161162
} catch (error) {
162-
this.logger.error('token add error', error.message);
163+
let errorMessage = formatError(error) || 'Something went wrong while adding token. Please try again.';
164+
this.logger.error('token add error', errorMessage);
163165
cliux.print('CLI_AUTH_TOKENS_ADD_FAILED', { color: 'yellow' });
164-
cliux.error(error.message.message ? error.message.message : error.message);
166+
cliux.error(errorMessage);
165167
}
166168
}
167169
}

packages/contentstack-auth/src/commands/auth/tokens/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Command } from '@contentstack/cli-command';
2-
import { cliux, configHandler } from '@contentstack/cli-utilities';
2+
import { cliux, configHandler, formatError } from '@contentstack/cli-utilities';
33
import { BaseCommand } from '../../../base-command';
44
export default class TokensListCommand extends BaseCommand<typeof TokensListCommand> {
55
static aliases = ['tokens'];
@@ -52,9 +52,10 @@ export default class TokensListCommand extends BaseCommand<typeof TokensListComm
5252
cliux.print('CLI_AUTH_TOKENS_LIST_NO_TOKENS');
5353
}
5454
} catch (error) {
55-
this.logger.error('Token list error', error.message);
55+
let errorMessage = formatError(error) || 'Something went wrong while fetching tokens. Please try again.';
56+
this.logger.error('Token list error', errorMessage);
5657
cliux.print('CLI_AUTH_TOKENS_LIST_FAILED', { color: 'yellow' });
57-
cliux.print(error.message, { color: 'red' });
58+
cliux.print(errorMessage, { color: 'red' });
5859
}
5960
}
6061
}

packages/contentstack-auth/src/commands/auth/tokens/remove.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Command } from '@contentstack/cli-command';
2-
import { cliux, configHandler, flags, FlagInput } from '@contentstack/cli-utilities';
2+
import { cliux, configHandler, flags, FlagInput, formatError } from '@contentstack/cli-utilities';
33
import { BaseCommand } from '../../../base-command';
44

55
export default class TokensRemoveCommand extends BaseCommand<typeof TokensRemoveCommand> {
@@ -58,9 +58,10 @@ export default class TokensRemoveCommand extends BaseCommand<typeof TokensRemove
5858
this.logger.info('Token removed successfully !!', element);
5959
});
6060
} catch (error) {
61-
this.logger.error('Token remove error', error.message);
61+
let errorMessage = formatError(error) || 'Something went wrong while removing token. Please try again.';
62+
this.logger.error('Token remove error', errorMessage);
6263
cliux.print('CLI_AUTH_TOKENS_REMOVE_FAILED', { color: 'yellow' });
63-
cliux.print(error.message, { color: 'red' });
64+
cliux.print(errorMessage, { color: 'red' });
6465
}
6566
}
6667
}

0 commit comments

Comments
 (0)