Skip to content

Commit

Permalink
Merge pull request #8 from now1then/dev/2.0.0
Browse files Browse the repository at this point in the history
Dev/2.0.0
  • Loading branch information
now1then authored Dec 10, 2020
2 parents 9238eaf + 2319857 commit 56dc65d
Show file tree
Hide file tree
Showing 50 changed files with 496 additions and 17,727 deletions.
1 change: 1 addition & 0 deletions .eslintcache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"/Users/nowthen/work/local/template/react-web-pro/src/components/LoadingPage/index.js":"1","/Users/nowthen/work/local/template/react-web-pro/src/layouts/BasicLayout/index.js":"2","/Users/nowthen/work/local/template/react-web-pro/src/layouts/BlankLayout/index.js":"3","/Users/nowthen/work/local/template/react-web-pro/src/layouts/MainFooter/index.js":"4","/Users/nowthen/work/local/template/react-web-pro/src/layouts/MainHeader/index.js":"5","/Users/nowthen/work/local/template/react-web-pro/src/layouts/SiderMenu/index.js":"6","/Users/nowthen/work/local/template/react-web-pro/src/main.js":"7","/Users/nowthen/work/local/template/react-web-pro/src/pages/Exception/403.js":"8","/Users/nowthen/work/local/template/react-web-pro/src/pages/Exception/404.js":"9","/Users/nowthen/work/local/template/react-web-pro/src/pages/Exception/500.js":"10","/Users/nowthen/work/local/template/react-web-pro/src/pages/FormDemo/SearchForm.js":"11","/Users/nowthen/work/local/template/react-web-pro/src/pages/FormDemo/index.js":"12","/Users/nowthen/work/local/template/react-web-pro/src/pages/FormDemo/newModal.js":"13","/Users/nowthen/work/local/template/react-web-pro/src/pages/FormDemo/store.js":"14","/Users/nowthen/work/local/template/react-web-pro/src/pages/Home/index.js":"15","/Users/nowthen/work/local/template/react-web-pro/src/pages/Home/store.js":"16","/Users/nowthen/work/local/template/react-web-pro/src/pages/Login/index.js":"17","/Users/nowthen/work/local/template/react-web-pro/src/pages/System/GroovySet/index.js":"18","/Users/nowthen/work/local/template/react-web-pro/src/pages/System/GroovySet/newModal.js":"19","/Users/nowthen/work/local/template/react-web-pro/src/pages/System/GroovySet/store.js":"20","/Users/nowthen/work/local/template/react-web-pro/src/pages/System/Star/index.js":"21","/Users/nowthen/work/local/template/react-web-pro/src/pages/System/User/index.js":"22","/Users/nowthen/work/local/template/react-web-pro/src/pages/Welcome/index.js":"23","/Users/nowthen/work/local/template/react-web-pro/src/routers/AppRouter.js":"24","/Users/nowthen/work/local/template/react-web-pro/src/routers/config.js":"25","/Users/nowthen/work/local/template/react-web-pro/src/services/newRequest.js":"26","/Users/nowthen/work/local/template/react-web-pro/src/stores/commonStore.js":"27","/Users/nowthen/work/local/template/react-web-pro/src/stores/globalStore.js":"28","/Users/nowthen/work/local/template/react-web-pro/src/stores/index.js":"29","/Users/nowthen/work/local/template/react-web-pro/src/utils/constant.js":"30","/Users/nowthen/work/local/template/react-web-pro/src/utils/index.js":"31","/Users/nowthen/work/local/template/react-web-pro/src/utils/renderRoutes.js":"32"},{"size":253,"mtime":1607510199692,"results":"33","hashOfConfig":"34"},{"size":624,"mtime":1607591634307,"results":"35","hashOfConfig":"34"},{"size":112,"mtime":1607510199693,"results":"36","hashOfConfig":"34"},{"size":151,"mtime":1607591634308,"results":"37","hashOfConfig":"34"},{"size":1416,"mtime":1607591634308,"results":"38","hashOfConfig":"34"},{"size":2755,"mtime":1607592817417,"results":"39","hashOfConfig":"34"},{"size":585,"mtime":1607591634309,"results":"40","hashOfConfig":"34"},{"size":339,"mtime":1607591634310,"results":"41","hashOfConfig":"34"},{"size":342,"mtime":1607591634310,"results":"42","hashOfConfig":"34"},{"size":333,"mtime":1607591634311,"results":"43","hashOfConfig":"34"},{"size":3042,"mtime":1607591634311,"results":"44","hashOfConfig":"34"},{"size":2524,"mtime":1607592893293,"results":"45","hashOfConfig":"34"},{"size":2182,"mtime":1607591634312,"results":"46","hashOfConfig":"34"},{"size":3635,"mtime":1607591634312,"results":"47","hashOfConfig":"34"},{"size":777,"mtime":1607591634312,"results":"48","hashOfConfig":"34"},{"size":955,"mtime":1607592893356,"results":"49","hashOfConfig":"34"},{"size":1667,"mtime":1607591634313,"results":"50","hashOfConfig":"34"},{"size":2708,"mtime":1607591634314,"results":"51","hashOfConfig":"34"},{"size":4607,"mtime":1607591634315,"results":"52","hashOfConfig":"34"},{"size":4204,"mtime":1607591634315,"results":"53","hashOfConfig":"34"},{"size":66,"mtime":1607592840967,"results":"54","hashOfConfig":"34"},{"size":66,"mtime":1607592840967,"results":"55","hashOfConfig":"34"},{"size":141,"mtime":1607591634316,"results":"56","hashOfConfig":"34"},{"size":1393,"mtime":1607591634317,"results":"57","hashOfConfig":"34"},{"size":3190,"mtime":1607591634317,"results":"58","hashOfConfig":"34"},{"size":4326,"mtime":1607592840967,"results":"59","hashOfConfig":"34"},{"size":104,"mtime":1607510199698,"results":"60","hashOfConfig":"34"},{"size":519,"mtime":1607591634318,"results":"61","hashOfConfig":"34"},{"size":382,"mtime":1607591634318,"results":"62","hashOfConfig":"34"},{"size":978,"mtime":1607510199699,"results":"63","hashOfConfig":"34"},{"size":2390,"mtime":1607593154951,"results":"64","hashOfConfig":"34"},{"size":669,"mtime":1607592840967,"results":"65","hashOfConfig":"34"},{"filePath":"66","messages":"67","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1kap956",{"filePath":"68","messages":"69","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"70","messages":"71","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"72","messages":"73","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"74","messages":"75","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"76","messages":"77","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"78","messages":"79","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"80","messages":"81","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"82","messages":"83","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"84","messages":"85","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"86","messages":"87","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"88","messages":"89","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"90","messages":"91","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"92","messages":"93","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"94","messages":"95","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"96","messages":"97","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"98","messages":"99","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"100","messages":"101","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"102","messages":"103","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"104","messages":"105","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"106","messages":"107","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"108","messages":"109","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"110","messages":"111","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"112","messages":"113","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"114","messages":"115","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"116","messages":"117","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"118","messages":"119","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"120","messages":"121","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"122","messages":"123","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"124","messages":"125","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"126","messages":"127","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"128","messages":"129","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/nowthen/work/local/template/react-web-pro/src/components/LoadingPage/index.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/layouts/BasicLayout/index.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/layouts/BlankLayout/index.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/layouts/MainFooter/index.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/layouts/MainHeader/index.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/layouts/SiderMenu/index.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/main.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/pages/Exception/403.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/pages/Exception/404.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/pages/Exception/500.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/pages/FormDemo/SearchForm.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/pages/FormDemo/index.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/pages/FormDemo/newModal.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/pages/FormDemo/store.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/pages/Home/index.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/pages/Home/store.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/pages/Login/index.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/pages/System/GroovySet/index.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/pages/System/GroovySet/newModal.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/pages/System/GroovySet/store.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/pages/System/Star/index.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/pages/System/User/index.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/pages/Welcome/index.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/routers/AppRouter.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/routers/config.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/services/newRequest.js",["130","131","132","133"],"/Users/nowthen/work/local/template/react-web-pro/src/stores/commonStore.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/stores/globalStore.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/stores/index.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/utils/constant.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/utils/index.js",[],"/Users/nowthen/work/local/template/react-web-pro/src/utils/renderRoutes.js",[],{"ruleId":"134","severity":1,"message":"135","line":21,"column":5,"nodeType":"136","messageId":"137","endLine":21,"endColumn":14},{"ruleId":"134","severity":1,"message":"135","line":28,"column":5,"nodeType":"136","messageId":"137","endLine":28,"endColumn":14},{"ruleId":"138","severity":1,"message":"139","line":110,"column":14,"nodeType":"140","messageId":"141","endLine":110,"endColumn":45},{"ruleId":"138","severity":1,"message":"139","line":112,"column":14,"nodeType":"140","messageId":"141","endLine":112,"endColumn":32},"func-names","Unexpected unnamed function.","FunctionExpression","unnamed","prefer-promise-reject-errors","Expected the Promise rejection reason to be an Error.","CallExpression","rejectAnError"]
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = {
'no-console': process.env.NODE_ENV === 'production' ? 'warning' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warning' : 'off',
'prefer-destructuring': 0,
'prefer-promise-reject-errors': 1,
'no-else-return': 0,
'import/no-extraneous-dependencies': 0,
'import/no-unresolved': [2, { ignore: ['^@/'] }],
Expand All @@ -37,6 +38,6 @@ module.exports = {
'jsx-a11y/anchor-has-content': 0,
'jsx-a11y/click-events-have-key-events': 0,
'jsx-a11y/anchor-is-valid': 0,
'comma-dangle': ['error', 'always-multiline'],
// 'comma-dangle': ['error', 'always-multiline'],
},
};
96 changes: 9 additions & 87 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,101 +5,23 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
yarn.lock
package-lock.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history
.cache
.DS_store
.idea/
.history
.vscode

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next
.npm

# Nuxt.js build / generate output
.nuxt
node_modules
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
8 changes: 1 addition & 7 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
**/*.svg

package.json
.umi
.umi-production
AUTHORS.txt
lib/
es/
dist/
_site/
coverage/
CNAME
LICENSE
yarn.lock
netlify.toml
yarn-error.log
*.sh
*.snap
.gitignore
.npmignore
.prettierignore
.DS_Store
.editorconfig
.eslintignore
**/*.yml
18 changes: 9 additions & 9 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = {
singleQuote: true,
trailingComma: 'all',
printWidth: 100,
overrides: [
{
files: '.prettierrc',
options: {
parser: 'json',
},
},
],
printWidth: 120,
// overrides: [
// {
// files: '.prettierrc',
// options: {
// parser: 'json',
// },
// },
// ],
};
9 changes: 9 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": ["stylelint-config-standard", "stylelint-config-prettier"],
"rules": {
"declaration-empty-line-before": null,
"no-descending-specificity": null,
"selector-pseudo-class-no-unknown": null,
"selector-pseudo-element-colon-notation": null
}
}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
## V2.0.0
`2020-12-12`

