Skip to content

Commit 9e129d1

Browse files
authored
Merge pull request #89 from codingapi/dev
Dev
2 parents 8bd31be + bbd21d8 commit 9e129d1

File tree

190 files changed

+10971
-101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+10971
-101
lines changed

Diff for: .DS_Store

10 KB
Binary file not shown.

Diff for: admin-pro-ui/.gitignore

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
/.idea
4+
5+
# dependencies
6+
/node_modules
7+
/.pnp
8+
.pnp.js
9+
10+
# testing
11+
/coverage
12+
13+
# production
14+
/build
15+
/dist
16+
17+
# misc
18+
.DS_Store
19+
.env.local
20+
.env.development.local
21+
.env.test.local
22+
.env.production.local
23+
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
yarn.lock
28+

Diff for: admin-pro-ui/README.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Admin-ui with Antd For Micro Frontends
2+
3+
This is a simple React App with Webpack5 & Typescript.
4+
5+
## Features
6+
1. Support Webpack 5 ModuleFederationPlugin for Micro Frontends
7+
2. Support Dynamic zip component loading
8+
3. Support Dynamic Routing & Dynamic Menu
9+
4. Support Axios for API calls
10+
5. Support Antd & Pro-Components UI Library
11+
6. Support Redux for State Management
12+
7. Support Mock Server for API Mocking
13+
8. Support Monaco Editor for Code Editor
14+
9. Support Access ControlPanel for Menu & Page Components
15+
16+
## Running
17+
```shell
18+
yarn
19+
20+
yarn start
21+
```
22+
## Build
23+
```shell
24+
yarn build
25+
```
26+
27+
## Deploy
28+
```shell
29+
cd scripts
30+
sh package.sh
31+
sh deploy.sh
32+
```
33+

Diff for: admin-pro-ui/__mocks__/axios.ts

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// __mocks__/axios.ts
2+
const mockAxios = {
3+
create: jest.fn(() => ({
4+
interceptors: {
5+
request: {
6+
use: jest.fn(),
7+
eject: jest.fn()
8+
},
9+
response: {
10+
use: jest.fn(),
11+
eject: jest.fn()
12+
}
13+
},
14+
get: jest.fn(),
15+
post: jest.fn(),
16+
put: jest.fn(),
17+
delete: jest.fn(),
18+
patch: jest.fn()
19+
})),
20+
interceptors: {
21+
request: {
22+
use: jest.fn(),
23+
eject: jest.fn()
24+
},
25+
response: {
26+
use: jest.fn(),
27+
eject: jest.fn()
28+
}
29+
},
30+
get: jest.fn(),
31+
post: jest.fn(),
32+
put: jest.fn(),
33+
delete: jest.fn(),
34+
patch: jest.fn()
35+
};
36+
37+
export default mockAxios;

Diff for: admin-pro-ui/__mocks__/fileMock.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = 'test-file-stub';

Diff for: admin-pro-ui/__mocks__/monaco-editor.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
editor: {
3+
create: jest.fn(() => ({
4+
dispose: jest.fn(),
5+
getValue: jest.fn(() => ''),
6+
setValue: jest.fn(),
7+
})),
8+
},
9+
};

