-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dependencies, add support for Map and Set
- Loading branch information
Showing
10 changed files
with
2,963 additions
and
1,796 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
working_directory: ~/electron-redux | ||
docker: | ||
- image: circleci/node:8-browsers | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- electron-redux2-{{ .Branch }} | ||
- electron-redux2- | ||
- run: | ||
name: Install Dependencies | ||
command: yarn && ./node_modules/.bin/lerna bootstrap | ||
- save_cache: | ||
key: electron-redux2-{{ .Branch }} | ||
paths: | ||
- "~/.cache/yarn" | ||
- "~/electron-redux/node_modules" | ||
- "~/electron-redux/packages/electron-redux/node_modules" | ||
- "~/electron-redux/packages/electron-redux-e2e/node_modules" | ||
- run: | ||
name: Update yarn lockfile | ||
command: ./node_modules/.bin/greenkeeper-lockfile-update | ||
- run: | ||
name: Compile Assets | ||
command: ./node_modules/.bin/lerna run build | ||
- run: | ||
name: Run Tests | ||
command: yarn test | ||
- run: | ||
name: Upload yarn lockfile | ||
command: ./node_modules/.bin/greenkeeper-lockfile-upload | ||
- store_artifacts: | ||
path: ~/electron-redux/packages/electron-redux/dist | ||
destination: dist | ||
- store_artifacts: | ||
path: ~/electron-redux/packages/electron-redux/node_modules/coverage | ||
destination: coverage | ||
build: | ||
working_directory: ~/electron-redux | ||
docker: | ||
- image: circleci/node:12-browsers | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- electron-redux2-{{ .Branch }} | ||
- electron-redux2- | ||
- run: | ||
name: Install Dependencies | ||
command: yarn && ./node_modules/.bin/lerna bootstrap | ||
- save_cache: | ||
key: electron-redux2-{{ .Branch }} | ||
paths: | ||
- "~/.cache/yarn" | ||
- "~/electron-redux/node_modules" | ||
- "~/electron-redux/packages/electron-redux/node_modules" | ||
- "~/electron-redux/packages/electron-redux-e2e/node_modules" | ||
- run: | ||
name: Update yarn lockfile | ||
command: ./node_modules/.bin/greenkeeper-lockfile-update | ||
- run: | ||
name: Compile Assets | ||
command: ./node_modules/.bin/lerna run build | ||
- run: | ||
name: Run Tests | ||
command: yarn test | ||
- run: | ||
name: Upload yarn lockfile | ||
command: ./node_modules/.bin/greenkeeper-lockfile-upload | ||
- store_artifacts: | ||
path: ~/electron-redux/packages/electron-redux/dist | ||
destination: dist | ||
- store_artifacts: | ||
path: ~/electron-redux/packages/electron-redux/node_modules/coverage | ||
destination: coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,28 @@ | ||
{ | ||
"private": true, | ||
"name": "electron-redux", | ||
"version": "1.4.0", | ||
"description": "Using redux in electron", | ||
"main": "index.js", | ||
"repository": "https://github.com/hardchor/electron-redux", | ||
"author": "Burkhard Reffeling <burkhard.reffeling@gmail.com> (http://burgiblog.com)", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"eslint": "^6.1.0", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-plugin-import": "^2.2.0", | ||
"husky": "^2.2.0", | ||
"lerna": "^3.13.4", | ||
"lint-staged": "^9.2.1", | ||
"prettier-eslint-cli": "^5.0.0" | ||
}, | ||
"scripts": { | ||
"test": "lerna run test", | ||
"precommit": "lint-staged" | ||
}, | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"lint-staged": { | ||
"*.{js,jsx,css,md}": [ | ||
"prettier-eslint --single-quote --trailing-comma=all --print-width=100 --write", | ||
"git add" | ||
] | ||
} | ||
"private": true, | ||
"repository": "https://github.com/hardchor/electron-redux", | ||
"author": "Burkhard Reffeling <burkhard.reffeling@gmail.com> (http://burgiblog.com)", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"eslint": "^6.1.0", | ||
"eslint-config-airbnb-base": "^14.1.0", | ||
"eslint-plugin-import": "^2.2.0", | ||
"husky": "^2.2.0", | ||
"lerna": "^3.13.4", | ||
"lint-staged": "^9.2.1", | ||
"prettier-eslint-cli": "^5.0.0" | ||
}, | ||
"scripts": { | ||
"test": "lerna run test", | ||
"precommit": "lint-staged" | ||
}, | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"lint-staged": { | ||
"*.{js,jsx,css,md}": [ | ||
"prettier-eslint --single-quote --trailing-comma=all --print-width=100 --write", | ||
"git add" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
{ | ||
"name": "electron-redux-e2e", | ||
"version": "1.4.0", | ||
"description": "The end-to-end tests for electron-redux", | ||
"main": "app/main.js", | ||
"repository": "https://github.com/hardchor/electron-redux/tree/master/packages/electron-redux-e2e", | ||
"author": "Burkhard Reffeling <burkhard.reffeling@gmail.com> (http://burgiblog.com)", | ||
"license": "MIT", | ||
"private": true, | ||
"dependencies": { | ||
"electron": "^1.7.9", | ||
"electron-redux": "^1.4.0", | ||
"redux": "^4.0.1" | ||
}, | ||
"scripts": { | ||
"start": "electron .", | ||
"test": "jest .", | ||
"snyk-protect": "snyk protect", | ||
"prepublish": "yarn snyk-protect" | ||
}, | ||
"devDependencies": { | ||
"jest": "^21.2.1", | ||
"snyk": "^1.189.0", | ||
"spectron": "^3.7.2" | ||
}, | ||
"snyk": true | ||
"name": "electron-redux-e2e", | ||
"version": "2.0.0", | ||
"description": "The end-to-end tests for electron-redux", | ||
"main": "app/main.js", | ||
"repository": "https://github.com/hardchor/electron-redux/tree/master/packages/electron-redux-e2e", | ||
"author": "Burkhard Reffeling <burkhard.reffeling@gmail.com> (http://burgiblog.com)", | ||
"license": "MIT", | ||
"private": true, | ||
"dependencies": { | ||
"electron": "^8.0.0", | ||
"electron-redux": "^2.0.0", | ||
"redux": "^4.0.1" | ||
}, | ||
"scripts": { | ||
"start": "electron .", | ||
"test": "jest .", | ||
"snyk-protect": "snyk protect", | ||
"prepublish": "yarn snyk-protect" | ||
}, | ||
"devDependencies": { | ||
"jest": "^25.0.0", | ||
"snyk": "^1.189.0", | ||
"spectron": "^10.0.0" | ||
}, | ||
"snyk": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,50 @@ | ||
{ | ||
"name": "electron-redux", | ||
"version": "1.4.0", | ||
"description": "Use redux in the main and browser process in electron", | ||
"main": "dist/index.js", | ||
"files": [ | ||
"dist/**" | ||
], | ||
"scripts": { | ||
"test": "rm -rf coverage && jest --coverage", | ||
"lint": "eslint 'src/**/*'", | ||
"build": "rm -rf dist && babel src --out-dir dist", | ||
"prepare": "yarn build", | ||
"prepush": "yarn test && yarn build", | ||
"snyk-protect": "snyk protect", | ||
"prepublish": "yarn snyk-protect" | ||
}, | ||
"keywords": [ | ||
"electron", | ||
"redux", | ||
"react", | ||
"desktop" | ||
], | ||
"author": "Burkhard Reffeling <burkhard.reffeling@gmail.com> (http://www.burgiblog.com)", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/hardchor/electron-redux.git" | ||
}, | ||
"homepage": "https://github.com/hardchor/electron-redux/tree/master/packages/electron-redux", | ||
"bugs": "https://github.com/hardchor/electron-redux/issues", | ||
"license": "MIT", | ||
"dependencies": { | ||
"debug": "^3.0.0", | ||
"flux-standard-action": "^2.0.0", | ||
"redux": "^4.0.1" | ||
}, | ||
"peerDependencies": { | ||
"redux": "^4.0.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.0.0-beta.34", | ||
"@babel/core": "^7.0.0-beta.34", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.34", | ||
"@babel/preset-env": "^7.0.0-beta.34", | ||
"babel-core": "^7.0.0-0", | ||
"babel-eslint": "^10.0.1", | ||
"babel-jest": "^21.2.0", | ||
"greenkeeper-lockfile": "^1.12.0", | ||
"jest": "^21.2.1", | ||
"snyk": "^1.189.0" | ||
}, | ||
"snyk": true | ||
"name": "electron-redux", | ||
"version": "2.0.0", | ||
"description": "Use redux in the main and browser process in electron", | ||
"main": "dist/index.js", | ||
"files": [ | ||
"dist/**" | ||
], | ||
"scripts": { | ||
"test": "rm -rf coverage && jest --coverage", | ||
"lint": "eslint 'src/**/*'", | ||
"build": "rm -rf dist && babel src --out-dir dist", | ||
"prepare": "yarn build", | ||
"prepush": "yarn test && yarn build", | ||
"snyk-protect": "snyk protect", | ||
"prepublish": "yarn snyk-protect" | ||
}, | ||
"keywords": [ | ||
"electron", | ||
"redux", | ||
"react", | ||
"desktop" | ||
], | ||
"author": "Burkhard Reffeling <burkhard.reffeling@gmail.com> (http://www.burgiblog.com)", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/hardchor/electron-redux.git" | ||
}, | ||
"homepage": "https://github.com/hardchor/electron-redux/tree/master/packages/electron-redux", | ||
"bugs": "https://github.com/hardchor/electron-redux/issues", | ||
"license": "MIT", | ||
"dependencies": { | ||
"debug": "^4.0.0", | ||
"flux-standard-action": "^2.0.0" | ||
}, | ||
"peerDependencies": { | ||
"redux": "^4.0.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.0.0", | ||
"@babel/core": "^7.0.0", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.0.0", | ||
"@babel/preset-env": "^7.0.0", | ||
"babel-eslint": "^10.0.1", | ||
"babel-jest": "^25.0.0", | ||
"jest": "^25.0.0", | ||
"snyk": "^1.189.0" | ||
}, | ||
"snyk": true | ||
} |
16 changes: 14 additions & 2 deletions
16
packages/electron-redux/src/helpers/getInitialStateRenderer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
import { remote } from 'electron'; | ||
|
||
const hydrate = (key, value) => { | ||
if (value?.__hydrate_type === '__hydrate_map') { | ||
return new Map(Object.entries(value).filter(([key]) => key !== '__hydrate_type')); | ||
} else if (value?.__hydrate_type === '__hydrate_set') { | ||
return new Set(value.items); | ||
} | ||
|
||
return value; | ||
}; | ||
|
||
export default function getInitialStateRenderer() { | ||
const getReduxState = remote.getGlobal('getReduxState'); | ||
if (!getReduxState) { | ||
throw new Error('Could not find reduxState global in main process, did you forget to call replayActionMain?'); | ||
throw new Error( | ||
'Could not find reduxState global in main process, did you forget to call replayActionMain?', | ||
); | ||
} | ||
return JSON.parse(getReduxState()); | ||
return JSON.parse(getReduxState(), hydrate); | ||
} |
Oops, something went wrong.