@shoper/cli 0.2.1-4 → 0.2.1-6

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.
@@ -13,4 +13,7 @@ export class CliAuthApi extends FeatureApi {
13
13
  hasCredentialsExpired() {
14
14
  return this.#cliAuthService.hasCredentialsExpired();
15
15
  }
16
+ clearCredentials() {
17
+ return this.#cliAuthService.clearCredentials();
18
+ }
16
19
  }
@@ -31,4 +31,8 @@ export class CliAuthService {
31
31
  return true;
32
32
  return this.#cliAuthTokensApi.hasTokenExpired(defaultTokenIndex);
33
33
  }
34
+ clearCredentials() {
35
+ this.#credentials = null;
36
+ this.#cliAuthTokensApi.clearTokens();
37
+ }
34
38
  }
@@ -43,4 +43,7 @@ export class CliAuthTokensApi extends FeatureApi {
43
43
  validateToken(token) {
44
44
  return this.#service.validateToken(token);
45
45
  }
46
+ clearTokens() {
47
+ this.#service.clearTokens();
48
+ }
46
49
  }
@@ -86,4 +86,7 @@ export class CLiAuthTokensService {
86
86
  const tokens = this._getTokenItems();
87
87
  return tokens.map((tokenItem) => CLiAuthTokensUtils.getTokenPayload(tokenItem.token));
88
88
  }
89
+ clearTokens() {
90
+ this.#tokensStore.clear();
91
+ }
89
92
  }
@@ -8,6 +8,7 @@ export class JsonCache extends FeatureCore {
8
8
  this.#cache = new Conf({
9
9
  cwd: path,
10
10
  configName: name,
11
+ clearInvalidConfig: true,
11
12
  configFileMode,
12
13
  ...rest
13
14
  });
