Refactor redux-dynamic-modules package in core and react (#74)

* RDMCore
This commit is contained in:
Navneet Gupta 2019-04-01 08:54:04 -07:00 коммит произвёл GitHub
Родитель b81460b46a
Коммит 8d9bbbbb03
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
50 изменённых файлов: 2801 добавлений и 53976 удалений

3
.vscode/extensions.json поставляемый
Просмотреть файл

@ -9,8 +9,7 @@
"kisstkondoros.vscode-codemetrics",
"orta.vscode-jest",
"wayou.vscode-todo-highlight",
"eg2.tslint",
"rbbit.typescript-hero"
"eg2.tslint"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []

4647
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

18396
packages/counter-example/package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -5,11 +5,9 @@
"devDependencies": {
"enzyme": "^3.6.0",
"enzyme-adapter-react-16": "^1.5.0",
"react-scripts": "^2.0.2"
"react-scripts": "2.1.8"
},
"dependencies": {
"babel-loader": "^8.0.5",
"eslint": "5.12.0",
"prop-types": "15.7.2",
"react": "16.8.2",
"react-dom": "16.8.2",

Просмотреть файл

@ -0,0 +1,65 @@
{
"name": "redux-dynamic-modules-core",
"version": "3.5.0",
"description": "Modularize the redux app by dynamically loading reducers, state and sagas",
"repository": {
"type": "github",
"url": "https://github.com/Microsoft/redux-dynamic-modules"
},
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"scripts": {
"prepublish": "npm run build:prod && npm run test",
"build": "npm run clean && tsc && webpack --mode development --display-modules --progress --display-error-details",
"build:prod": "npm run clean && tsc && webpack --mode development --display-error-details && webpack --mode production --display-modules --progress --display-error-details",
"clean": "rimraf lib/ dist/",
"test": "jest"
},
"keywords": [
"redux",
"module",
"dynamic",
"load"
],
"author": "Navneet Gupta (Microsoft), Alex Bettadapur (Facebook)",
"license": "MIT",
"devDependencies": {
"@types/jest": "^23.3.1",
"@types/redux": "3.6.0",
"jest": "^23.5.0",
"react": "16.7.0",
"redux": "4.0.1",
"rimraf": "^2.6.2",
"ts-jest": "^23.1.4",
"tslib": "^1.9.3",
"tslint": "^5.11.0",
"typescript": "^3.0.3",
"uglifyjs-webpack-plugin": "^1.3.0",
"webpack": "4.19.1",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-cli": "^3.1.0"
},
"jest": {
"transform": {
"^.+\\.ts?$": "ts-jest"
},
"verbose": false,
"testMatch": [
"**/src/__tests__/**/(*.)+(spec|test).ts?(x)"
],
"moduleFileExtensions": [
"ts",
"js",
"json",
"node"
]
},
"peerDependencies": {
"redux": ">= 3.0.0"
},
"dependencies": {
"redux-devtools-extension": "^2.13.7",
"redux-dynamic-middlewares": "^1.0.0"
},
"gitHead": "8f1ed8a7be500e3e8d388703bab88dbb69eeb54e"
}

Просмотреть файл

@ -0,0 +1,7 @@
export * from "./Contracts";
export * from "./ModuleStore";
export * from "./Utils/ComparableMap";
export * from "./Utils/RefCounter";
export * from "./Managers/MiddlewareManager";
export * from "./Managers/RefCountedManager";
//Dummy change to keep lerna happy

Просмотреть файл

@ -0,0 +1,16 @@
{
"compilerOptions": {
"lib": ["dom", "es2015", "es2016"],
"declaration": true,
"noUnusedLocals": true,
"noImplicitAny": false,
"module": "commonjs",
"moduleResolution": "node",
"skipLibCheck": true,
"jsx": "react",
"rootDir": "src",
"outDir": "lib"
},
"include": ["src/**/*.ts"],
"exclude": ["src/__tests__/**/*.ts"]
}

Просмотреть файл

@ -0,0 +1 @@
{}

Просмотреть файл

@ -0,0 +1,37 @@
let webpack = require("webpack");
let BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin;
module.exports = (env, argv) => {
let mode_env = argv.mode || "development";
return {
devtool: "source-map",
entry: {
main: "./lib/index",
},
output: {
library: "redux-dynamic-modules-core",
libraryTarget: "umd",
filename:
mode_env === "production"
? "redux-dynamic-modules-core.min.js"
: "redux-dynamic-modules-core.js",
path: __dirname + "/dist/",
},
externals: {
"prop-types": "prop-types",
react: "react",
redux: "redux",
},
plugins: [
new BundleAnalyzerPlugin({
analyzerMode: "static",
reportFilename: `react-redux-module.stats.html`,
openAnalyzer: false,
}),
],
};
};

Просмотреть файл

@ -21,7 +21,7 @@
"dynamic",
"load"
],
"author": "Navneet Gupta (Microsoft), Alex Bettadapur (Microsoft)",
"author": "Navneet Gupta (Microsoft), Alex Bettadapur (Facebook)",
"license": "MIT",
"devDependencies": {
"@types/jest": "^23.3.1",
@ -34,7 +34,7 @@
"tslint": "^5.11.0",
"typescript": "^3.0.3",
"uglifyjs-webpack-plugin": "^1.3.0",
"webpack": "4.28.3",
"webpack": "4.19.1",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-cli": "^3.1.0"
},

Просмотреть файл

@ -0,0 +1,13 @@
dist/react-redux-module.stats.html
example/
lib/__tests__
node_modules/
src/
.gitignore
package.json
package-lock.json
tsconfig.json
tslint.json
webpack.config.js
yarn.lock
*.tgz

18
packages/redux-dynamic-modules-react/.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,18 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"name": "vscode-jest-tests",
"request": "launch",
"args": ["--runInBand"],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
}
]
}