Diff for: admin-pro-ui/jest.config.ts

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import type { Config } from 'jest';
2+
3+
const config: Config = {
4+
preset: 'ts-jest',
5+
testEnvironment: 'jsdom',
6+
transform: {
7+
'^.+\\.(ts|tsx)$': ['ts-jest', {
8+
useESM: true,
9+
}],
10+
'^.+\\.(js|jsx|mjs)$': ['babel-jest', {
11+
presets: [
12+
['@babel/preset-env', {
13+
targets: {
14+
node: 'current',
15+
},
16+
}],
17+
'@babel/preset-react',
18+
'@babel/preset-typescript'
19+
],
20+
}],
21+
},
22+
moduleNameMapper: {
23+
'^monaco-editor$': '<rootDir>/__mocks__/monaco-editor.js',
24+
"@logicflow": "<rootDir>/node_modules/@logicflow/core/dist/index.min.js",
25+
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
26+
'\\.(jpg|jpeg|png|gif|webp|svg)$': '<rootDir>/__mocks__/fileMock.js',
27+
'^@/(.*)$': '<rootDir>/src/$1'
28+
},
29+
setupFilesAfterEnv: ['<rootDir>/src/jest.setup.ts'],
30+
testMatch: [
31+
"**/__test__/**/*.[jt]s?(x)",
32+
"**/__tests__/**/*.[jt]s?(x)",
33+
"**/?(*.)+(spec|test).[jt]s?(x)"
34+
],
35+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
36+
transformIgnorePatterns: [
37+
'node_modules/(?!(lodash-es|@ant-design|@logicflow|other-esm-modules)/)'
38+
],
39+
};
40+
41+
export default config;

Diff for: admin-pro-ui/mocks/index.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const userMock = require('./user');
2+
const productMock = require('./product');
3+
4+
module.exports = (app, helper) => {
5+
userMock(app);
6+
productMock(app);
7+
};

Diff for: admin-pro-ui/mocks/product.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const Mock = require('mockjs');
2+
3+
module.exports = (app, helper) => {
4+
app.get('/api/products', (req, res) => {
5+
6+
const products = Mock.mock({
7+
'list|100': [{
8+
'id|+1': 1,
9+
'name': '@name',
10+
'price|100-1000': 1,
11+
}]
12+
}).list;
13+
14+
res.json(products);
15+
});
16+
};

Diff for: admin-pro-ui/mocks/user.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module.exports = (app, helper) => {
2+
app.post('/user/login', (req, res) => {
3+
const username = req.body.username;
4+
5+
if(username==='admin'){
6+
res.json({
7+
success:true,
8+
data:{
9+
'username': username,
10+
'token':'test token',
11+
'avatar':'/logo.png',
12+
'authorities': ['ROLE_ADMIN','ROLE_DEVELOPER'],
13+
}
14+
});
15+
return;
16+
}
17+
18+
res.json({
19+
success:true,
20+
data:{
21+
'username': username,
22+
'token':'test token',
23+
'avatar':'/logo.png',
24+
'authorities': ['ROLE_USER'],
25+
}
26+
});
27+
});
28+
};

