@shoper/cli 0.2.1-5 → 0.3.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.
@@ -0,0 +1,26 @@
1
+ import { BaseCliCommand } from '../../class/base_cli_command.js';
2
+ import { THEME_ACTIONS_API_NAME } from '../../../theme/features/theme/actions/theme_actions_constants.js';
3
+ import { CLI_AUTH_API_NAME } from '../../auth/cli_auth_constants.js';
4
+ import { renderOnce } from '../../../ui/ui_utils.js';
5
+ import { Success } from '../../../ui/message_box/success.js';
6
+ import React from 'react';
7
+ import { Error } from '../../../ui/message_box/error.js';
8
+ import { Box } from '../../../ui/box.js';
9
+ import { Text } from '../../../ui/text.js';
10
+ export class CliAuthLogoutCommand extends BaseCliCommand {
11
+ static summary = 'Clears all stored CLI authentication data';
12
+ async run() {
13
+ const themeActionsApi = this.getApi(THEME_ACTIONS_API_NAME);
14
+ const cliAuthApi = this.getApi(CLI_AUTH_API_NAME);
15
+ try {
16
+ themeActionsApi.clearAllActions();
17
+ cliAuthApi.clearCredentials();
18
+ renderOnce(React.createElement(Success, { header: "Logout successful" }));
19
+ }
20
+ catch (err) {
21
+ renderOnce(React.createElement(Error, { header: "Logout failed" },
22
+ React.createElement(Box, null,
23
+ React.createElement(Text, null, err.toString()))));
24
+ }
25
+ }
26
+ }
@@ -6,7 +6,8 @@ export const CLI_COMMANDS_NAMES = {
6
6
  authListTokens: `${CLI_AUTH_TOPIC_NAME}:list-tokens`,
7
7
  authAddToken: `${CLI_AUTH_TOPIC_NAME}:add-token`,
8
8
  authRemoveToken: `${CLI_AUTH_TOPIC_NAME}:remove-token`,
9
- switchToken: `${CLI_AUTH_TOPIC_NAME}:switch-token`,
9
+ authSwitchToken: `${CLI_AUTH_TOPIC_NAME}:switch-token`,
10
+ authLogout: `${CLI_AUTH_TOPIC_NAME}:logout`,
10
11
  uiDump: 'ui-dump',
11
12
  cleanCache: 'clean-cache'
12
13
  };
package/build/index.js CHANGED
@@ -8,7 +8,7 @@ import { CliAuthAddTokenCommand } from './cli/commands/auth/cli_auth_add_token_c
8
8
  import { CliAuthRemoveTokenCommand } from './cli/commands/auth/cli_auth_remove_token_command.js';
9
9
  import { CliAuthSwitchTokenCommand } from './cli/commands/auth/cli_auth_switch_token_command.js';
10
10
  import { CliUIDumpCommand } from './cli/commands/cli_ui_dump_command.js';
11
- import { CliCleanCache } from './cli/commands/cli_clean_cache.js';
11
+ import { CliAuthLogoutCommand } from './cli/commands/auth/cli_auth_logout_command.js';
12
12
  //TODO
13
13
  //@ts-ignore
14
14
  if (typeof global.crypto !== 'object') {
@@ -43,9 +43,9 @@ export const COMMANDS = {
43
43
  [CLI_COMMANDS_NAMES.authListTokens]: CliAuthListTokensCommand,
44
44
  [CLI_COMMANDS_NAMES.authAddToken]: CliAuthAddTokenCommand,
45
45
  [CLI_COMMANDS_NAMES.authRemoveToken]: CliAuthRemoveTokenCommand,
46
- [CLI_COMMANDS_NAMES.switchToken]: CliAuthSwitchTokenCommand,
46
+ [CLI_COMMANDS_NAMES.authSwitchToken]: CliAuthSwitchTokenCommand,
47
+ [CLI_COMMANDS_NAMES.authLogout]: CliAuthLogoutCommand,
47
48
  [CLI_COMMANDS_NAMES.uiDump]: CliUIDumpCommand,
48
- [CLI_COMMANDS_NAMES.cleanCache]: CliCleanCache,
49
49
  ...THEME_COMMANDS
50
50
  };
51
51
  export { runCLI } from './cli/index.js';
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@shoper/cli",
3
3
  "packageManager": "yarn@3.2.0",
4
4
  "sideEffects": false,
5
- "version": "0.2.1-5",
5
+ "version": "0.3.0",
6
6
  "description": "CLI tool for Shoper",
7
7
  "author": "Joanna Firek",
8
8
  "license": "MIT",
@@ -26,7 +26,9 @@
26
26
  "watch": "rimraf ./build/ && tsc --watch --project tsconfig.json",
27
27
  "test": "jest --config config/jest/jest.config.mjs",
28
28
  "test:watch": "jest --config config/jest/jest.config.mjs --no-cache --watch",
29
- "deploy:latest": "npm run build && npm publish --tag latest --access public",
29
+ "deploy:latest:major": "npm run build && npm version major --no-git-tag-version && npm publish --tag latest --access public",
30
+ "deploy:latest:minor": "npm run build && npm version minor --no-git-tag-version && npm publish --tag latest --access public",
31
+ "deploy:latest:patch": "npm run build && npm version patch --no-git-tag-version && npm publish --tag latest --access public",
30
32
  "deploy:beta": "npm run build && npm version prerelease --no-git-tag-version && npm publish --tag beta --access public"
31
33
  },
32
34
  "dependencies": {
@@ -1,26 +0,0 @@
1
- import { BaseCliCommand } from '../class/base_cli_command.js';
2
- import { THEME_ACTIONS_API_NAME } from '../../theme/features/theme/actions/theme_actions_constants.js';
3
- import { CLI_AUTH_API_NAME } from '../auth/cli_auth_constants.js';
4
- import { renderOnce } from '../../ui/ui_utils.js';
5
- import { Success } from '../../ui/message_box/success.js';
6
- import React from 'react';
7
- import { Error } from '../../ui/message_box/error.js';
8
- import { Box } from '../../ui/box.js';
9
- import { Text } from '../../ui/text.js';
10
- export class CliCleanCache extends BaseCliCommand {
11
- static summary = 'Clears all cached data';
12
- async run() {
13
- const themeActionsApi = this.getApi(THEME_ACTIONS_API_NAME);
14
- const cliAuthApi = this.getApi(CLI_AUTH_API_NAME);
15
- try {
16
- themeActionsApi.clearAllActions();
17
- cliAuthApi.clearCredentials();
18
- renderOnce(React.createElement(Success, { header: "Cache cleared" }));
19
- }
20
- catch (err) {
21
- renderOnce(React.createElement(Error, { header: "Error during cache cleaning" },
22
- React.createElement(Box, null,
23
- React.createElement(Text, null, err.toString()))));
24
- }
25
- }
26
- }