diff --git a/README.md b/README.md index 030a028..8929530 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ state, as if you never left. - [React Router Hibernate](./packages/react-router-hibernate/) works per-route, if you're using [React Router](https://reacttraining.com/react-router/) (v5) -- [React Hibernate](./packages/react-hibernate-core/) works for any React subtree +- [React Hibernate](./packages/react-hibernate/) works for any React subtree - [React Pauseable Containers](./packages/react-pauseable-containers/) improve performances by freezing all updates to hibernated subtrees @@ -39,7 +39,7 @@ just a quick, easy way to get "good enough" coverage for the common cases. ## Packages -**[react-hibernate](./packages/react-hibernate-core/)** +**[react-hibernate](./packages/react-hibernate/)** [![npm version](https://img.shields.io/npm/v/react-hibernate.svg)](https://www.npmjs.com/package/react-hibernate) [![gzip size](https://img.shields.io/bundlephobia/minzip/react-hibernate)](https://bundlephobia.com/result?p=react-hibernate@latest) diff --git a/package.json b/package.json index b8674be..5cf4c61 100644 --- a/package.json +++ b/package.json @@ -14,36 +14,37 @@ "author": "Steven Pautz ", "sideEffects": false, "scripts": { - "____ BASE COMMANDS _________________________________________________": "", - "build:all": "lerna exec yon build", - "clean": "rimraf storybook-static/ && rimraf node_modules/.cache/ && yon test:clean", - "clean:all": "yon clean && lerna exec yon clean", - "prepare:all": "lerna exec yon prepare", - "release:changelog": "standard-version --skip.commit --skip.tag --release-as ", - "release:tag": "standard-version --sign --skip.changelog --release-as ", - "test": "jest --coverage", - "test:clean": "rimraf coverage/ && lerna exec yon test:clean", - "test:watch": "jest --coverage --watch", - "test:report": "jest --coverage --coverageReporters=text-lcov | coveralls", + "____ LIFECYCLE HOOKS _______________________________________________": "", + "prepare": "lerna bootstrap --ignore-scripts && yon packages:prepare", + "prepublishOnly": "yon checkup && yon packages:build", + "prerelease": "yon clean", + "pretest": "yon test:clean", + "____ INTEGRATION ___________________________________________________": "", + "clean": "rimraf storybook-static/ && rimraf node_modules/.cache/ && yon test:clean && yon packages:clean", + "checkup": "yon format:checkup && yon run types && yon run lint", + "dev": "yon run format && yon run types && yon run lint", + "ci": "yon run checkup && yon run packages:checkup && yon run test:report && yon run build-storybook", + "all": "yon clean && yon run packages:build && yon run dev && yon run test && yon run build-storybook", + "____ BATCH COMMANDS FOR PACKAGES ___________________________________": "", + "packages:prepare": "lerna exec yon prepare", + "packages:build": "lerna exec yon build", + "packages:checkup": "lerna exec yon checkup", + "packages:clean": "lerna exec yon clean", + "packages:dev": "lerna exec yon dev", + "packages:all": "lerna exec yon all", + "____ INDIVIDUAL COMMANDS ___________________________________________": "", "format": "prettier --write \"**/*.*\"", "format:checkup": "prettier --list-different \"**/*.*\"", "lint": "eslint \"**/*.{js,jsx,json,ts,tsx}\"", "storybook": "start-storybook -p 6006", "build-storybook": "build-storybook", - "types": "tsc --noEmit --p tsconfig.json --jsx react", - "____ HOOKS _________________________________________________________": "", - "prepare": "lerna bootstrap --ignore-scripts && yon prepare:all", - "prepublishOnly": "yon checkup:all && yon build:all", - "prerelease": "yon clean:all", - "pretest": "yon test:clean", - "____ INTEGRATION ___________________________________________________": "", - "dev": "yon run format && yon run types && yon run lint", - "checkup": "yon format:checkup && yon run types && yon run lint", - "all": "yon clean:all && yon run dev && yon run test:coverage && yon run build-storybook", - "dev:all": "yon dev && lerna exec yon dev", - "checkup:all": "yon checkup && lerna exec yon checkup", - "all:all": "yon all && lerna exec yon all", - "ci": "yon run checkup:all && yon run test:report && yon run build:all && yon run build-storybook" + "release:changelog": "standard-version --skip.commit --skip.tag --release-as ", + "release:tag": "standard-version --sign --skip.changelog --release-as ", + "test": "jest --coverage", + "test:clean": "rimraf coverage/", + "test:report": "jest --coverage --coverageReporters=text-lcov | coveralls", + "test:watch": "jest --coverage --watch", + "types": "tsc --noEmit --p tsconfig.json --jsx react" }, "dependencies": {}, "devDependencies": { diff --git a/packages/dev-helpers/README.md b/packages/dev-helpers/README.md index 75b8b71..c3812e6 100644 --- a/packages/dev-helpers/README.md +++ b/packages/dev-helpers/README.md @@ -1,3 +1,5 @@ # React-Hibernate-Dev-Helpers -A set of helpers used to [React-Hibernate](../../)'s demos and tests. This is an internal package. +A set of helpers used to demonstrate [React Hibernate](https://github.com/spautz/react-hibernate). + +![private](https://img.shields.io/badge/npm-private-red.svg) diff --git a/packages/dev-helpers/package.json b/packages/dev-helpers/package.json index 5cfff19..ea85ba1 100644 --- a/packages/dev-helpers/package.json +++ b/packages/dev-helpers/package.json @@ -27,7 +27,17 @@ "types": "dist/index.d.ts", "sideEffects": false, "scripts": { - "____ BASE COMMANDS _________________________________________________": "", + "____ LIFECYCLE HOOKS _______________________________________________": "", + "prepare": "yon build", + "prebuild": "yon clean", + "prerelease": "yon clean", + "prepublishOnly": "yon checkup && yon build", + "pretest": "yon test:clean", + "____ INTEGRATION ___________________________________________________": "", + "dev": "yon run format && yon run types && yon run lint", + "checkup": "yon format:checkup && yon run types && yon run lint", + "all": "yon run dev && yon run test && yon run build", + "____ INDIVIDUAL COMMANDS ___________________________________________": "", "build": "microbundle build --jsx React.createElement", "build:watch": "microbundle watch --jsx React.createElement", "clean": "rimraf dist/ node_modules/.cache/ && yon test:clean", @@ -37,17 +47,7 @@ "test": "echo \"@TODO: tests for dev-helpers\"", "test:clean": "rimraf coverage-local/", "test:watch": "echo \"@TODO: tests for dev-helpers\"", - "types": "tsc --noEmit --p tsconfig.json --jsx react", - "____ HOOKS _________________________________________________________": "", - "prepare": "yon build", - "prebuild": "yon clean", - "prerelease": "yon clean", - "prepublishOnly": "yon checkup && yon build", - "pretest": "yon test:clean", - "____ INTEGRATION ___________________________________________________": "", - "dev": "yon run format && yon run types && yon run lint", - "checkup": "yon format:checkup && yon run types && yon run lint", - "all": "yon run dev && yon run test && yon run build" + "types": "tsc --noEmit --p tsconfig.json --jsx react" }, "dependencies": { "@material-ui/core": "^4.9.4", diff --git a/packages/react-hibernate/README.md b/packages/react-hibernate/README.md index 4484b28..3746839 100644 --- a/packages/react-hibernate/README.md +++ b/packages/react-hibernate/README.md @@ -4,12 +4,14 @@ Restore previously-unmounted subtrees -- state and all -- on remount. +Part of [React Hibernate](https://github.com/spautz/react-hibernate) + [![npm version](https://img.shields.io/npm/v/react-hibernate.svg)](https://www.npmjs.com/package/react-hibernate) [![gzip size](https://img.shields.io/bundlephobia/minzip/react-hibernate)](https://bundlephobia.com/result?p=react-hibernate@latest) ## Core Package -This package provides the main functionality for [React-Hibernate](../../). +This package provides the main functionality for [React Hibernate](https://github.com/spautz/react-hibernate). ## Roadmap diff --git a/packages/react-hibernate/package.json b/packages/react-hibernate/package.json index 21f784c..4fb6efa 100644 --- a/packages/react-hibernate/package.json +++ b/packages/react-hibernate/package.json @@ -26,7 +26,17 @@ "types": "dist/index.d.ts", "sideEffects": false, "scripts": { - "____ BASE COMMANDS _________________________________________________": "", + "____ LIFECYCLE HOOKS _______________________________________________": "", + "prepare": "yon build", + "prebuild": "yon clean", + "prerelease": "yon clean", + "prepublishOnly": "yon checkup && yon build", + "pretest": "yon test:clean", + "____ INTEGRATION ___________________________________________________": "", + "dev": "yon run format && yon run types && yon run lint", + "checkup": "yon format:checkup && yon run types && yon run lint", + "all": "yon run dev && yon run test && yon run build", + "____ INDIVIDUAL COMMANDS ___________________________________________": "", "build": "microbundle build --jsx React.createElement", "build:watch": "microbundle watch --jsx React.createElement", "clean": "rimraf dist/ node_modules/.cache/ && yon test:clean", @@ -36,17 +46,7 @@ "test": "echo \"@TODO: tests for react-hibernate\"", "test:clean": "rimraf coverage-local/", "test:watch": "echo \"@TODO: tests for react-hibernate\"", - "types": "tsc --noEmit --p tsconfig.json --jsx react", - "____ HOOKS _________________________________________________________": "", - "prepare": "yon build", - "prebuild": "yon clean", - "prerelease": "yon clean", - "prepublishOnly": "yon checkup && yon build", - "pretest": "yon test:clean", - "____ INTEGRATION ___________________________________________________": "", - "dev": "yon run format && yon run types && yon run lint", - "checkup": "yon format:checkup && yon run types && yon run lint", - "all": "yon run dev && yon run test && yon run build" + "types": "tsc --noEmit --p tsconfig.json --jsx react" }, "dependencies": { "limited-cache": "^0.5.0", diff --git a/packages/react-pauseable-containers/README.md b/packages/react-pauseable-containers/README.md index 7d4efdf..28b625b 100644 --- a/packages/react-pauseable-containers/README.md +++ b/packages/react-pauseable-containers/README.md @@ -4,7 +4,7 @@ Prevent subtrees from rerendering when their parent changes, or when certain context values change. -Part of [React-Hibernate](../../) +Part of [React Hibernate](https://github.com/spautz/react-hibernate) [![npm version](https://img.shields.io/npm/v/react-pauseable-containers.svg)](https://www.npmjs.com/package/react-pauseable-containers) [![gzip size](https://img.shields.io/bundlephobia/minzip/react-pauseable-containers)](https://bundlephobia.com/result?p=react-pauseable-containers@latest) @@ -29,10 +29,11 @@ This is essentially just a typescript-friendly version of [react-static-containe Prevents subscribed components from rerendering when the redux state changes, or the return value from `useSelector`. -This currently causes an extra rerender when the `shouldUpdate` prop changes. - ## How to use this -With [React-Hibernate](../../) or [React-Router-Hibernate](../react-router-hibernate/), passing one of these -components -- or a new component composed from several of them together -- can prevent hibernating subtrees from -updating. +With [React-Hibernate](../react-hibernate) or [React-Router-Hibernate](../react-router-hibernate/), using one of these +components -- or a new component composed from several of them together -- can prevent subtrees from updating while +they're hibernating, to avoid needless work. + +These can also be used on their own to prevent updates in components that are still mounted, such as the background +screen behind a modal or dialog, or inactive tabs or panes when using a wizard, accordion, or tabs widget. diff --git a/packages/react-pauseable-containers/package.json b/packages/react-pauseable-containers/package.json index 0dbc3c6..e8d140e 100644 --- a/packages/react-pauseable-containers/package.json +++ b/packages/react-pauseable-containers/package.json @@ -26,7 +26,17 @@ "types": "dist/index.d.ts", "sideEffects": false, "scripts": { - "____ BASE COMMANDS _________________________________________________": "", + "____ LIFECYCLE HOOKS _______________________________________________": "", + "prepare": "yon run build", + "prebuild": "yon run clean", + "prerelease": "yon run clean", + "prepublishOnly": "yon run checkup && yon run build", + "pretest": "yon run test:clean", + "____ INTEGRATION ___________________________________________________": "", + "dev": "yon run format && yon run types && yon run lint", + "checkup": "yon format:checkup && yon run types && yon run lint", + "all": "yon run dev && yon run test && yon run build", + "____ INDIVIDUAL COMMANDS ___________________________________________": "", "build": "microbundle build --jsx React.createElement", "build:watch": "microbundle watch --jsx React.createElement", "clean": "rimraf dist/ node_modules/.cache/ && yon run test:clean", @@ -38,17 +48,7 @@ "test": "echo \"@TODO: tests for pauseable-containers\"", "test:clean": "rimraf coverage-local/", "test:watch": "echo \"@TODO: tests for pauseable-containers\"", - "types": "tsc --noEmit --p tsconfig.json --jsx react", - "____ HOOKS _________________________________________________________": "", - "prepare": "yon run build", - "prebuild": "yon run clean", - "prerelease": "yon run clean", - "prepublishOnly": "yon run checkup && yon run build", - "pretest": "yon run test:clean", - "____ INTEGRATION ___________________________________________________": "", - "dev": "yon run format && yon run types && yon run lint", - "checkup": "yon format:checkup && yon run types && yon run lint", - "all": "yon run dev && yon run test && yon run build" + "types": "tsc --noEmit --p tsconfig.json --jsx react" }, "dependencies": {}, "devDependencies": { diff --git a/packages/react-router-hibernate/README.md b/packages/react-router-hibernate/README.md index e640d44..e492dbc 100644 --- a/packages/react-router-hibernate/README.md +++ b/packages/react-router-hibernate/README.md @@ -4,7 +4,7 @@ A react-router Switch which can leave inactive routes mounted-but-inactive until you navigate back. -Part of [React-Hibernate](../../) +Part of [React Hibernate](https://github.com/spautz/react-hibernate) [![npm version](https://img.shields.io/npm/v/react-router-hibernate.svg)](https://www.npmjs.com/package/react-router-hibernate) [![gzip size](https://img.shields.io/bundlephobia/minzip/react-router-hibernate)](https://bundlephobia.com/result?p=react-router-hibernate@latest) diff --git a/packages/react-router-hibernate/package.json b/packages/react-router-hibernate/package.json index 954561f..f10a784 100644 --- a/packages/react-router-hibernate/package.json +++ b/packages/react-router-hibernate/package.json @@ -26,7 +26,17 @@ "types": "dist/index.d.ts", "sideEffects": false, "scripts": { - "____ BASE COMMANDS _________________________________________________": "", + "____ LIFECYCLE HOOKS _______________________________________________": "", + "prepare": "yon build", + "prebuild": "yon clean", + "prerelease": "yon clean", + "prepublishOnly": "yon checkup && yon build", + "pretest": "yon test:clean", + "____ INTEGRATION ___________________________________________________": "", + "dev": "yon run format && yon run types && yon run lint", + "checkup": "yon format:checkup && yon run types && yon run lint", + "all": "yon run dev && yon run test && yon run build", + "____ INDIVIDUAL COMMANDS ___________________________________________": "", "build": "microbundle build --jsx React.createElement", "build:watch": "microbundle watch --jsx React.createElement", "clean": "rimraf dist/ node_modules/.cache/ && yon test:clean", @@ -38,17 +48,7 @@ "test": "jest --coverage", "test:clean": "rimraf coverage-local/", "test:watch": "jest --coverage --watch", - "types": "tsc --noEmit --p tsconfig.json --jsx react", - "____ HOOKS _________________________________________________________": "", - "prepare": "yon build", - "prebuild": "yon clean", - "prerelease": "yon clean", - "prepublishOnly": "yon checkup && yon build", - "pretest": "yon test:clean", - "____ INTEGRATION ___________________________________________________": "", - "dev": "yon run format && yon run types && yon run lint", - "checkup": "yon format:checkup && yon run types && yon run lint", - "all": "yon run dev && yon run test && yon run build" + "types": "tsc --noEmit --p tsconfig.json --jsx react" }, "dependencies": { "limited-cache": "^0.5.0", diff --git a/packages/redux-pauseable-store/README.md b/packages/redux-pauseable-store/README.md index 4680d93..1e96a98 100644 --- a/packages/redux-pauseable-store/README.md +++ b/packages/redux-pauseable-store/README.md @@ -4,7 +4,7 @@ Derive one redux store from another, then pause it. -Part of [React Hibernate](../../) +Part of [React Hibernate](https://github.com/spautz/react-hibernate) [![npm version](https://img.shields.io/npm/v/redux-pauseable-store.svg)](https://www.npmjs.com/package/redux-pauseable-store) [![gzip size](https://img.shields.io/bundlephobia/minzip/redux-pauseable-store)](https://bundlephobia.com/result?p=redux-pauseable-store@latest) diff --git a/packages/redux-pauseable-store/package.json b/packages/redux-pauseable-store/package.json index ce15ff1..13b5e94 100644 --- a/packages/redux-pauseable-store/package.json +++ b/packages/redux-pauseable-store/package.json @@ -26,7 +26,17 @@ "types": "dist/index.d.ts", "sideEffects": false, "scripts": { - "____ BASE COMMANDS _________________________________________________": "", + "____ LIFECYCLE HOOKS _______________________________________________": "", + "prepare": "yon run build", + "prebuild": "yon run clean", + "prerelease": "yon run clean", + "prepublishOnly": "yon run checkup && yon run build", + "pretest": "yon run test:clean", + "____ INTEGRATION ___________________________________________________": "", + "dev": "yon run format && yon run types && yon run lint", + "checkup": "yon format:checkup && yon run types && yon run lint", + "all": "yon run dev && yon run test && yon run build", + "____ INDIVIDUAL COMMANDS ___________________________________________": "", "build": "microbundle build --jsx React.createElement", "build:watch": "microbundle watch --jsx React.createElement", "clean": "rimraf dist/ node_modules/.cache/ && yon run test:clean", @@ -38,17 +48,7 @@ "test": "jest --coverage", "test:clean": "rimraf coverage-local/", "test:watch": "jest --coverage --watch", - "types": "tsc --noEmit --p tsconfig.json --jsx react", - "____ HOOKS _________________________________________________________": "", - "prepare": "yon run build", - "prebuild": "yon run clean", - "prerelease": "yon run clean", - "prepublishOnly": "yon run checkup && yon run build", - "pretest": "yon run test:clean", - "____ INTEGRATION ___________________________________________________": "", - "dev": "yon run format && yon run types && yon run lint", - "checkup": "yon format:checkup && yon run types && yon run lint", - "all": "yon run dev && yon run test && yon run build" + "types": "tsc --noEmit --p tsconfig.json --jsx react" }, "dependencies": {}, "devDependencies": {},