Просмотреть файл

@ -0,0 +1,56 @@
{
"name": "redux-dynamic-modules-react",
"version": "3.5.0",
"description": "Modularize the redux app by dynamically loading reducers, state and sagas",
"repository": {
"type": "github",
"url": "https://github.com/Microsoft/redux-dynamic-modules"
},
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"scripts": {
"prepublish": "npm run build:prod",
"build": "npm run clean && tsc && webpack --mode development --display-modules --progress --display-error-details",
"build:prod": "npm run clean && tsc && webpack --mode development --display-error-details && webpack --mode production --display-modules --progress --display-error-details",
"clean": "rimraf lib/ dist/"
},
"keywords": [
"react",
"redux",
"module",
"dynamic",
"load"
],
"author": "Navneet Gupta (Microsoft), Alex Bettadapur (Facebook)",
"license": "MIT",
"devDependencies": {
"@types/jest": "^23.3.1",
"@types/react": "16.7.17",
"@types/react-redux": "6.0.11",
"@types/redux": "3.6.0",
"jest": "^23.5.0",
"react": "16.7.0",
"react-redux": "6.0.0",
"redux": "4.0.1",
"rimraf": "^2.6.2",
"ts-jest": "^23.1.4",
"tslib": "^1.9.3",
"tslint": "^5.11.0",
"typescript": "^3.0.3",
"uglifyjs-webpack-plugin": "^1.3.0",
"webpack": "4.19.1",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-cli": "^3.1.0"
},
"peerDependencies": {
"react": ">= 15.0.0",
"react-redux": ">= 5.0.0",
"redux": ">= 3.0.0"
},
"dependencies": {
"redux-dynamic-modules-core": "^3.5.0",
"redux-devtools-extension": "^2.13.7",
"redux-dynamic-middlewares": "^1.0.0"
},
"gitHead": "8f1ed8a7be500e3e8d388703bab88dbb69eeb54e"
}

Просмотреть файл

