chore(inspector): fix example build (#890)

This commit is contained in:
Nathan Bierema 2021-09-25 00:12:30 -04:00 committed by GitHub
parent 02a8232058
commit 399c83f9bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 188 additions and 120 deletions

View File

@ -26,6 +26,7 @@
"packages/react-json-tree/examples", "packages/react-json-tree/examples",
"packages/redux-devtools/examples/counter", "packages/redux-devtools/examples/counter",
"packages/redux-devtools/examples/todomvc", "packages/redux-devtools/examples/todomvc",
"packages/redux-devtools-inspector-monitor/demo",
"packages/redux-devtools-slider-monitor/examples/todomvc" "packages/redux-devtools-slider-monitor/examples/todomvc"
], ],
"resolutions": { "resolutions": {

View File

@ -1 +1,2 @@
demo
lib lib

View File

@ -0,0 +1 @@
dist

View File

@ -0,0 +1,17 @@
module.exports = {
extends: '../../../eslintrc.ts.react.base.json',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
overrides: [
{
files: ['webpack.config.ts'],
extends: '../../../eslintrc.ts.base.json',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.webpack.json'],
},
},
],
};

View File

@ -1,60 +0,0 @@
import * as path from 'path';
import * as webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import pkg from '../../package.json';
const isProduction = process.env.NODE_ENV === 'production';
module.exports = {
mode: process.env.NODE_ENV || 'development',
entry: isProduction
? ['./demo/src/js/index']
: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./demo/src/js/index',
],
output: {
path: path.join(__dirname, 'demo/dist'),
filename: 'js/bundle.js',
},
module: {
rules: [
{
test: /\.(js|ts)x?$/,
loader: 'babel-loader',
include: [
path.join(__dirname, '../../src'),
path.join(__dirname, '../src/js'),
],
},
],
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
inject: true,
template: 'demo/src/index.html',
package: pkg,
}),
new ForkTsCheckerWebpackPlugin({
typescript: {
configFile: 'demo/tsconfig.json',
},
}),
...(isProduction ? [] : [new webpack.HotModuleReplacementPlugin()]),
],
devServer: isProduction
? {}
: {
port: 3000,
hot: true,
historyApiFallback: true,
},
devtool: 'eval-source-map',
};

View File

@ -0,0 +1,60 @@
{
"private": true,
"name": "inspector-demo",
"version": "0.1.0",
"license": "MIT",
"scripts": {
"start": "webpack serve --open",
"build": "webpack",
"lint": "eslint . --ext .ts,.tsx",
"type-check": "tsc --noEmit"
},
"dependencies": {
"@redux-devtools/core": "^3.9.0",
"@redux-devtools/dock-monitor": "^1.4.0",
"@redux-devtools/inspector-monitor": "^1.0.0",
"base16": "^1.0.0",
"connected-react-router": "^6.9.1",
"history": "^4.10.1",
"immutable": "^4.0.0-rc.15",
"lodash.shuffle": "^4.2.0",
"react": "^16.14.0",
"react-bootstrap": "^1.6.3",
"react-dom": "^16.14.0",
"react-redux": "^7.2.5",
"react-router": "^5.2.1",
"redux": "^4.1.1",
"redux-logger": "^3.0.6",
"seamless-immutable": "^7.1.4",
"ts-node": "^10.2.1",
"webpack": "^5.53.0",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.2.1"
},
"devDependencies": {
"@babel/core": "^7.15.5",
"@babel/preset-env": "^7.15.6",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.15.0",
"@types/base16": "^1.0.2",
"@types/history": "^4.7.9",
"@types/lodash.shuffle": "^4.2.6",
"@types/node": "^14.17.17",
"@types/react": "^16.14.15",
"@types/react-dom": "^16.9.14",
"@types/react-redux": "^7.1.18",
"@types/react-router": "^5.1.16",
"@types/redux-logger": "^3.0.9",
"@types/webpack": "^5.28.0",
"@types/webpack-dev-server": "^4.1.0",
"@typescript-eslint/eslint-plugin": "^4.31.2",
"@typescript-eslint/parser": "^4.31.2",
"babel-loader": "^8.2.2",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "^7.25.3",
"fork-ts-checker-webpack-plugin": "^6.3.3",
"html-webpack-plugin": "^5.3.2",
"typescript": "~4.3.5"
}
}

View File