Diff for: admin-pro-ui/package.json

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"name": "admin-pro-ui",
3+
"version": "0.1.0",
4+
"private": true,
5+
"dependencies": {
6+
"@ag-grid-community/locale": "^33.0.3",
7+
"@ant-design/icons": "^5.4.0",
8+
"@ant-design/pro-components": "^2.8.2",
9+
"@babel/standalone": "^7.25.6",
10+
"@dnd-kit/core": "^6.2.0",
11+
"@dnd-kit/sortable": "^9.0.0",
12+
"@handsontable/react-wrapper": "^15.0.0",
13+
"@logicflow/core": "^2.0.5",
14+
"@logicflow/extension": "^2.0.9",
15+
"@reduxjs/toolkit": "^2.2.7",
16+
"@types/babel__standalone": "^7.1.7",
17+
"@types/node": "^16.18.108",
18+
"@types/react": "^18.3.5",
19+
"@types/react-dom": "^18.3.0",
20+
"ag-grid-react": "^33.0.3",
21+
"antd": "^5.20.6",
22+
"axios": "^1.7.7",
23+
"base64-js": "^1.5.1",
24+
"handsontable": "^15.0.0",
25+
"jszip": "^3.10.1",
26+
"lodash": "^4.17.21",
27+
"moment": "^2.30.1",
28+
"monaco-editor": "^0.51.0",
29+
"react": "^18.3.1",
30+
"react-dom": "^18.3.1",
31+
"react-markdown": "^10.0.0",
32+
"react-redux": "^9.1.2",
33+
"react-router": "^6.26.2",
34+
"react-router-dom": "^6.26.2",
35+
"remark-gfm": "^4.0.1",
36+
"typescript": "^5.6.2",
37+
"web-vitals": "^2.1.4"
38+
},
39+
"scripts": {
40+
"start": "webpack serve --config webpack.config.mock.js --open",
41+
"dev": "webpack serve --config webpack.config.dev.js --open",
42+
"build": "webpack --mode production --config webpack.config.prod.js",
43+
"test": "jest",
44+
"test:watch": "jest --watchAll"
45+
},
46+
"eslintConfig": {
47+
"extends": [
48+
"react-app"
49+
]
50+
},
51+
"browserslist": {
52+
"production": [
53+
">0.2%",
54+
"not dead",
55+
"not op_mini all"
56+
],
57+
"development": [
58+
"last 1 chrome version",
59+
"last 1 firefox version",
60+
"last 1 safari version"
61+
]
62+
},
63+
"devDependencies": {
64+
"@babel/preset-env": "^7.26.0",
65+
"@babel/preset-react": "^7.26.3",
66+
"@babel/preset-typescript": "^7.26.0",
67+
"@testing-library/dom": "^10.4.0",
68+
"@testing-library/jest-dom": "^6.6.3",
69+
"@testing-library/react": "^16.1.0",
70+
"@types/jest": "^29.5.14",
71+
"@types/lodash": "^4.17.7",
72+
"@types/lodash-es": "^4.17.12",
73+
"babel-jest": "^29.7.0",
74+
"clean-webpack-plugin": "^4.0.0",
75+
"copy-webpack-plugin": "^12.0.2",
76+
"css-loader": "^7.1.2",
77+
"express": "^4.21.0",
78+
"html-webpack-plugin": "^5.6.0",
79+
"identity-obj-proxy": "^3.0.0",
80+
"jest": "^29.7.0",
81+
"jest-environment-jsdom": "^29.7.0",
82+
"mockjs": "^1.1.0",
83+
"monaco-editor-webpack-plugin": "^7.1.0",
84+
"sass": "^1.78.0",
85+
"sass-loader": "^16.0.1",
86+
"style-loader": "^4.0.0",
87+
"ts-jest": "^29.2.5",
88+
"ts-loader": "^9.5.1",
89+
"ts-node": "^10.9.2",
90+
"webpack": "^5.94.0",
91+
"webpack-cli": "^5.1.4",
92+
"webpack-dev-server": "^5.1.0",
93+
"webpack-merge": "^6.0.1",
94+
"webpack-mock-server": "^1.0.21"
95+
}
96+
}

Diff for: admin-pro-ui/public/captcha.jpeg

548 Bytes
Loading

Diff for: admin-pro-ui/public/favicon.ico

3.78 KB
Binary file not shown.

Diff for: admin-pro-ui/public/index.html

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta
8+
name="description"
9+
content="Web site created using create-react-app"
10+
/>
11+
<!--
12+
Notice the use of %PUBLIC_URL% in the tags above.
13+
It will be replaced with the URL of the `public` folder during the build.
14+
Only files inside the `public` folder can be referenced from the HTML.
15+
16+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
17+
work correctly both with client-side routing and a non-root public URL.
18+
Learn how to configure a non-root public URL by running `npm run build`.
19+
-->
20+
<title>Admin-Pro UI</title>
21+
</head>
22+
<body>
23+
<noscript>You need to enable JavaScript to run this app.</noscript>
24+
<div id="root"></div>
25+
<!--
26+
This HTML file is a template.
27+
If you open it directly in the browser, you will see an empty page.
28+
29+
You can add webfonts, meta tags, or analytics to this file.
30+
The build step will place the bundled scripts into the <body> tag.
31+
32+
To begin the development, run `npm start` or `yarn start`.
33+
To create a production bundle, use `npm run build` or `yarn build`.
34+
-->
35+
</body>
36+
</html>

Diff for: admin-pro-ui/public/logo.png

5.22 KB
Loading

0 commit comments

Comments
 (0)