@ -7,7 +7,7 @@ import {
IDynamicallyAddedModule,
IModuleStore,
IModuleTuple,
} from "./Contracts";
} from "redux-dynamic-modules-core";
export interface IDynamicModuleLoaderProps {
/** Modules that need to be dynamically registerd */

Просмотреть файл

@ -0,0 +1,2 @@
export * from "redux-dynamic-modules-core";
export * from "./DynamicModuleLoader";

Просмотреть файл

@ -0,0 +1,24 @@
{
"compilerOptions": {
"lib": [
"dom",
"es2015",
"es2016"
],
"declaration": true,
"noUnusedLocals": true,
"noImplicitAny": false,
"module": "commonjs",
"moduleResolution": "node",
"skipLibCheck": true,
"jsx": "react",
"rootDir": "src",
"outDir": "lib"
},
"include": [
"src/**/*.ts"
],
"exclude": [
"src/__tests__/**/*.ts"
]
}

Просмотреть файл

@ -0,0 +1 @@
{}

Просмотреть файл

@ -0,0 +1,39 @@
let webpack = require("webpack");
let BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin;
module.exports = (env, argv) => {
let mode_env = argv.mode || "development";
return {
devtool: "source-map",
entry: {
main: "./lib/index",
},
output: {
library: "redux-dynamic-modules",
libraryTarget: "umd",
filename:
mode_env === "production"
? "redux-dynamic-modules-react.min.js"
: "redux-dynamic-modules-react.js",
path: __dirname + "/dist/",
},
externals: {
"prop-types": "prop-types",
react: "react",
redux: "redux",
"react-redux": "react-redux",
"redux-saga": "redux-saga",
},
plugins: [
new BundleAnalyzerPlugin({
analyzerMode: "static",
reportFilename: `react-redux-module.stats.html`,
openAnalyzer: false,
}),
],
};
};

Просмотреть файл

@ -22,7 +22,7 @@
"dynamic",
"load"
],
"author": "Navneet Gupta (Microsoft), Alex Bettadapur (Microsoft)",
"author": "Navneet Gupta (Microsoft), Alex Bettadapur (Facebook)",
"license": "MIT",
"devDependencies": {
"@types/jest": "^23.3.1",
@ -37,7 +37,7 @@
"tslint": "^5.11.0",
"typescript": "^3.0.3",
"uglifyjs-webpack-plugin": "^1.3.0",
"webpack": "4.28.3",
"webpack": "4.19.1",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-cli": "^3.1.0"
},

Просмотреть файл

@ -20,7 +20,7 @@
"dynamic",
"load"
],
"author": "Navneet Gupta (Microsoft), Alex Bettadapur (Microsoft)",
"author": "Navneet Gupta (Microsoft), Alex Bettadapur (Facebook)",
"license": "MIT",
"devDependencies": {
"@types/jest": "^23.3.1",
@ -34,7 +34,7 @@
"tslint": "^5.11.0",
"typescript": "^3.0.3",
"uglifyjs-webpack-plugin": "^1.3.0",
"webpack": "4.28.3",
"webpack": "4.19.1",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-cli": "^3.1.0"
},

3533
packages/redux-dynamic-modules/package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -9,11 +9,10 @@
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"scripts": {
"prepublish": "npm run build:prod && npm run test",
"prepublish": "npm run build:prod",
"build": "npm run clean && tsc && webpack --mode development --display-modules --progress --display-error-details",
"build:prod": "npm run clean && tsc && webpack --mode development --display-error-details && webpack --mode production --display-modules --progress --display-error-details",
"clean": "rimraf lib/ dist/",
"test": "jest"
"clean": "rimraf lib/ dist/"
},
"keywords": [
"react",
@ -22,7 +21,7 @@
"dynamic",
"load"
],
"author": "Navneet Gupta (Microsoft), Alex Bettadapur (Microsoft)",
"author": "Navneet Gupta (Microsoft), Alex Bettadapur (Facebook)",
"license": "MIT",
"devDependencies": {
"@types/jest": "^23.3.1",
@ -43,31 +42,14 @@
"webpack-bundle-analyzer": "^2.13.1",
"webpack-cli": "^3.1.0"
},
"jest": {
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"verbose": false,
"testMatch": [
"**/src/__tests__/**/(*.)+(spec|test).ts?(x)"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
},
"peerDependencies": {
"react": ">= 15.0.0",
"react-redux": ">= 5.0.0",
"redux": ">= 3.0.0"
},
"dependencies": {
"redux-devtools-extension": "^2.13.7",
"redux-dynamic-middlewares": "^1.0.0"
"redux-dynamic-modules-core": "^3.5.0",
"redux-dynamic-modules-react": "^3.5.0"
},
"gitHead": "8f1ed8a7be500e3e8d388703bab88dbb69eeb54e"
}

