Use rollup for redux-devtools-chart-monitor

This commit is contained in:
Nathan Bierema 2022-01-08 23:57:57 -05:00
parent 70449307c1
commit bfcd745b0d
11 changed files with 68 additions and 27 deletions

View File

@ -1,2 +1,2 @@
export { default as tree } from './tree/tree';
export type { InputOptions, NodeWithId } from './tree/tree';
export type { InputOptions, NodeWithId, Primitive } from './tree/tree';

View File

@ -1,2 +1,2 @@
export { tree } from './charts';
export type { InputOptions, NodeWithId } from './charts';
export type { InputOptions, NodeWithId, Primitive } from './charts';

View File

@ -1,6 +1,6 @@
{
"presets": [
"@babel/preset-env",
["@babel/preset-env", { "targets": "defaults" }],
"@babel/preset-react",
"@babel/preset-typescript"
]

View File

@ -1 +1 @@
lib
dist

View File

@ -1,7 +1,13 @@
module.exports = {
extends: '../../eslintrc.ts.react.base.json',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
extends: '../../eslintrc.js.base.json',
overrides: [
{
files: ['*.ts', '*.tsx'],
extends: '../../eslintrc.ts.react.base.json',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
},
],
};

View File

@ -19,23 +19,23 @@
"lib",
"src"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"main": "dist/redux-devtools-chart-monitor.cjs.js",
"module": "dist/redux-devtools-chart-monitor.esm.js",
"types": "dist/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/reduxjs/redux-devtools.git"
},
"scripts": {
"build": "yarn run build:types && yarn run build:js",
"build:types": "tsc --emitDeclarationOnly",
"build:js": "babel src --out-dir lib --extensions \".ts,.tsx\" --source-maps inline",
"clean": "rimraf lib",
"build": "rollup -c",
"clean": "rimraf dist",
"lint": "eslint . --ext .ts,.tsx",
"type-check": "tsc --noEmit",
"prepack": "yarn run clean && yarn run build",
"prepublish": "yarn run type-check && yarn run lint"
},
"dependencies": {
"@babel/runtime": "^7.16.7",
"@types/prop-types": "^15.7.4",
"@types/redux-devtools-themes": "^1.0.0",
"d3-state-visualizer": "^1.4.2",
@ -44,12 +44,14 @@
"redux-devtools-themes": "^1.0.0"
},
"devDependencies": {
"@babel/cli": "^7.16.7",
"@babel/core": "^7.16.7",
"@babel/eslint-parser": "^7.16.5",
"@babel/plugin-transform-runtime": "^7.16.7",
"@babel/preset-env": "^7.16.7",
"@babel/preset-react": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@redux-devtools/core": "^3.9.2",
"@rollup/plugin-babel": "^5.3.0",
"@types/react": "^17.0.38",
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
@ -60,6 +62,9 @@
"react": "^17.0.2",
"redux": "^4.1.2",
"rimraf": "^3.0.2",
"rollup": "^2.63.0",
"rollup-plugin-typescript2": "^0.31.1",
"tslib": "^2.3.1",
"typescript": "~4.5.4"
},
"peerDependencies": {

View File

@ -0,0 +1,31 @@
import typescript from 'rollup-plugin-typescript2';
import babel from '@rollup/plugin-babel';
const config = [
{
input: 'src/index.ts',
output: [
{ file: 'dist/redux-devtools-chart-monitor.cjs.js', format: 'cjs' },
{ file: 'dist/redux-devtools-chart-monitor.esm.js', format: 'esm' },
],
plugins: [
typescript(),
babel({
babelHelpers: 'runtime',
extensions: ['.ts', '.tsx'],
plugins: ['@babel/plugin-transform-runtime'],
}),
],
external: [
/@babel\/runtime/,
'react',
'prop-types',
'redux-devtools-themes',
'@redux-devtools/core',
'deepmerge',
'd3-state-visualizer',
],
},
];
export default config;

View File

@ -1,14 +1,10 @@
import React, { Component, createRef } from 'react';
import PropTypes from 'prop-types';
import { tree } from 'd3-state-visualizer';
import { tree, NodeWithId, Primitive } from 'd3-state-visualizer';
import { Action, Dispatch } from 'redux';
import { LiftedAction, LiftedState } from '@redux-devtools/core';
import * as themes from 'redux-devtools-themes';
import { ChartMonitorState } from './reducers';
import {
NodeWithId,
Primitive,
} from 'd3-state-visualizer/lib/charts/tree/tree';
const wrapperStyle = {
width: '100%',

View File

@ -8,13 +8,10 @@ import {
} from '@redux-devtools/core';
import deepmerge from 'deepmerge';
import { Action, Dispatch } from 'redux';
import { NodeWithId, Primitive } from 'd3-state-visualizer';
import reducer, { ChartMonitorState } from './reducers';
import Chart, { Props } from './Chart';
import {
NodeWithId,
Primitive,
} from 'd3-state-visualizer/lib/charts/tree/tree';
// eslint-disable-next-line @typescript-eslint/unbound-method
const { reset, rollback, commit, sweep, toggleAction } = ActionCreators;

View File

@ -1 +1 @@
export { default } from './ChartMonitor';
export { default as Chart } from './ChartMonitor';

View File

@ -4620,12 +4620,15 @@ __metadata:
version: 0.0.0-use.local
resolution: "@redux-devtools/chart-monitor@workspace:packages/redux-devtools-chart-monitor"
dependencies:
"@babel/cli": ^7.16.7
"@babel/core": ^7.16.7
"@babel/eslint-parser": ^7.16.5
"@babel/plugin-transform-runtime": ^7.16.7
"@babel/preset-env": ^7.16.7
"@babel/preset-react": ^7.16.7
"@babel/preset-typescript": ^7.16.7
"@babel/runtime": ^7.16.7
"@redux-devtools/core": ^3.9.2
"@rollup/plugin-babel": ^5.3.0
"@types/prop-types": ^15.7.4
"@types/react": ^17.0.38
"@types/redux-devtools-themes": ^1.0.0
@ -4642,6 +4645,9 @@ __metadata:
redux: ^4.1.2
redux-devtools-themes: ^1.0.0
rimraf: ^3.0.2
rollup: ^2.63.0
rollup-plugin-typescript2: ^0.31.1
tslib: ^2.3.1
typescript: ~4.5.4
peerDependencies:
"@redux-devtools/core": ^3.7.0