Skip to content

Commit d707719

Browse files
committed
chore: update deps
1 parent 1176ee6 commit d707719

12 files changed

+130
-85
lines changed

.babelrc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
{
2-
"presets": ["@babel/preset-env", "@babel/preset-react"],
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"useBuiltIns": "entry",
7+
"corejs": {
8+
"version": "2",
9+
"proposals": true
10+
}
11+
}
12+
],
13+
"@babel/preset-react"
14+
],
315
"plugins": [
416
"@babel/plugin-syntax-dynamic-import",
517
"@babel/plugin-proposal-class-properties",

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- "8"
3+
- "14"
44
install:
55
- npm i -g codecov
66
- yarn

package.json

Lines changed: 54 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"license": "MIT",
88
"scripts": {
99
"precommit": "lint-staged",
10-
"start": "webpack-dev-server --config webpack.config.dev.js --progress",
10+
"start": "webpack serve --config webpack.config.dev.js --progress",
1111
"build": "webpack --config webpack.config.prod.js --progress",
1212
"test": "jest --config .jest.config.js",
1313
"test:watch": "npm run test -- --watch",
@@ -17,26 +17,30 @@
1717
"lint:style": "stylelint \"src/**/*.scss\" --syntax scss"
1818
},
1919
"dependencies": {
20-
"antd": "3.18.2",
21-
"axios": "^0.18.0",
20+
"@tiptap/react": "^2.0.0-beta.61",
21+
"@tiptap/starter-kit": "^2.0.0-beta.98",
22+
"antd": "^3.26.20",
23+
"axios": "^0.21.1",
2224
"classnames": "^2.2.5",
25+
"easymde": "^2.15.0",
2326
"enquire-js": "^0.2.1",
2427
"immutable": "^4.0.0-rc.12",
28+
"marked": "^3.0.0",
2529
"moment": "^2.22.1",
2630
"prop-types": "^15.6.1",
27-
"react": "16.8.6",
28-
"react-dom": "16.8.6",
29-
"react-helmet": "^5.2.1",
31+
"react": "17.0.2",
32+
"react-dom": "17.0.2",
33+
"react-helmet": "^6.1.0",
3034
"react-infinite-scroller": "^1.1.4",
31-
"react-markdown": "^4.0.8",
3235
"react-redux": "^7.0.3",
3336
"react-router-config": "^5.0.0",
3437
"react-router-dom": "^5.0.0",
35-
"react-simplemde-editor": "^4.0.1",
36-
"redux": "4.0.1",
38+
"react-simplemde-editor": "^5.0.1",
39+
"redux": "4.1.1",
3740
"redux-actions": "^2.3.0",
3841
"redux-immutable": "^4.0.0",
39-
"redux-thunk": "^2.2.0"
42+
"redux-thunk": "^2.2.0",
43+
"turndown": "^7.1.1"
4044
},
4145
"devDependencies": {
4246
"@babel/core": "^7.4.5",
@@ -45,52 +49,61 @@
4549
"@babel/plugin-transform-runtime": "^7.4.4",
4650
"@babel/preset-env": "^7.4.5",
4751
"@babel/preset-react": "^7.0.0",
48-
"autoprefixer": "^9.5.1",
52+
"autoprefixer": "^10.3.2",
4953
"babel-eslint": "^10.0.1",
5054
"babel-loader": "^8.0.6",
5155
"babel-plugin-import": "^1.11.2",
52-
"clean-webpack-plugin": "^2.0.2",
56+
"clean-webpack-plugin": "^4.0.0-alpha.0",
57+
"core-js": "^2.6.12",
5358
"css-loader": "^2.1.1",
5459
"enzyme": "^3.3.0",
5560
"enzyme-adapter-react-16": "^1.13.1",
5661
"enzyme-to-json": "^3.3.3",
57-
"eslint": "^5.16.0",
58-
"eslint-config-airbnb": "^17.1.0",
59-
"eslint-config-prettier": "^4.3.0",
62+
"eslint": "^7.32.0",
63+
"eslint-config-airbnb": "^18.2.1",
64+
"eslint-config-prettier": "^8.3.0",
6065
"eslint-plugin-compat": "^3.1.1",
61-
"eslint-plugin-import": "2.17.3",
66+
"eslint-plugin-import": "2.24.1",
6267
"eslint-plugin-jsx-a11y": "^6.0.3",
6368
"eslint-plugin-react": "^7.13.0",
64-
"file-loader": "^3.0.1",
65-
"html-webpack-plugin": "^3.0.6",
66-
"husky": "^2.3.0",
67-
"jest": "^24.8.0",
69+
"file-loader": "^6.2.0",
70+
"html-webpack-plugin": "^4.5.2",
71+
"husky": "^7.0.1",
72+
"jest": "^27.0.6",
6873
"jest-localstorage-mock": "^2.2.0",
69-
"less": "^3.0.1",
74+
"less": "^3.13.1",
7075
"less-loader": "^5.0.0",
71-
"lint-staged": "^8.1.7",
72-
"mockdate": "^2.0.2",
73-
"node-sass": "^4.12.0",
74-
"postcss-loader": "^3.0.0",
75-
"prettier": "^1.17.1",
76-
"react-hot-loader": "4.8.8",
76+
"lint-staged": "^11.1.2",
77+
"mkdirp": "^1.0.4",
78+
"mockdate": "^3.0.5",
79+
"postcss": "^8.3.6",
80+
"postcss-loader": "^4.3.0",
81+
"prettier": "^2.3.2",
82+
"react-hot-loader": "4.13.0",
7783
"redux-devtools-extension": "^2.13.2",
7884
"redux-mock-store": "^1.5.1",
79-
"sass-loader": "7.1.0",
80-
"sinon": "^7.3.2",
81-
"style-loader": "0.23.1",
82-
"stylelint": "10.0.1",
83-
"stylelint-config-prettier": "^5.2.0",
84-
"stylelint-config-standard": "^18.3.0",
85-
"sw-precache-webpack-plugin": "^0.11.5",
86-
"url-loader": "^1.0.1",
87-
"webpack": "4.32.2",
88-
"webpack-bundle-analyzer": "^3.3.2",
89-
"webpack-cli": "3.3.2",
90-
"webpack-dev-server": "^3.4.1",
91-
"webpack-manifest-plugin": "^2.0.1",
92-
"webpack-merge": "^4.1.2"
85+
"sass": "^1.38.0",
86+
"sass-loader": "^10.2.0",
87+
"sinon": "^11.1.2",
88+
"style-loader": "^2.0.0",
89+
"stylelint": "13.13.1",
90+
"stylelint-config-prettier": "^8.0.2",
91+
"stylelint-config-standard": "^22.0.0",
92+
"sw-precache-webpack-plugin": "^1.0.0",
93+
"url-loader": "^4.1.1",
94+
"webpack": "^4.46.0",
95+
"webpack-bundle-analyzer": "^4.4.2",
96+
"webpack-cli": "^4.8.0",
97+
"webpack-dev-server": "^4.0.0",
98+
"webpack-manifest-plugin": "^4.0.2",
99+
"webpack-merge": "^5.8.0"
93100
},
101+
"browserslist": [
102+
">1%",
103+
"last 4 versions",
104+
"Firefox ESR",
105+
"not ie < 9"
106+
],
94107
"lint-staged": {
95108
"src/**/*.{js,jsx}": [
96109
"prettier --write",

postcss.config.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
module.exports = {
22
plugins: [
33
require('autoprefixer')({
4-
browsers: [
5-
'>1%',
6-
'last 4 versions',
7-
'Firefox ESR',
8-
'not ie < 9',
9-
],
104
flexbox: 'no-2009',
115
}),
126
],

src/components/Tiptap/Tiptap.jsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import { useEditor, EditorContent } from '@tiptap/react';
4+
import StarterKit from '@tiptap/starter-kit';
5+
import marked from 'marked';
6+
7+
const Tiptap = ({ content, editable = false }) => {
8+
const editor = useEditor({
9+
extensions: [StarterKit],
10+
content: marked(content || ''),
11+
editable,
12+
});
13+
14+
return <EditorContent editor={editor} />;
15+
};
16+
17+
Tiptap.propTypes = {
18+
content: PropTypes.string.isRequired,
19+
editable: PropTypes.bool,
20+
};
21+
22+
export default Tiptap;

src/components/Tiptap/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from './Tiptap';

src/router.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { BrowserRouter as Router } from 'react-router-dom';
33
import { renderRoutes } from 'react-router-config';
4-
import { LocaleProvider } from 'antd';
4+
import { ConfigProvider } from 'antd';
55
import zhCN from 'antd/lib/locale-provider/zh_CN';
66
import { asyncRender } from 'utils';
77
import ScrollToTop from 'components/ScrollToTop';
@@ -65,11 +65,11 @@ const routerConfig = [
6565

6666
const App = () => {
6767
return (
68-
<LocaleProvider locale={zhCN}>
68+
<ConfigProvider locale={zhCN}>
6969
<Router>
7070
<ScrollToTop>{renderRoutes(routerConfig)}</ScrollToTop>
7171
</Router>
72-
</LocaleProvider>
72+
</ConfigProvider>
7373
);
7474
};
7575

src/routes/Topic/components/TopicContent.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import { connect } from 'react-redux';
55
import { Map } from 'immutable';
66
import { timeUtils } from 'utils';
77
import { Card, Button, Avatar, Switch, Icon, Tag, Divider } from 'antd';
8-
import Markdown from 'react-markdown';
98
import { collectTopic } from '../TopicRedux';
109
import { editTopic } from '../../Post/PostRedux';
1110
import styles from './TopicContent.scss';
11+
import Tiptap from '../../../components/Tiptap';
1212

1313
export class TopicContentComponent extends React.Component {
1414
constructor(props) {
@@ -108,7 +108,7 @@ export class TopicContentComponent extends React.Component {
108108
]
109109
}
110110
>
111-
<Markdown className="markdown-body" source={topicData.get('content')} />
111+
<Tiptap content={topicData.get('content')} />
112112
</Card>
113113
);
114114
}
@@ -129,7 +129,7 @@ const Collect = ({ loadingCollect, isCollect, onClickCollect }) => {
129129
);
130130
};
131131

132-
const TopicContentCollect = connect(state => ({
132+
const TopicContentCollect = connect((state) => ({
133133
loadingCollect: state.getIn(['topic', 'loadingCollect']),
134134
isCollect: state.getIn(['topic', 'isCollect']),
135135
}))(Collect);
@@ -159,7 +159,7 @@ Collect.propTypes = {
159159

160160
export default withRouter(
161161
connect(
162-
state => ({
162+
(state) => ({
163163
loading: state.getIn(['topic', 'loading']),
164164
topicData: state.getIn(['topic', 'topicData']),
165165
currentUser: state.getIn(['login', 'userData']),

src/routes/Topic/components/TopicReplies.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { Link } from 'react-router-dom';
55
import { List as ImmutableList } from 'immutable';
66
import { timeUtils } from 'utils';
77
import { Card, List, Avatar, Tag, Divider } from 'antd';
8-
import Markdown from 'react-markdown';
98
import TopicUp from './TopicUp';
109
import styles from './TopicReplies.scss';
10+
import Tiptap from '../../../components/Tiptap';
1111

1212
const Replies = ({
1313
repliesResult,
@@ -80,7 +80,7 @@ const Reply = ({
8080
<TopicUp replyId={replyId} onClickUp={onClickUp} />
8181
</div>
8282
}
83-
description={<Markdown className="markdown-body" source={content} />}
83+
description={<Tiptap content={content} />}
8484
/>
8585
</List.Item>
8686
);
@@ -139,7 +139,7 @@ Reply.propTypes = {
139139
onClickUp: PropTypes.func.isRequired,
140140
};
141141

142-
export default connect(state => ({
142+
export default connect((state) => ({
143143
repliesResult: state.getIn(['topic', 'repliesData', 'result']),
144144
authorName: state.getIn(['topic', 'topicData', 'author', 'loginname']),
145145
}))(Replies);

webpack.config.dev.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
const path = require('path');
22
const webpack = require('webpack');
33
const HtmlWebpackPlugin = require('html-webpack-plugin');
4-
const merge = require('webpack-merge');
4+
const { merge } = require('webpack-merge');
55
const base = require('./webpack.config');
66

77
const dev = {
88
mode: 'development',
9-
entry: [
10-
path.resolve('src', 'index.js'),
11-
],
9+
entry: [path.resolve('src', 'index.js')],
1210
output: {
1311
path: path.resolve('dist'),
1412
publicPath: '/',
1513
filename: 'static/js/[name].js',
1614
chunkFilename: 'static/js/[name].min.js',
1715
},
18-
devtool: 'cheap-module-eval-source-map',
16+
devtool: 'eval-cheap-module-source-map',
1917
devServer: {
20-
contentBase: './dist',
21-
publicPath: '/',
22-
inline: true,
18+
compress: true,
2319
hot: true,
2420
historyApiFallback: true,
2521
host: '0.0.0.0',
26-
disableHostCheck: true,
22+
allowedHosts: 'all',
2723
port: 3000,
24+
static: {
25+
publicPath: './dist',
26+
},
27+
devMiddleware: {
28+
publicPath: '/',
29+
},
2830
},
2931
plugins: [
3032
new HtmlWebpackPlugin({

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const path = require('path');
22

33
module.exports = {
44
resolve: {
5-
extensions: ['.js', '.json', '.css', '.scss', '.less'],
5+
extensions: ['.js', '.jsx', '.json', '.css', '.scss', '.less'],
66
modules: [path.resolve('src'), path.resolve('node_modules')],
77
},
88
module: {

0 commit comments

Comments
 (0)