Skip to content

Commit 85cef33

Browse files
committed
feat: ✨ 基本代码结构搭建
1 parent ff07768 commit 85cef33

36 files changed

+1975
-100
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[*.{js,jsx,ts,tsx,vue}]
2+
indent_style = space
3+
indent_size = 2
4+
trim_trailing_whitespace = true
5+
insert_final_newline = true

.env

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
PORT=8000
2+
3+
# 配置axios请求
4+
REACT_APP_pathname=/vue-blog
5+
6+
# 配置列表页一页显示的文章个数
7+
REACT_APP_listLimit=10
8+
9+
# 网站名称,页脚也会使用
10+
REACT_APP_title=樊小书生
11+
12+
REACT_APP_host=https://www.fxss.work

.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "react-app"
3+
}

craco.config.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* craco.config.js */
2+
const AntdDayjsWebpackPlugin = require('antd-dayjs-webpack-plugin');
3+
const CracoLessPlugin = require('craco-less');
4+
const path = require('path')
5+
6+
const pathResolve = pathUrl => path.join(__dirname, pathUrl)
7+
8+
module.exports = {
9+
webpack: {
10+
alias: {
11+
'@': pathResolve('src')
12+
}
13+
},
14+
plugins: [
15+
{
16+
plugin: AntdDayjsWebpackPlugin,
17+
},
18+
{
19+
plugin: CracoLessPlugin,
20+
options: {
21+
lessLoaderOptions: {
22+
lessOptions: {
23+
// modifyVars: { '@primary-color': '#1DA57A' },
24+
javascriptEnabled: true,
25+
},
26+
},
27+
},
28+
},
29+
],
30+
};

jsconfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"paths": {
5+
"@/*": ["./src/*"]
6+
}
7+
}
8+
}

package.json

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,35 @@
22
"name": "blog-react",
33
"version": "0.1.0",
44
"private": true,
5+
"scripts": {
6+
"start": "craco start",
7+
"build": "craco build",
8+
"test": "craco test",
9+
"analyze": "source-map-explorer build/static/js/main.*",
10+
"eject": "react-scripts eject"
11+
},
512
"dependencies": {
13+
"@craco/craco": "^5.6.4",
614
"@testing-library/jest-dom": "^4.2.4",
715
"@testing-library/react": "^9.3.2",
816
"@testing-library/user-event": "^7.1.2",
17+
"antd": "^4.6.4",
18+
"axios": "^0.20.0",
19+
"craco-less": "^1.17.0",
20+
"dayjs": "^1.8.35",
21+
"http-proxy-middleware": "^1.0.5",
22+
"husky": "^4.3.0",
23+
"lint-staged": "^10.4.0",
24+
"prettier": "^2.1.2",
925
"react": "^16.13.1",
1026
"react-dom": "^16.13.1",
11-
"react-scripts": "3.4.3"
12-
},
13-
"scripts": {
14-
"start": "react-scripts start",
15-
"build": "react-scripts build",
16-
"test": "react-scripts test",
17-
"eject": "react-scripts eject"
27+
"react-helmet": "^6.1.0",
28+
"react-redux": "^7.2.1",
29+
"react-router-dom": "^5.2.0",
30+
"react-scripts": "3.4.3",
31+
"redux": "^4.0.5",
32+
"redux-saga": "^1.1.3",
33+
"source-map-explorer": "^2.5.0"
1834
},
1935
"eslintConfig": {
2036
"extends": "react-app"
@@ -30,5 +46,20 @@
3046
"last 1 firefox version",
3147
"last 1 safari version"
3248
]
49+
},
50+
"devDependencies": {
51+
"antd-dayjs-webpack-plugin": "^1.0.1",
52+
"redux-devtools": "^3.7.0"
53+
},
54+
"husky": {
55+
"hooks": {
56+
"pre-commit": "lint-staged"
57+
}
58+
},
59+
"lint-staged": {
60+
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
61+
"prettier --single-quote --write",
62+
"git add"
63+
]
3364
}
3465
}

public/favicon.ico

1.11 KB
Binary file not shown.

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html lang="en">
2+
<html lang="zh_CN">
33
<head>
44
<meta charset="utf-8" />
55
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />

src/App.css

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/App.js

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
11
import React from 'react';
2-
import logo from './logo.svg';
3-
import './App.css';
2+
import './App.less';
3+
import SecurityLayout from '@/layouts/SecurityLayout';
4+
import BasicLayout from '@/layouts/BasicLayout';
45

56
function App() {
67
return (
7-
<div className="App">
8-
<header className="App-header">
9-
<img src={logo} className="App-logo" alt="logo" />
10-
<p>
11-
Edit <code>src/App.js</code> and save to reload.
12-
</p>
13-
<a
14-
className="App-link"
15-
href="https://reactjs.org"
16-
target="_blank"
17-
rel="noopener noreferrer"
18-
>
19-
Learn React
20-
</a>
21-
</header>
22-
</div>
8+
<SecurityLayout>
9+
<BasicLayout></BasicLayout>
10+
</SecurityLayout>
2311
);
2412
}
2513

0 commit comments

Comments
 (0)