Skip to content

Commit

Permalink
Merge 6c058ef into f416217
Browse files Browse the repository at this point in the history
  • Loading branch information
spautz committed Jun 18, 2020
2 parents f416217 + 6c058ef commit dfc5529
Show file tree
Hide file tree
Showing 47 changed files with 4,251 additions and 3,263 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
@@ -1,3 +1,5 @@
/* eslint-env node */

module.exports = {
extends: [
'eslint:recommended',
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
@@ -1,6 +1,8 @@
language: node_js
node_js:
- node
- 14
- 13
- 12
- 10
cache: yarn
Expand Down
12 changes: 6 additions & 6 deletions README.md
Expand Up @@ -4,8 +4,8 @@

Detach a subtree when it unmounts, and bring it back -- state and all -- when it remounts.

[![build status](https://img.shields.io/travis/com/spautz/react-router-hibernate/master.svg)](https://travis-ci.com/spautz/react-router-hibernate/branches)
[![test coverage](https://img.shields.io/coveralls/github/spautz/react-router-hibernate/master.svg)](https://coveralls.io/github/spautz/react-router-hibernate?branch=master)
[![build status](https://img.shields.io/travis/com/spautz/react-hibernate/master.svg)](https://travis-ci.com/spautz/react-hibernate/branches)
[![test coverage](https://img.shields.io/coveralls/github/spautz/react-hibernate/master.svg)](https://coveralls.io/github/spautz/react-hibernate?branch=master)
[![gzip size](https://img.shields.io/bundlephobia/minzip/react-router-hibernate)](https://bundlephobia.com/result?p=react-router-hibernate@latest)

## Overview
Expand All @@ -19,19 +19,19 @@ local state and all.

## Packages

#### [react-hibernate](./packages/react-hibernate-core/) [![npm version](https://img.shields.io/npm/v/react-hibernate.svg)](https://www.npmjs.com/package/react-hibernate)
**[react-hibernate](./packages/react-hibernate-core/)** [![npm version](https://img.shields.io/npm/v/react-hibernate.svg)](https://www.npmjs.com/package/react-hibernate)

Restore previously-unmounted subtrees -- state and all -- on remount.

#### [react-router-hibernate](./packages/react-router-hibernate/) [![npm version](https://img.shields.io/npm/v/react-router-hibernate.svg)](https://www.npmjs.com/package/react-router-hibernate)
**[react-router-hibernate](./packages/react-router-hibernate/)** [![npm version](https://img.shields.io/npm/v/react-router-hibernate.svg)](https://www.npmjs.com/package/react-router-hibernate)

A react-router Switch which can leave inactive routes mounted-but-inactive until you navigate back.

#### [react-pauseable-containers](./packages/react-pauseable-containers/) [![npm version](https://img.shields.io/npm/v/react-pauseable-containers.svg)](https://www.npmjs.com/package/react-pauseable-containers)
**[react-pauseable-containers](./packages/react-pauseable-containers/)** [![npm version](https://img.shields.io/npm/v/react-pauseable-containers.svg)](https://www.npmjs.com/package/react-pauseable-containers)

Prevent subtrees from rerendering when their parent changes, or when certain context values change.

#### [redux-pauseable-store](./packages/redux-pauseable-store/) [![npm version](https://img.shields.io/npm/v/redux-pauseable-store.svg)](https://www.npmjs.com/package/redux-pauseable-store)
**[redux-pauseable-store](./packages/redux-pauseable-store/)** [![npm version](https://img.shields.io/npm/v/redux-pauseable-store.svg)](https://www.npmjs.com/package/redux-pauseable-store)

Derive one redux store from another, then pause it.

Expand Down
1 change: 1 addition & 0 deletions babel.config.js
@@ -1,4 +1,5 @@
/* eslint-env node */

module.exports = {
presets: ['@babel/react', '@babel/preset-typescript'],
};
4 changes: 2 additions & 2 deletions lerna.json
@@ -1,7 +1,7 @@
{
"lerna": "3.20.2",
"lerna": "3.22.1",
"packages": ["packages/*"],
"version": "0.0.2",
"version": "0.0.3",
"npmClient": "yarn",
"useWorkspaces": true
}
90 changes: 46 additions & 44 deletions package.json
Expand Up @@ -15,7 +15,7 @@
"scripts": {
"____ BASE COMMANDS _________________________________________________": "",
"build:all": "lerna exec yon build",
"clean:all": "rimraf storybook-static/ && lerna exec yon clean && lerna exec yon test:clean",
"clean:all": "rimraf storybook-static/ && rimraf node_modules/.cache/ && lerna exec yon clean && lerna exec yon test:clean",
"prepare:all": "lerna exec yon prepare",
"test": "jest",
"test:clean": "rimraf coverage/",
Expand All @@ -30,68 +30,70 @@
"build-storybook": "build-storybook",
"types": "tsc --noEmit --p tsconfig.json --jsx react",
"____ HOOKS _________________________________________________________": "",
"prepare": "lerna bootstrap && yon prepare:all",
"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 run dev && yon run test:coverage",
"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"
},
"dependencies": {},
"devDependencies": {
"@babel/core": "^7.8.7",
"@babel/preset-react": "^7.8.3",
"@babel/preset-typescript": "^7.8.3",
"@storybook/addon-knobs": "^5.3.14",
"@storybook/addons": "^5.3.14",
"@storybook/preset-typescript": "^1.2.0",
"@storybook/react": "^5.3.14",
"@testing-library/jest-dom": "^5.1.1",
"@testing-library/react": "^9.5.0",
"@types/history": "^4.7.5",
"@types/jest": "^25.1.4",
"@types/node": "^13.9.0",
"@types/react": "^16.9.23",
"@babel/core": "^7.10.2",
"@babel/plugin-transform-react-jsx": "^7.10.1",
"@babel/preset-react": "^7.10.1",
"@babel/preset-typescript": "^7.10.1",
"@storybook/addon-knobs": "^5.3.19",
"@storybook/addons": "^5.3.19",
"@storybook/preset-typescript": "^3.0.0",
"@storybook/react": "^5.3.19",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.2.1",
"@types/history": "^4.7.6",
"@types/jest": "^26.0.0",
"@types/node": "^14.0.13",
"@types/react": "^16.9.38",
"@types/react-dom": "^16.9.8",
"@types/react-is": "^16.7.1",
"@types/react-redux": "^7.1.7",
"@types/react-router": "^5.1.4",
"@types/react-router-dom": "^5.1.3",
"@typescript-eslint/eslint-plugin": "^2.22.0",
"@typescript-eslint/parser": "^2.22.0",
"babel-loader": "^8.0.6",
"coveralls": "^3.0.9",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.19.0",
"fork-ts-checker-webpack-plugin": "^4.0.5",
"@types/react-redux": "^7.1.9",
"@types/react-router": "^5.1.7",
"@types/react-router-dom": "^5.1.5",
"@typescript-eslint/eslint-plugin": "^3.3.0",
"@typescript-eslint/parser": "^3.3.0",
"babel-loader": "^8.1.0",
"coveralls": "^3.1.0",
"eslint": "^7.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.0",
"fork-ts-checker-webpack-plugin": "^5.0.1",
"history": "^4.10.1",
"husky": "^4.2.3",
"jest": "^25.1.0",
"lerna": "^3.20.2",
"lint-staged": "^10.0.8",
"microbundle": "^0.12.0-next.8",
"prettier": "^1.19.1",
"react": "^16.12.0",
"react-docgen-typescript-loader": "^3.7.0",
"react-dom": "^16.12.0",
"husky": "^4.2.5",
"jest": "^26.0.1",
"lerna": "^3.22.1",
"lint-staged": "^10.2.11",
"microbundle": "^0.12.1",
"prettier": "^2.0.5",
"react": "^16.13.1",
"react-docgen-typescript-loader": "^3.7.2",
"react-dom": "^16.13.1",
"react-redux": "^7.2.0",
"react-router-dom": "^5.1.2",
"react-test-renderer": "^16.12.0",
"react-router-dom": "^5.2.0",
"react-test-renderer": "^16.13.1",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.8",
"rimraf": "^3.0.2",
"standard-version": "^7.1.0",
"ts-jest": "^25.2.1",
"ts-loader": "^6.2.1",
"tslib": "^1.11.1",
"typescript": "^3.8.3",
"standard-version": "^8.0.0",
"ts-jest": "^26.1.0",
"ts-loader": "^7.0.5",
"tslib": "^2.0.0",
"typescript": "^3.9.5",
"yarn-or-npm": "^3.0.1"
},
"lint-staged": {
Expand Down
File renamed without changes.
File renamed without changes.
Expand Up @@ -4,13 +4,13 @@
"description": "A react-router Switch which can leave inactive routes mounted-but-inactive until you navigate back",
"keywords": [],
"license": "MIT",
"homepage": "https://github.com/spautz/react-router-hibernate/packages/dev-helpers#readme",
"homepage": "https://github.com/spautz/react-hibernate/packages/dev-helpers#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/spautz/react-router-hibernate.git"
"url": "git+https://github.com/spautz/react-hibernate.git"
},
"bugs": {
"url": "https://github.com/spautz/react-router-hibernate/issues"
"url": "https://github.com/spautz/react-hibernate/issues"
},
"author": "Steven Pautz <spautz@gmail.com>",
"files": [
Expand All @@ -23,13 +23,13 @@
"main": "dist/index.js",
"module": "dist/index.esm.js",
"jsnext:main": "dist/index.esm.js",
"types": "dist/react-hibernate-dev-helpers/src/index.d.ts",
"types": "dist/index.d.ts",
"sideEffects": false,
"scripts": {
"____ BASE COMMANDS _________________________________________________": "",
"build": "microbundle build --jsx React.createElement",
"build:watch": "microbundle watch --jsx React.createElement",
"clean": "rimraf dist/",
"clean": "rimraf dist/ node_modules/.cache/",
"format": "prettier --write \"**/*.*\"",
"format:checkup": "prettier --list-different \"**/*.*\"",
"lint": "eslint \"**/*.{js,jsx,json,ts,tsx}\"",
Expand All @@ -51,7 +51,7 @@
},
"dependencies": {
"@material-ui/core": "^4.9.4",
"@testing-library/react": "^9.5.0",
"@testing-library/react": "^10.2.1",
"history": "^4.10.1",
"react-is": "^16.13.0",
"react-redux": "^7.2.0",
Expand Down
File renamed without changes.
@@ -1,4 +1,5 @@
export { default as DemoContainer } from './DemoContainer';
export * from './DemoContainer';

export { default as NestedState } from './NestedState';
export * from './NestedState';
File renamed without changes.
@@ -1,3 +1,4 @@
export { default as renderWithRouterContext } from './renderWithRouterContext';
export * from './renderWithRouterContext';

export * from './suppressReactDevErrors';
@@ -1,4 +1,5 @@
export { default as reduxDecorator } from './reduxDecorator';
export * from './reduxDecorator';

export { default as store } from './store';
export * from './store';
File renamed without changes.
9 changes: 9 additions & 0 deletions packages/dev-helpers/tsconfig.json
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig",

"compilerOptions": {
"rootDir": "./src",
"baseUrl": "./"
},
"include": ["./src"]
}
3 changes: 0 additions & 3 deletions packages/react-hibernate-dev-helpers/src/index.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/react-hibernate-dev-helpers/tsconfig.json

This file was deleted.

23 changes: 23 additions & 0 deletions packages/react-hibernate/.prettierignore
@@ -0,0 +1,23 @@
# Unless https://github.com/prettier/prettier/issues/4081 is ever resolved,
# this MUST be copied into each package dir for local runs to work.

# Whitelist supported files only
**/*.*
!**/*.css
!**/*.html
!**/*.js
!**/*.jsx
!**/*.json
!**/*.less
!**/*.md
!**/*.scss
!**/*.ts
!**/*.tsx

# Unless they're somewhere we can ignore
build/
dist/
coverage/
coverage-local/
node_modules/
storybook-static/
33 changes: 33 additions & 0 deletions packages/react-hibernate/README.md
@@ -0,0 +1,33 @@
# React-Hibernate

**This package is in active development. Things will change rapidly, and it is not yet production-ready. Feedback is welcome.**

Restore previously-unmounted subtrees -- state and all -- on remount.

[![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](../../).

## Roadmap

- [x] Proof of concept
- [x] Project scaffolding
- [x] Core functionality
- [ ] Tests (in progress)
- [x] Demos
- [x] Monorepo
- [ ] Initial release
- [ ] Explore: `useHibernatingEffect` hook (successfully prototyped)
- [ ] Explore: `maxCacheTime` override per-route (successfully prototyped)
- [ ] Explore: Options to better control which/when to add a subtree
- [ ] Explore: React-Router v6

#### Known Issues

"Cannot update a component from inside the function body of a different component" warning in React 16.13

- This will be addressed as part of supporting React-Router v6, when subtree activation will need to be done via a
component instead of a callback.
7 changes: 7 additions & 0 deletions packages/react-hibernate/jest.config.js
@@ -0,0 +1,7 @@
/* eslint-env node */
const baseConfig = require('../../jest-base.config');

module.exports = {
...baseConfig,
coverageDirectory: 'coverage-local',
};
66 changes: 66 additions & 0 deletions packages/react-hibernate/package.json
@@ -0,0 +1,66 @@
{
"name": "react-hibernate",
"version": "0.0.2",
"description": "Restore previously-unmounted subtrees -- state and all -- on remount.",
"keywords": [],
"license": "MIT",
"homepage": "https://github.com/spautz/react-hibernate#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/spautz/react-hibernate.git"
},
"bugs": {
"url": "https://github.com/spautz/react-hibernate/issues"
},
"author": "Steven Pautz <spautz@gmail.com>",
"files": [
"dist/",
"src/",
"LICENSE",
"README.md"
],
"source": "src/index.ts",
"main": "dist/index.js",
"module": "dist/index.esm.js",
"jsnext:main": "dist/index.esm.js",
"types": "dist/index.d.ts",
"sideEffects": false,
"scripts": {
"____ BASE COMMANDS _________________________________________________": "",
"build": "microbundle build --jsx React.createElement",
"build:watch": "microbundle watch --jsx React.createElement",
"clean": "rimraf dist/ node_modules/.cache/",
"format": "prettier --write \"**/*.*\"",
"format:checkup": "prettier --list-different \"**/*.*\"",
"lint": "eslint \"**/*.{js,jsx,json,ts,tsx}\"",
"test": "echo \"@TODO: tests for react-hibernate\"",
"test:clean": "rimraf coverage/",
"test:coverage": "echo \"@TODO: tests for react-hibernate\"",
"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:coverage && yon run build"
},
"dependencies": {
"limited-cache": "^0.5.0",
"prop-types": "^15.7.2",
"react-is": "^16.12.0",
"react-reverse-portal": "^2.0.0"
},
"devDependencies": {
"react-hibernate-dev-helpers": "0.0.2"
},
"peerDependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"react-router": ">=5.0.0"
}
}

0 comments on commit dfc5529

Please sign in to comment.