@@ -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,6 +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`,
10
- uiDump: 'ui-dump'
9
+ authSwitchToken: `${CLI_AUTH_TOPIC_NAME}:switch-token`,
10
+ authLogout: `${CLI_AUTH_TOPIC_NAME}:logout`,
11
+ uiDump: 'ui-dump',
12
+ cleanCache: 'clean-cache'
11
13
  };
@@ -11,6 +11,8 @@ import { CliAuthInitializer } from '../auth/cli_auth_initializer.js';
11
11
  import { THEME_TOPIC_NAME } from '../../theme/commands/theme_commands_constants.js';
12
12
  import { getThemeInitializersForCommand } from '../../theme/index.js';
13
13
  import { CLI_AUTH_TOPIC_NAME, CLI_COMMANDS_NAMES } from '../commands/commands_constants.js';
14
+ import { ThemeActionsInitializer } from '../../theme/features/theme/actions/theme_actions_initializer.js';
15
+ import { ThemesListInitializer } from '../../theme/features/themes/list/themes_list_initializer.js';
14
16
  tmp.setGracefulCleanup();
15
17
  export const cliSetup = async () => {
16
18
  //TODO jakis ładny komuniakt błedu
@@ -52,12 +54,15 @@ const getCommandWithTopicBaseInitializers = () => {
52
54
  return [];
53
55
  };
54
56
  const getCommandWithoutTopicBaseInitializers = () => {
55
- const command = process.argv[3];
57
+ const command = process.argv[2];
56
58
  switch (command) {
57
59
  case CLI_COMMANDS_NAMES.version:
58
60
  case CLI_COMMANDS_NAMES.update: {
59
61
  return [CliVersionInitializer];
60
62
  }
63
+ case CLI_COMMANDS_NAMES.cleanCache: {
64
+ return [ThemesListInitializer, ThemeActionsInitializer];
65
+ }
61
66
  }
62
67
  return [];
63
68
  };
package/build/index.js CHANGED
@@ -8,6 +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 { CliAuthLogoutCommand } from './cli/commands/auth/cli_auth_logout_command.js';
11
12
  //TODO
12
13
  //@ts-ignore
13
14
  if (typeof global.crypto !== 'object') {
@@ -42,45 +43,9 @@ export const COMMANDS = {
42
43
  [CLI_COMMANDS_NAMES.authListTokens]: CliAuthListTokensCommand,
43
44
  [CLI_COMMANDS_NAMES.authAddToken]: CliAuthAddTokenCommand,
44
45
  [CLI_COMMANDS_NAMES.authRemoveToken]: CliAuthRemoveTokenCommand,
45
- [CLI_COMMANDS_NAMES.switchToken]: CliAuthSwitchTokenCommand,
46
+ [CLI_COMMANDS_NAMES.authSwitchToken]: CliAuthSwitchTokenCommand,
47
+ [CLI_COMMANDS_NAMES.authLogout]: CliAuthLogoutCommand,
46
48
  [CLI_COMMANDS_NAMES.uiDump]: CliUIDumpCommand,
47
49
  ...THEME_COMMANDS
48
50
  };
49
51
  export { runCLI } from './cli/index.js';
50
- /**
51
- * Przetestowane na win
52
- * oglne
53
- * moduly:
54
- * - stworzony w admince
55
- * - pull w cli - v
56
- * - updejt modulu w adminc i pull w cli - v
57
- * - zmiana nazwy katalogu w cli, modzenie w admince i pull - v
58
- * - kopiowanie stworzonego modulu w admince i push (usuniety id i code) - v
59
- * - zminaa w cli i push - v
60
- * - tworzenie modulu w cli, min plikow i push
61
- * - aktualizowanie js/twig/settings/schema
62
- * - zmiana w adminc i pull
63
- * - usuwanie modulu z cli - v
64
- * - usuwanie modulu z adminki - v
65
- * - dodanie niedozwolonego pliku do folderu modulu
66
- * - dodanie niedozwolonego pliku do folderu modules/
67
- * - translacje - v
68
- * macro:
69
- * - dodawanie pliku do macros - v
70
- * - usuniecie macro - v
71
- * - modzneie makro - v
72
- * - dodawanie customowego macro - v
73
- * - push customowego macro - v
74
- * - modzenie w admince i pull - v
75
- * settingsy:
76
- * - uzupelniania schemy w admince, pull w cli
77
- * - uzupelnianie wartosci a admince i pull
78
- * - modzenie w cli
79
- * - usuniecie pliku w cli
80
- * styles:
81
- * - modzenie stylu w src - niedozwolone - v
82
- * - modzenie custom - v
83
- * - usuniecie custom - v
84
- * - modzenie schema i settings - v
85
- * dodanie czegos w .shoper
86
- */
@@ -19,4 +19,7 @@ export class ThemeActionsApi extends FeatureApi {
19
19
  removeThemeActions(props) {
20
20
  return this.#service.removeThemeActions(props);
21
21
  }
22
+ clearAllActions() {
23
+ return this.#service.clearAllActions();
24
+ }
22
25
  }
@@ -101,4 +101,7 @@ export class ThemeActionsService {
101
101
  }
102
102
  });
103
103
  }
104
+ clearAllActions() {
105
+ this.#themesActionsStore.clear();
106
+ }
104
107
  }
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-4",
5
+ "version": "0.2.1-6",
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 prerelease --no-git-tag-version && npm publish --tag latest --access public",
30
+ "deploy:latest:minor": "npm run build && npm version prerelease --no-git-tag-version && npm publish --tag latest --access public",
31
+ "deploy:latest:patch": "npm run build && npm version prerelease --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": {
@@ -40,31 +42,31 @@
40
42
  "axios": "1.8.4",
41
43
  "chalk": "5.4.1",
42
44
  "conf": "13.1.0",
45
+ "fast-glob": "3.3.3",
46
+ "figures": "6.1.0",
47
+ "fs-extra": "11.3.0",
48
+ "fs-tree-diff": "2.0.1",
43
49
  "ink": "6.0.1",
50
+ "ink-link": "4.1.0",
44
51
  "inquirer": "12.5.2",
52
+ "inquirer-select-line": "1.1.3",
45
53
  "is-hidden-file": "1.1.2",
46
54
  "jsonwebtoken": "9.0.2",
55
+ "klaw": "4.1.0",
56
+ "lodash": "4.17.21",
57
+ "log-symbols": "7.0.1",
47
58
  "memfs": "4.17.0",
48
59
  "ora": "8.2.0",
49
60
  "react": "19.1.0",
50
61
  "reflect-metadata": "0.2.2",
51
62
  "rxjs": "7.8.2",
52
63
  "semver": "7.7.1",
64
+ "strip-ansi": "7.1.0",
53
65
  "tmp-promise": "3.0.3",
54
- "yauzl": "3.2.0",
55
- "yazl": "3.3.1",
56
- "fs-tree-diff": "2.0.1",
57
- "fast-glob": "3.3.3",
58
- "klaw": "4.1.0",
59
- "walk-sync": "3.0.0",
60
- "lodash": "4.17.21",
61
66
  "uuid": "11.1.0",
62
- "fs-extra": "11.3.0",
63
- "ink-link": "4.1.0",
64
- "log-symbols": "7.0.1",
65
- "figures": "6.1.0",
66
- "strip-ansi": "7.1.0",
67
- "inquirer-select-line": "1.1.3"
67
+ "walk-sync": "3.0.0",
68
+ "yauzl": "3.2.0",
69
+ "yazl": "3.3.1"
68
70
  },
69
71
  "devDependencies": {
70
72
  "@babel/core": "7.27.1",
@@ -72,29 +74,29 @@
72
74
  "@babel/preset-typescript": "7.27.1",
73
75
  "@oclif/test": "4.1.12",
74
76
  "@tsconfig/node20": "20.1.6",
75
- "@types/jest": "29.5.14",
76
77
  "@types/fs-extra": "11.0.4",
78
+ "@types/jest": "29.5.14",
77
79
  "@types/jsonwebtoken": "9.0.9",
80
+ "@types/klaw": "3.0.7",
81
+ "@types/lodash": "4.17.17",
78
82
  "@types/node": "18.19.84",
79
83
  "@types/react": "19.1.8",
80
84
  "@types/semver": "7.7.0",
81
85
  "@types/tmp": "0.2.6",
82
86
  "@types/yauzl": "2.10.3",
83
87
  "@types/yazl": "2.4.6",
84
- "@types/klaw": "3.0.7",
85
- "@types/lodash": "4.17.17",
86
88
  "@typescript-eslint/eslint-plugin": "8.29.1",
87
89
  "babel-jest": "29.7.0",
88
90
  "eslint": "9.24.0",
89
91
  "eslint-config-prettier": "10.1.1",
90
92
  "eslint-plugin-prettier": "5.2.6",
91
93
  "jest": "29.7.0",
94
+ "jest-extended": "4.0.2",
92
95
  "module-alias": "2.2.3",
93
96
  "prettier": "3.5.3",
94
97
  "rimraf": "5.0.10",
95
98
  "ts-jest": "29.3.2",
96
99
  "ts-toolbelt": "9.6.0",
97
- "typescript": "5.8.3",
98
- "jest-extended": "4.0.2"
100
+ "typescript": "5.8.3"
99
101
  }
100
102
  }