Просмотреть файл

@ -1,8 +1,2 @@
export * from "./Contracts";
export * from "./DynamicModuleLoader";
export * from "./ModuleStore";
export * from "./Utils/ComparableMap";
export * from "./Utils/RefCounter";
export * from "./Managers/MiddlewareManager";
export * from "./Managers/RefCountedManager";
//Dummy change to keep lerna happy
export * from "redux-dynamic-modules-core";
export * from "redux-dynamic-modules-react";

12327
packages/todo-example/package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -3,7 +3,7 @@
"version": "3.5.0",
"private": true,
"devDependencies": {
"react-scripts": "^1.1.4"
"react-scripts": "2.1.8"
},
"dependencies": {
"prop-types": "15.6.2",
@ -18,5 +18,11 @@
"start": "react-scripts start",
"build:dev": "react-scripts build",
"eject": "react-scripts eject"
}
}
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}

17501
packages/typescript-example/package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -12,7 +12,7 @@
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-redux": "^5.0.7",
"react-scripts": "2.1.2",
"react-scripts": "2.1.8",
"redux": "^4.0.1",
"redux-dynamic-modules": "^3.5.0",
"redux-dynamic-modules-saga": "^3.5.0",
@ -26,9 +26,6 @@
"build": "react-scripts build",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",

2
packages/widgets-example/package-lock.json сгенерированный
Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "widgets-example",
"version": "3.5.0-alpha.3",
"version": "3.5.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

Просмотреть файл

@ -9,9 +9,10 @@
"react-dom": "16.7.0",
"react-loadable": "5.5.0",
"react-redux": "6.0.0",
"react-scripts": "2.0.4",
"react-scripts": "2.1.8",
"redux": "4.0.1",
"redux-dynamic-modules": "^3.5.0",
"redux-dynamic-modules-react": "^3.5.0",
"redux-dynamic-modules-core": "^3.5.0",
"redux-dynamic-modules-saga": "^3.5.0",
"redux-dynamic-modules-thunk": "^3.5.0",
"redux-saga": "0.16.2",
@ -22,9 +23,6 @@
"build": "react-scripts build",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",

Просмотреть файл

@ -5,7 +5,7 @@ import React, { Component } from "react";
import Loadable from "react-loadable";
import { Provider } from "react-redux";
// createStore allows us to load/unload modules dynamically.
import { createStore } from "redux-dynamic-modules";
import { createStore } from "redux-dynamic-modules-core";
// Saga extension allows us to use Saga middleware in the module store.
import { getSagaExtension } from "redux-dynamic-modules-saga";
// Thunk extension allows us to use Thunk middleware in the module store.

Просмотреть файл

@ -1,12 +1,12 @@
import { ConnectedHackerNews } from "./component/hacker-news-component";
import { getHackerNewsModule } from "./redux/hacker-news-module";
import { DynamicModuleLoader } from "redux-dynamic-modules";
import { DynamicModuleLoader } from "redux-dynamic-modules-react";
import * as React from "react";
export default function DynamicHackerNews() {
return (
// define the module dependency for the HackerNews component
// DynamicModuleLoader is a HOC provided by redux-dynamic-modules
// DynamicModuleLoader is a HOC provided by redux-dynamic-modules-react
// It loads the module on ComponentDidMount and unloads on ComponentDidUnmount
<DynamicModuleLoader modules={[getHackerNewsModule()]}>
{/*

Просмотреть файл

@ -1,6 +1,6 @@
import { ConnectedWeather } from "./component/weather-component";
import { getWeatherModule } from "./redux/weather-module";
import { DynamicModuleLoader } from "redux-dynamic-modules";
import { DynamicModuleLoader } from "redux-dynamic-modules-react";
import * as React from "react";
export default function Dynamic() {