@eeacms/volto-widget-toggle 3.1.3 → 4.0.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.
package/.eslintrc.js ADDED
@@ -0,0 +1,65 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const projectRootPath = fs.realpathSync(__dirname + '/../../../');
4
+
5
+ let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
6
+ let configFile;
7
+ if (fs.existsSync(`${projectRootPath}/tsconfig.json`))
8
+ configFile = `${projectRootPath}/tsconfig.json`;
9
+ else if (fs.existsSync(`${projectRootPath}/jsconfig.json`))
10
+ configFile = `${projectRootPath}/jsconfig.json`;
11
+
12
+ if (configFile) {
13
+ const jsConfig = require(configFile).compilerOptions;
14
+ const pathsConfig = jsConfig.paths;
15
+ if (pathsConfig['@plone/volto'])
16
+ voltoPath = `./${jsConfig.baseUrl}/${pathsConfig['@plone/volto'][0]}`;
17
+ }
18
+
19
+ const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
20
+ const reg = new AddonConfigurationRegistry(projectRootPath);
21
+
22
+ // Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
23
+ const addonAliases = Object.keys(reg.packages).map((o) => [
24
+ o,
25
+ reg.packages[o].modulePath,
26
+ ]);
27
+
28
+ const addonExtenders = reg.getEslintExtenders().map((m) => require(m));
29
+
30
+ const defaultConfig = {
31
+ extends: `${voltoPath}/.eslintrc`,
32
+ settings: {
33
+ 'import/resolver': {
34
+ alias: {
35
+ map: [
36
+ ['@plone/volto', '@plone/volto/src'],
37
+ ['@plone/volto-slate', '@plone/volto/packages/volto-slate/src'],
38
+ ...addonAliases,
39
+ ['@package', `${__dirname}/src`],
40
+ ['@root', `${__dirname}/src`],
41
+ ['~', `${__dirname}/src`],
42
+ ],
43
+ extensions: ['.js', '.jsx', '.json'],
44
+ },
45
+ 'babel-plugin-root-import': {
46
+ rootPathSuffix: 'src',
47
+ },
48
+ },
49
+ },
50
+ rules: {
51
+ 'react/jsx-no-target-blank': [
52
+ 'error',
53
+ {
54
+ allowReferrer: true,
55
+ },
56
+ ],
57
+ }
58
+ };
59
+
60
+ const config = addonExtenders.reduce(
61
+ (acc, extender) => extender.modify(acc),
62
+ defaultConfig,
63
+ );
64
+
65
+ module.exports = config;
package/CHANGELOG.md CHANGED
@@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [4.0.0](https://github.com/eea/volto-widget-toggle/compare/3.1.4...4.0.0) - 22 April 2024
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: Release 4.0.0 - Volto 17 support [alin - [`b1db508`](https://github.com/eea/volto-widget-toggle/commit/b1db5088cca5e0a580b97a00836365e8b2c39921)]
12
+ - feat: Volto 17 support - refs #264527 [EEA Jenkins - [`06fd934`](https://github.com/eea/volto-widget-toggle/commit/06fd9344ec36b88810c16288030bf91ce1a854a8)]
13
+
14
+ #### :house: Internal changes
15
+
16
+ - chore: husky, lint-staged use fixed versions [valentinab25 - [`78c47fe`](https://github.com/eea/volto-widget-toggle/commit/78c47fea7a704d1addd796ac5f515d262379da92)]
17
+
18
+ #### :hammer_and_wrench: Others
19
+
20
+ ### [3.1.4](https://github.com/eea/volto-widget-toggle/compare/3.1.3...3.1.4) - 16 October 2023
21
+
22
+ #### :house: Internal changes
23
+
24
+ - chore:volto 16 in tests, update docs, fix stylelint overrides [valentinab25 - [`4eb68b6`](https://github.com/eea/volto-widget-toggle/commit/4eb68b6b81b0edb87b477e91cb758475f1d51ea2)]
25
+
26
+ #### :hammer_and_wrench: Others
27
+
28
+ - Update README [Cretu Mihaela - [`42d5a69`](https://github.com/eea/volto-widget-toggle/commit/42d5a6959d6b8f8679ceac063aa16a558096b62a)]
7
29
  ### [3.1.3](https://github.com/eea/volto-widget-toggle/compare/3.1.2...3.1.3) - 29 September 2023
8
30
 
9
31
  #### :house: Internal changes
@@ -19,7 +41,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
19
41
 
20
42
  - test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`b2f509e`](https://github.com/eea/volto-widget-toggle/commit/b2f509eb236e0beeccfc8bc89f4c6527a3fca223)]
21
43
  - test: Fix package.json scripts to use makefile [Alin Voinea - [`72e8245`](https://github.com/eea/volto-widget-toggle/commit/72e8245a4741988849eaa73e5fd238ff6d340fa9)]
22
- - test: Fix eslint and yarn i18n [Alin Voinea - [`034eaf8`](https://github.com/eea/volto-widget-toggle/commit/034eaf890faa3a9c09aa6f4ddca1bc04e46782a8)]
23
44
  - i18n: Add en [Alin Voinea - [`e60d799`](https://github.com/eea/volto-widget-toggle/commit/e60d799a64230544e37e1f4796dc73bbc0e674c6)]
24
45
  - test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`f86b2f7`](https://github.com/eea/volto-widget-toggle/commit/f86b2f7119f24b637e8bc8101effc2c2c3416a65)]
25
46
  ### [3.1.2](https://github.com/eea/volto-widget-toggle/compare/3.1.1...3.1.2) - 24 July 2023
@@ -30,20 +51,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
30
51
 
31
52
  - test: jest should look for addons in node_modules Refs #253277 [valentinab25 - [`da228a9`](https://github.com/eea/volto-widget-toggle/commit/da228a925ea784b4b418f37ea07418de87759670)]
32
53
  - test: Fix test config, coverage Refs #253277 [valentinab25 - [`b4f3492`](https://github.com/eea/volto-widget-toggle/commit/b4f3492448826968dfbb979fad00f0b65d644017)]
33
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`08bfec1`](https://github.com/eea/volto-widget-toggle/commit/08bfec176ebdf6dff13a7db969a73ca9d8415ee8)]
34
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`1324cce`](https://github.com/eea/volto-widget-toggle/commit/1324cceab3305bf02ab2004a4ff77d492f44481e)]
35
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`13d684d`](https://github.com/eea/volto-widget-toggle/commit/13d684daf218103723779a470ff3dc7f101e93c1)]
36
54
  ### [3.1.0](https://github.com/eea/volto-widget-toggle/compare/3.0.1...3.1.0) - 27 March 2023
37
55
 
38
56
  #### :hammer_and_wrench: Others
39
57
 
40
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`11a80c7`](https://github.com/eea/volto-widget-toggle/commit/11a80c7ce1f66aa0c7ec600c626875ab7ac8c1cb)]
41
- - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`c353ca1`](https://github.com/eea/volto-widget-toggle/commit/c353ca1794b99b2e5f6681ad93ab844ef33e117e)]
42
- - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`143e5be`](https://github.com/eea/volto-widget-toggle/commit/143e5be8400af60658baa34a7934f707df121f83)]
43
58
  - test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`c658d9f`](https://github.com/eea/volto-widget-toggle/commit/c658d9f0fc0fc6cc4b26041b79c93c0982b152c5)]
44
- - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`6f8b43e`](https://github.com/eea/volto-widget-toggle/commit/6f8b43e0fe92d2065725be355b800446fedf2992)]
45
- - yarn 3 [Alin Voinea - [`02d53da`](https://github.com/eea/volto-widget-toggle/commit/02d53daff4ee2886f5533ce8afd0d4e67cd0a9f1)]
46
- - Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`42059ef`](https://github.com/eea/volto-widget-toggle/commit/42059efe39cf11c31b1a48ddf6503aaf9da14db7)]
47
59
  ### [3.0.1](https://github.com/eea/volto-widget-toggle/compare/3.0.0...3.0.1) - 16 November 2022
48
60
 
49
61
  #### :hammer_and_wrench: Others
@@ -56,21 +68,15 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
56
68
  - Cleanup [Alin Voinea - [`f0bfe89`](https://github.com/eea/volto-widget-toggle/commit/f0bfe892db782472d0911b3562346d80bed2fb94)]
57
69
  - Typo [Miu Razvan - [`f1faa3d`](https://github.com/eea/volto-widget-toggle/commit/f1faa3d1c0239d377a75b375dcf092cea048c121)]
58
70
  - Use latest cypress [Miu Razvan - [`165ef4a`](https://github.com/eea/volto-widget-toggle/commit/165ef4a017833e757a69da734985acd18155228e)]
59
- - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`45037b0`](https://github.com/eea/volto-widget-toggle/commit/45037b01295d0593929af9ff6f53823e51129f43)]
60
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`de17f98`](https://github.com/eea/volto-widget-toggle/commit/de17f983029cda87580f39b6ab7b1a0139e080cd)]
61
71
  - update(jest): add @plone/volto-slate resolver refs- #153447 [nileshgulia1 - [`b5e6889`](https://github.com/eea/volto-widget-toggle/commit/b5e6889bc22efaeec2025bd79dfe2a839650e4a6)]
62
72
  ### [2.2.7](https://github.com/eea/volto-widget-toggle/compare/2.2.6...2.2.7) - 30 June 2022
63
73
 
64
74
  #### :hammer_and_wrench: Others
65
75
 
66
- - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`78e846a`](https://github.com/eea/volto-widget-toggle/commit/78e846a63de32fc42db181a07859a886b10d8b4e)]
67
- - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`75191c3`](https://github.com/eea/volto-widget-toggle/commit/75191c366506d17db335e2b305e5ea8f058e9dfb)]
68
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`3806c6c`](https://github.com/eea/volto-widget-toggle/commit/3806c6c481c069ab939b7603c7d3e102563276dd)]
69
76
  ### [2.2.6](https://github.com/eea/volto-widget-toggle/compare/2.2.5...2.2.6) - 3 January 2022
70
77
 
71
78
  #### :hammer_and_wrench: Others
72
79
 
73
- - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`c2e3484`](https://github.com/eea/volto-widget-toggle/commit/c2e3484b3396dbabf38a8b9e8f6df0b89d4aa663)]
74
80
  ### [2.2.5](https://github.com/eea/volto-widget-toggle/compare/2.2.4...2.2.5) - 16 December 2021
75
81
 
76
82
  ### [2.2.4](https://github.com/eea/volto-widget-toggle/compare/2.2.3...2.2.4) - 10 December 2021
@@ -78,13 +84,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
78
84
  #### :hammer_and_wrench: Others
79
85
 
80
86
  - Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`2bd2039`](https://github.com/eea/volto-widget-toggle/commit/2bd203979963ee5cb15592470e1d341d1bd65291)]
81
- - Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`af5afe1`](https://github.com/eea/volto-widget-toggle/commit/af5afe1263aff21801bbb8239163ac01644f2a7e)]
82
- - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`2d60373`](https://github.com/eea/volto-widget-toggle/commit/2d60373b280dcb2f902e4dc6fff0bdb8ea7d7ac7)]
83
- - Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`80527c1`](https://github.com/eea/volto-widget-toggle/commit/80527c1f72bd8cc325ff1c072def18d24c3e99ae)]
84
- - Add Sonarqube tag using sustainability-frontend addons list [EEA Jenkins - [`bc52e72`](https://github.com/eea/volto-widget-toggle/commit/bc52e72e32197ca82f93bac645f0094bc7db7ab1)]
85
- - Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`30397bd`](https://github.com/eea/volto-widget-toggle/commit/30397bde9a045be3c2e6614af798ce11f18e3039)]
86
- - Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`dd3fb67`](https://github.com/eea/volto-widget-toggle/commit/dd3fb67693900db1ce6d8f631c61a2a5c25d9b70)]
87
- - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`54d09d1`](https://github.com/eea/volto-widget-toggle/commit/54d09d164591f1cf3d47a69838ccbd9abb8f22b6)]
88
87
  ### [2.2.3](https://github.com/eea/volto-widget-toggle/compare/2.2.2...2.2.3) - 28 June 2021
89
88
 
90
89
  #### :hammer_and_wrench: Others
@@ -118,7 +117,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
118
117
 
119
118
  - Release 1.0.1 [Alin Voinea - [`454220f`](https://github.com/eea/volto-widget-toggle/commit/454220fa61495427f874fb9b56401fe69689f4fe)]
120
119
  - Auto-release npm [Alin Voinea - [`10b31b3`](https://github.com/eea/volto-widget-toggle/commit/10b31b3b64330d41f69a033a45030e49d20c16b5)]
121
- - yarn prettier [Alin Voinea - [`5136059`](https://github.com/eea/volto-widget-toggle/commit/51360595bf452c815e526ce10f15aa8a84ad186f)]
122
120
  ## [1.0.0](https://github.com/eea/volto-widget-toggle/compare/0.1.0...1.0.0) - 29 September 2020
123
121
 
124
122
  #### :hammer_and_wrench: Others
package/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  ## Features
20
20
 
21
- ![Toogle Checkboxes](https://raw.githubusercontent.com/eea/volto-widget-toggle/docs/docs/volto-widget-toggle.gif)
21
+ ![Toogle Checkboxes](https://raw.githubusercontent.com/eea/volto-widget-toggle/master/docs/volto-widget-toggle.gif)
22
22
 
23
23
  ## Getting started
24
24
 
package/RELEASE.md CHANGED
@@ -20,9 +20,9 @@ You need to first install the [release-it](https://github.com/release-it/release
20
20
  ```
21
21
  npm install -g release-it
22
22
  ```
23
-
23
+
24
24
  Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.
25
-
25
+
26
26
  Release-it is a tool that automates 4 important steps in the release process:
27
27
 
28
28
  1. Version increase in `package.json` ( increased from the current version in `package.json`)
@@ -30,45 +30,45 @@ Release-it is a tool that automates 4 important steps in the release process:
30
30
  3. GitHub release on the commit with the changelog and package.json modification on the develop branch
31
31
  4. NPM release ( by default it's disabled, but can be enabled in the configuration file )
32
32
 
33
- To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
33
+ To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
34
34
 
35
35
  ```
36
36
  export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
37
37
  ```
38
-
38
+
39
39
  To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
40
-
40
+
41
41
  ```
42
42
  echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
43
43
  ```
44
44
 
45
45
  #### Using release-it tool
46
-
46
+
47
47
  There are 3 yarn scripts that can be run to do the release
48
48
 
49
49
  ##### yarn release-beta
50
50
 
51
- Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
51
+ Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
52
52
 
53
53
  ```
54
- ? Select increment (next version):
55
- ❯ prepatch (0.1.1-beta.0)
56
- preminor (0.2.0-beta.0)
57
- premajor (1.0.0-beta.0)
58
- Other, please specify...
54
+ ? Select increment (next version):
55
+ ❯ prepatch (0.1.1-beta.0)
56
+ preminor (0.2.0-beta.0)
57
+ premajor (1.0.0-beta.0)
58
+ Other, please specify...
59
59
  ```
60
60
 
61
61
  ##### yarn release-major-beta
62
62
 
63
63
  Same as `yarn release-beta`, but with premajor version pre-selected.
64
-
64
+
65
65
  ##### yarn release
66
66
 
67
67
  Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
68
68
 
69
69
  #### Important notes
70
70
 
71
- > Do not use release-it tool on master branch, the commit on CHANGELOG.md file and the version increase in the package.json file can't be done without a PULL REQUEST.
71
+ > Do not use release-it tool on master branch, the commit on CHANGELOG.md file and the version increase in the package.json file can't be done without a PULL REQUEST.
72
72
 
73
73
  > Do not keep Pull Requests from develop to master branches open when you are doing beta releases from the develop branch. As long as a PR to master is open, an automatic script will run on every commit and will update both the version and the changelog to a production-ready state - ( MAJOR.MINOR.PATCH mandatory format for version).
74
74
 
package/cypress.config.js CHANGED
@@ -2,12 +2,12 @@ const { defineConfig } = require('cypress');
2
2
 
3
3
  module.exports = defineConfig({
4
4
  viewportWidth: 1280,
5
- defaultCommandTimeout: 5000,
5
+ defaultCommandTimeout: 8888,
6
6
  chromeWebSecurity: false,
7
7
  reporter: 'junit',
8
- video: true,
8
+ video: false,
9
9
  retries: {
10
- runMode: 1,
10
+ runMode: 2,
11
11
  openMode: 0,
12
12
  },
13
13
  reporterOptions: {
@@ -1,3 +1,5 @@
1
+ require('dotenv').config({ path: __dirname + '/.env' })
2
+
1
3
  module.exports = {
2
4
  testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
3
5
  collectCoverageFrom: [
@@ -9,18 +11,26 @@ module.exports = {
9
11
  '@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
10
12
  '@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
11
13
  '@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
12
- '@package/(.*)$': '<rootDir>/src/$1',
13
- '@root/(.*)$': '<rootDir>/src/$1',
14
+ '@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
15
+ '@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
14
16
  '@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
17
+ '@eeacms/search/(.*)$': '<rootDir>/src/addons/volto-searchlib/searchlib/$1',
18
+ '@eeacms/search': '<rootDir>/src/addons/volto-searchlib/searchlib',
15
19
  '@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
16
- '@plone/volto-slate':
20
+ '@plone/volto-slate$':
17
21
  '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
22
+ '@plone/volto-slate/(.*)$':
23
+ '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src/$1',
18
24
  '~/(.*)$': '<rootDir>/src/$1',
19
25
  'load-volto-addons':
20
26
  '<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
21
27
  },
28
+ transformIgnorePatterns: [
29
+ '/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
30
+ ],
22
31
  transform: {
23
32
  '^.+\\.js(x)?$': 'babel-jest',
33
+ '^.+\\.ts(x)?$': 'babel-jest',
24
34
  '^.+\\.(png)$': 'jest-file',
25
35
  '^.+\\.(jpg)$': 'jest-file',
26
36
  '^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
@@ -33,4 +43,9 @@ module.exports = {
33
43
  statements: 5,
34
44
  },
35
45
  },
36
- };
46
+ ...(process.env.JEST_USE_SETUP === 'ON' && {
47
+ setupFilesAfterEnv: [
48
+ '<rootDir>/node_modules/@eeacms/volto-widget-toggle/jest.setup.js',
49
+ ],
50
+ }),
51
+ }
package/jest.setup.js ADDED
@@ -0,0 +1,65 @@
1
+ import { jest } from '@jest/globals';
2
+ import configureStore from 'redux-mock-store';
3
+ import thunk from 'redux-thunk';
4
+ import { blocksConfig } from '@plone/volto/config/Blocks';
5
+ import installSlate from '@plone/volto-slate/index';
6
+
7
+ var mockSemanticComponents = jest.requireActual('semantic-ui-react');
8
+ var mockComponents = jest.requireActual('@plone/volto/components');
9
+ var config = jest.requireActual('@plone/volto/registry').default;
10
+
11
+ config.blocks.blocksConfig = {
12
+ ...blocksConfig,
13
+ ...config.blocks.blocksConfig,
14
+ };
15
+
16
+ jest.doMock('semantic-ui-react', () => ({
17
+ __esModule: true,
18
+ ...mockSemanticComponents,
19
+ Popup: ({ content, trigger }) => {
20
+ return (
21
+ <div className="popup">
22
+ <div className="trigger">{trigger}</div>
23
+ <div className="content">{content}</div>
24
+ </div>
25
+ );
26
+ },
27
+ }));
28
+
29
+ jest.doMock('@plone/volto/components', () => {
30
+ return {
31
+ __esModule: true,
32
+ ...mockComponents,
33
+ SidebarPortal: ({ children }) => <div id="sidebar">{children}</div>,
34
+ };
35
+ });
36
+
37
+ jest.doMock('@plone/volto/registry', () =>
38
+ [installSlate].reduce((acc, apply) => apply(acc), config),
39
+ );
40
+
41
+ const mockStore = configureStore([thunk]);
42
+
43
+ global.fetch = jest.fn(() =>
44
+ Promise.resolve({
45
+ json: () => Promise.resolve({}),
46
+ }),
47
+ );
48
+
49
+ global.store = mockStore({
50
+ intl: {
51
+ locale: 'en',
52
+ messages: {},
53
+ formatMessage: jest.fn(),
54
+ },
55
+ content: {
56
+ create: {},
57
+ subrequests: [],
58
+ },
59
+ connected_data_parameters: {},
60
+ screen: {
61
+ page: {
62
+ width: 768,
63
+ },
64
+ },
65
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-widget-toggle",
3
- "version": "3.1.3",
3
+ "version": "4.0.0",
4
4
  "description": "volto-widget-toggle: Volto add-on to replace checkboxes with toggle buttons",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -22,8 +22,9 @@
22
22
  "@cypress/code-coverage": "^3.10.0",
23
23
  "@plone/scripts": "*",
24
24
  "babel-plugin-transform-class-properties": "^6.24.1",
25
- "husky": "*",
26
- "lint-staged": "*",
25
+ "dotenv": "^16.3.2",
26
+ "husky": "^8.0.3",
27
+ "lint-staged": "^14.0.1",
27
28
  "md5": "^2.3.0"
28
29
  },
29
30
  "lint-staged": {
@@ -1,48 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- const projectRootPath = fs.existsSync('./project')
5
- ? fs.realpathSync('./project')
6
- : fs.realpathSync('./../../../');
7
- const packageJson = require(path.join(projectRootPath, 'package.json'));
8
- const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions;
9
-
10
- const pathsConfig = jsConfig.paths;
11
-
12
- let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
13
-
14
- Object.keys(pathsConfig).forEach(pkg => {
15
- if (pkg === '@plone/volto') {
16
- voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`;
17
- }
18
- });
19
- const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
20
- const reg = new AddonConfigurationRegistry(projectRootPath);
21
-
22
- // Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
23
- const addonAliases = Object.keys(reg.packages).map(o => [
24
- o,
25
- reg.packages[o].modulePath,
26
- ]);
27
-
28
-
29
- module.exports = {
30
- extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
31
- settings: {
32
- 'import/resolver': {
33
- alias: {
34
- map: [
35
- ['@plone/volto', '@plone/volto/src'],
36
- ...addonAliases,
37
- ['@package', `${__dirname}/src`],
38
- ['~', `${__dirname}/src`],
39
- ],
40
- extensions: ['.js', '.jsx', '.json'],
41
- },
42
- 'babel-plugin-root-import': {
43
- rootPathSuffix: 'src',
44
- },
45
- },
46
- },
47
- };
48
-