@ -1,6 +1,6 @@
import React, { CSSProperties } from 'react'; import React, { CSSProperties } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import pkg from '../../../package.json'; import pkg from '@redux-devtools/inspector-monitor/package.json';
import Button from 'react-bootstrap/Button'; import Button from 'react-bootstrap/Button';
import FormGroup from 'react-bootstrap/FormGroup'; import FormGroup from 'react-bootstrap/FormGroup';
import FormControl from 'react-bootstrap/FormControl'; import FormControl from 'react-bootstrap/FormControl';
@ -12,7 +12,7 @@ import Row from 'react-bootstrap/Row';
import * as base16 from 'base16'; import * as base16 from 'base16';
import { push as pushRoute } from 'connected-react-router'; import { push as pushRoute } from 'connected-react-router';
import { Path } from 'history'; import { Path } from 'history';
import * as inspectorThemes from '../../../src/themes'; import * as inspectorThemes from '@redux-devtools/inspector-monitor/lib/themes';
import getOptions, { Options } from './getOptions'; import getOptions, { Options } from './getOptions';
import { import {
AddFunctionAction, AddFunctionAction,

View File

@ -3,9 +3,9 @@ import { connect } from 'react-redux';
import { createDevTools } from '@redux-devtools/core'; import { createDevTools } from '@redux-devtools/core';
import DockMonitor from '@redux-devtools/dock-monitor'; import DockMonitor from '@redux-devtools/dock-monitor';
import { Location } from 'history'; import { Location } from 'history';
import DevtoolsInspector from '../../../src/DevtoolsInspector'; import DevtoolsInspector from '@redux-devtools/inspector-monitor/lib/DevtoolsInspector';
import getOptions from './getOptions'; import getOptions from './getOptions';
import { base16Themes } from '../../../src/utils/createStylingFromTheme'; import { base16Themes } from '@redux-devtools/inspector-monitor/lib/utils/createStylingFromTheme';
import { DemoAppState } from './reducers'; import { DemoAppState } from './reducers';
const CustomComponent = () => ( const CustomComponent = () => (

View File

@ -24,7 +24,10 @@ const NESTED = {
}, },
}; };
const IMMUTABLE_NESTED = Immutable.fromJS(NESTED); const IMMUTABLE_NESTED = Immutable.fromJS(NESTED) as Immutable.Map<
unknown,
unknown
>;
const IMMUTABLE_MAP = Immutable.Map({ const IMMUTABLE_MAP = Immutable.Map({
map: Immutable.Map({ a: 1, b: 2, c: 3 }), map: Immutable.Map({ a: 1, b: 2, c: 3 }),
@ -248,7 +251,7 @@ const createRootReducer = (
action.type === 'CHANGE_IMMUTABLE_NESTED' action.type === 'CHANGE_IMMUTABLE_NESTED'
? state.updateIn( ? state.updateIn(
['long', 'nested', 0, 'path', 'to', 'a'], ['long', 'nested', 0, 'path', 'to', 'a'],
(str: string) => str + '!' (str: unknown) => (str as string) + '!'
) )
: state, : state,
addFunction: (state = null, action) => addFunction: (state = null, action) =>

View File

@ -1,5 +1,5 @@
{ {
"extends": "../../../../tsconfig.base.json", "extends": "../../../tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"resolveJsonModule": true "resolveJsonModule": true
}, },

View File

@ -0,0 +1,46 @@
import * as path from 'path';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import pkg from '@redux-devtools/inspector-monitor/package.json';
module.exports = {
mode: 'development',
entry: './src/index.tsx',
devtool: 'eval-source-map',
devServer: {
static: './dist',
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html',
package: pkg,
}),
new ForkTsCheckerWebpackPlugin(),
],
output: {
filename: 'bundle.js',
path: path.join(__dirname, 'dist'),
clean: true,
},
module: {
rules: [
{
test: /\.(js|ts)x?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', { targets: 'defaults' }],
'@babel/preset-react',
'@babel/preset-typescript',
],
},
},
},
],
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
};

View File

@ -22,8 +22,6 @@
"url": "https://github.com/reduxjs/redux-devtools" "url": "https://github.com/reduxjs/redux-devtools"
}, },
"scripts": { "scripts": {
"start": "webpack serve --config demo/config/webpack.config.ts",
"build:demo": "NODE_ENV=production webpack -p",
"build": "yarn run build:types && yarn run build:js", "build": "yarn run build:types && yarn run build:js",
"build:types": "tsc --emitDeclarationOnly", "build:types": "tsc --emitDeclarationOnly",
"build:js": "babel src --out-dir lib --extensions \".ts,.tsx\" --source-maps inline", "build:js": "babel src --out-dir lib --extensions \".ts,.tsx\" --source-maps inline",
@ -60,47 +58,22 @@
"@babel/preset-react": "^7.14.5", "@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.15.0", "@babel/preset-typescript": "^7.15.0",
"@redux-devtools/core": "^3.9.0", "@redux-devtools/core": "^3.9.0",
"@redux-devtools/dock-monitor": "^1.4.0",
"@types/dateformat": "^3.0.1", "@types/dateformat": "^3.0.1",
"@types/hex-rgba": "^1.0.1", "@types/hex-rgba": "^1.0.1",
"@types/history": "^4.7.9", "@types/history": "^4.7.9",
"@types/lodash.debounce": "^4.0.6", "@types/lodash.debounce": "^4.0.6",
"@types/lodash.shuffle": "^4.2.6",
"@types/node": "^14.17.17",
"@types/react": "^16.14.15", "@types/react": "^16.14.15",
"@types/react-dragula": "^1.1.0", "@types/react-dragula": "^1.1.0",
"@types/react-router": "^5.1.16",
"@types/redux-devtools-themes": "^1.0.0", "@types/redux-devtools-themes": "^1.0.0",
"@types/redux-logger": "^3.0.9",
"@types/webpack": "^5.28.0",
"@types/webpack-dev-server": "^4.1.0",
"@typescript-eslint/eslint-plugin": "^4.31.2", "@typescript-eslint/eslint-plugin": "^4.31.2",
"@typescript-eslint/parser": "^4.31.2", "@typescript-eslint/parser": "^4.31.2",
"babel-loader": "^8.2.2",
"base16": "^1.0.0",
"clean-webpack-plugin": "^4.0.0",
"connected-react-router": "^6.9.1",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "^7.25.3", "eslint-plugin-react": "^7.25.3",
"fork-ts-checker-webpack-plugin": "^6.3.3",
"history": "^4.10.1",
"html-webpack-plugin": "^5.3.2",
"lodash.shuffle": "^4.2.0",
"react": "^16.14.0", "react": "^16.14.0",
"react-bootstrap": "^1.6.3",
"react-dom": "^16.14.0",
"react-redux": "^7.2.5",
"react-router": "^5.2.1",
"redux": "^4.1.1", "redux": "^4.1.1",
"redux-logger": "^3.0.6",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"seamless-immutable": "^7.1.4", "typescript": "~4.3.5"
"ts-node": "^10.2.1",
"typescript": "~4.3.5",
"webpack": "^5.53.0",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.2.1"
}, },
"peerDependencies": { "peerDependencies": {
"@redux-devtools/core": "^3.7.0", "@redux-devtools/core": "^3.7.0",

View File

@ -4862,63 +4862,38 @@ __metadata:
"@babel/preset-typescript": ^7.15.0 "@babel/preset-typescript": ^7.15.0
"@babel/runtime": ^7.15.4 "@babel/runtime": ^7.15.4
"@redux-devtools/core": ^3.9.0 "@redux-devtools/core": ^3.9.0
"@redux-devtools/dock-monitor": ^1.4.0
"@types/dateformat": ^3.0.1 "@types/dateformat": ^3.0.1
"@types/dragula": ^3.7.1 "@types/dragula": ^3.7.1
"@types/hex-rgba": ^1.0.1 "@types/hex-rgba": ^1.0.1
"@types/history": ^4.7.9 "@types/history": ^4.7.9
"@types/lodash": ^4.14.173 "@types/lodash": ^4.14.173
"@types/lodash.debounce": ^4.0.6 "@types/lodash.debounce": ^4.0.6
"@types/lodash.shuffle": ^4.2.6
"@types/node": ^14.17.17
"@types/prop-types": ^15.7.4 "@types/prop-types": ^15.7.4
"@types/react": ^16.14.15 "@types/react": ^16.14.15
"@types/react-dragula": ^1.1.0 "@types/react-dragula": ^1.1.0
"@types/react-router": ^5.1.16
"@types/redux-devtools-themes": ^1.0.0 "@types/redux-devtools-themes": ^1.0.0
"@types/redux-logger": ^3.0.9
"@types/webpack": ^5.28.0
"@types/webpack-dev-server": ^4.1.0
"@typescript-eslint/eslint-plugin": ^4.31.2 "@typescript-eslint/eslint-plugin": ^4.31.2
"@typescript-eslint/parser": ^4.31.2 "@typescript-eslint/parser": ^4.31.2
babel-loader: ^8.2.2
base16: ^1.0.0
clean-webpack-plugin: ^4.0.0
connected-react-router: ^6.9.1
dateformat: ^4.5.1 dateformat: ^4.5.1
eslint: ^7.32.0 eslint: ^7.32.0
eslint-config-prettier: ^8.3.0 eslint-config-prettier: ^8.3.0
eslint-plugin-react: ^7.25.3 eslint-plugin-react: ^7.25.3
fork-ts-checker-webpack-plugin: ^6.3.3
hex-rgba: ^1.0.2 hex-rgba: ^1.0.2
history: ^4.10.1
html-webpack-plugin: ^5.3.2
immutable: ^4.0.0-rc.15 immutable: ^4.0.0-rc.15
javascript-stringify: ^2.1.0 javascript-stringify: ^2.1.0
jsondiffpatch: ^0.4.1 jsondiffpatch: ^0.4.1
jss: ^10.8.0 jss: ^10.8.0
jss-preset-default: ^10.8.0 jss-preset-default: ^10.8.0
lodash.debounce: ^4.0.8 lodash.debounce: ^4.0.8
lodash.shuffle: ^4.2.0
prop-types: ^15.7.2 prop-types: ^15.7.2
react: ^16.14.0 react: ^16.14.0
react-base16-styling: ^0.8.0 react-base16-styling: ^0.8.0
react-bootstrap: ^1.6.3
react-dom: ^16.14.0
react-dragula: ^1.1.17 react-dragula: ^1.1.17
react-json-tree: ^0.15.0 react-json-tree: ^0.15.0
react-redux: ^7.2.5
react-router: ^5.2.1
redux: ^4.1.1 redux: ^4.1.1
redux-devtools-themes: ^1.0.0 redux-devtools-themes: ^1.0.0
redux-logger: ^3.0.6
rimraf: ^3.0.2 rimraf: ^3.0.2
seamless-immutable: ^7.1.4
ts-node: ^10.2.1
typescript: ~4.3.5 typescript: ~4.3.5
webpack: ^5.53.0
webpack-cli: ^4.8.0
webpack-dev-server: ^4.2.1
peerDependencies: peerDependencies:
"@redux-devtools/core": ^3.7.0 "@redux-devtools/core": ^3.7.0
"@types/react": ^16.3.0 || ^17.0.0 "@types/react": ^16.3.0 || ^17.0.0
@ -17161,6 +17136,57 @@ fsevents@^1.2.7:
languageName: node languageName: node
linkType: hard linkType: hard
"inspector-demo@workspace:packages/redux-devtools-inspector-monitor/demo":
version: 0.0.0-use.local
resolution: "inspector-demo@workspace:packages/redux-devtools-inspector-monitor/demo"
dependencies:
"@babel/core": ^7.15.5
"@babel/preset-env": ^7.15.6
"@babel/preset-react": ^7.14.5
"@babel/preset-typescript": ^7.15.0
"@redux-devtools/core": ^3.9.0
"@redux-devtools/dock-monitor": ^1.4.0
"@redux-devtools/inspector-monitor": ^1.0.0
"@types/base16": ^1.0.2
"@types/history": ^4.7.9
"@types/lodash.shuffle": ^4.2.6
"@types/node": ^14.17.17
"@types/react": ^16.14.15
"@types/react-dom": ^16.9.14
"@types/react-redux": ^7.1.18
"@types/react-router": ^5.1.16
"@types/redux-logger": ^3.0.9
"@types/webpack": ^5.28.0
"@types/webpack-dev-server": ^4.1.0
"@typescript-eslint/eslint-plugin": ^4.31.2
"@typescript-eslint/parser": ^4.31.2
babel-loader: ^8.2.2
base16: ^1.0.0
connected-react-router: ^6.9.1
eslint: ^7.32.0
eslint-config-prettier: ^8.3.0
eslint-plugin-react: ^7.25.3
fork-ts-checker-webpack-plugin: ^6.3.3
history: ^4.10.1
html-webpack-plugin: ^5.3.2
immutable: ^4.0.0-rc.15
lodash.shuffle: ^4.2.0
react: ^16.14.0
react-bootstrap: ^1.6.3
react-dom: ^16.14.0
react-redux: ^7.2.5
react-router: ^5.2.1
redux: ^4.1.1
redux-logger: ^3.0.6
seamless-immutable: ^7.1.4
ts-node: ^10.2.1
typescript: ~4.3.5
webpack: ^5.53.0
webpack-cli: ^4.8.0
webpack-dev-server: ^4.2.1
languageName: unknown
linkType: soft
"internal-ip@npm:^6.2.0": "internal-ip@npm:^6.2.0":
version: 6.2.0 version: 6.2.0
resolution: "internal-ip@npm:6.2.0" resolution: "internal-ip@npm:6.2.0"