* 升级项目中全部依赖库版本,主要包括:react17、antd4、webpack5...
* 增加 commitlint 规范git提交;
* 增加 husky + lint-staged + Prettier 规范代码提交校验
* 优化 eslint + prettier 规范项目代码风格


## V1.0.0
第一版
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 nowThen
Copyright (c) 2020 nowThen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[![license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/now1then/react-web-pro/master/LICENSE)

[![webpack](https://img.shields.io/badge/webpack-4.41.2-green)](https://github.com/webpack/webpack) [![react](https://img.shields.io/badge/react-16.12.0-green)](https://github.com/facebook/react) [![react-router](https://img.shields.io/badge/react--router-5.1.2-green)](https://github.com/ReactTraining/react-router) [![axios](https://img.shields.io/badge/axios-0.19.0-green)](https://github.com/axios/axios) [![ant-design](https://img.shields.io/badge/ant--design-3.26.2-green.svg)](https://ant.design/index-cn) [![mobx](https://img.shields.io/badge/mobx-5.15.0-green.svg)](https://github.com/mobxjs/mobx)
[![webpack](https://img.shields.io/badge/webpack-5.10.0-green)](https://github.com/webpack/webpack) [![react](https://img.shields.io/badge/react-17.0.1-green)](https://github.com/facebook/react) [![react-router](https://img.shields.io/badge/react--router-5.2.0-green)](https://github.com/ReactTraining/react-router) [![axios](https://img.shields.io/badge/axios-0.21.0-green)](https://github.com/axios/axios) [![ant-design](https://img.shields.io/badge/ant--design-4.9.2-green.svg)](https://ant.design/index-cn) [![mobx](https://img.shields.io/badge/mobx-5.15.0-green.svg)](https://github.com/mobxjs/mobx)

## 说明

Expand All @@ -23,13 +23,13 @@

涉及的技术栈均采用当前最新的版本和语法:

- 使用 Webpack4.0 构建项目(不使用 create-react-app、umi 等脚手架);
- 使用 Webpack5.0 构建项目(不使用 create-react-app、umi 等脚手架);
- 使用 Babel7 配置转换 ES6、React、Mobx 等语法;
- React 版本 V16.12.0,全部采用函数化 Hooks 特性开发项目组件;
- React 版本 V17.0.1,全部采用函数化 Hooks 特性开发项目组件;
- 采用 React-router5 工具 配置项目路由;
- 采用 Mobx5 + Hooks 实现项目数据状态管理;
- 封装 Axios 库实现与后台 http 请求交互;
- UI 库采用流行的 Ant-design3.0 组件库;
- UI 库采用流行的 Ant-design4.0 组件库;
- 完整项目实现及模块结构拆分;

### 目录结构
Expand Down
20 changes: 12 additions & 8 deletions build/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const AntdDayjsWebpackPlugin = require('antd-dayjs-webpack-plugin');
const os = require('os');
const HappyPack = require('happypack');

Expand All @@ -16,7 +17,7 @@ module.exports = {
},
output: {
path: path.join(__dirname, '../dist'),
filename: '[name].[chunk:8].js',
filename: '[name].[chunkhash:8].js',
// publicPath: "/",
chunkFilename: 'chunk/[name].[chunkhash:8].js',
},
Expand Down Expand Up @@ -77,18 +78,21 @@ module.exports = {
id: 'happybabel',
loaders: ['babel-loader?cacheDirectory=true'],
threadPool: happyThreadPool,
cache: true,
// cache: true,
verbose: true,
}),
new HtmlWebpackPlugin({
template: `${srcDir}/index.html`,
}),
new CopyWebpackPlugin([
{
from: `${srcDir}/assets/images/nowthen.jpg`,
to: 'nowthen.jpg',
},
]),
new CopyWebpackPlugin({
patterns: [
{
from: `${srcDir}/assets/images/nowthen.jpg`,
to: 'nowthen.jpg',
},
],
}),
new AntdDayjsWebpackPlugin()
],
resolve: {
alias: {
Expand Down
9 changes: 6 additions & 3 deletions build/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const webpack = require('webpack');
const merge = require('webpack-merge');
const {merge} = require('webpack-merge');
// const path = require('path');

const commonConfig = require('./webpack.common');
Expand All @@ -8,7 +8,7 @@ module.exports = merge(commonConfig, {
mode: 'development',
// 开发环境本地启动的服务配置
devServer: {
port: 9000,
port: 9001,
hot: true,
open: true,
historyApiFallback: true,
Expand All @@ -23,6 +23,9 @@ module.exports = merge(commonConfig, {
},
},
},
plugins: [new webpack.NamedModulesPlugin(), new webpack.HotModuleReplacementPlugin()],
plugins: [ new webpack.HotModuleReplacementPlugin()],
devtool: 'eval-source-map',
optimization: {
moduleIds: 'named',
},
});
Loading

0 comments on commit 56dc65d

Please sign in to comment.