antd-management-fast-develop 1.1.74 → 1.1.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +1 -0
- package/package.json +15 -15
- package/src/cliCollection/generate.js +75 -27
- package/src/data.extra.json +9 -0
- package/src/data.json +0 -5
- package/src/tools/generate.js +1 -21
package/bin/cli.js
CHANGED
@@ -19,6 +19,7 @@ program
|
|
19
19
|
.command('generate')
|
20
20
|
.description('generate file from data source and template')
|
21
21
|
.option('--dataPath <string>', 'data json source file path')
|
22
|
+
.option('--dataExtraPath <string>', 'data extra json source file path')
|
22
23
|
.option(
|
23
24
|
'--relativeFolder <bool>',
|
24
25
|
'file will be generate by the relative folder path, default is "."',
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "antd-management-fast-develop",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.81",
|
4
4
|
"description": "",
|
5
5
|
"license": "ISC",
|
6
6
|
"author": "",
|
@@ -18,7 +18,7 @@
|
|
18
18
|
"types/"
|
19
19
|
],
|
20
20
|
"scripts": {
|
21
|
-
"ejs:test": "node ./bin/cli.js generate --dataPath ./src/data.json",
|
21
|
+
"ejs:test": "node ./bin/cli.js generate --dataPath ./src/data.json --dataExtraPath ./src/data.extra.json",
|
22
22
|
"precommit": "npm run z:lint:staged:quiet",
|
23
23
|
"publish:npm": "npm publish --registry https://registry.npmjs.org/",
|
24
24
|
"z:auto:adjust:file": "echo can exec some file adjust command with here",
|
@@ -50,39 +50,39 @@
|
|
50
50
|
"z:tsc:build": "echo show tsc version and create declaration file && tsc -v && tsc -p ./tsconfig.types.json && echo declaration file generate complete"
|
51
51
|
},
|
52
52
|
"dependencies": {
|
53
|
-
"@umijs/max": "^4.1
|
53
|
+
"@umijs/max": "^4.2.1",
|
54
54
|
"commander": "^12.0.0",
|
55
55
|
"ejs": "^3.1.10",
|
56
56
|
"rimraf": "^5.0.5",
|
57
|
-
"umi": "^4.1
|
57
|
+
"umi": "^4.2.1"
|
58
58
|
},
|
59
59
|
"devDependencies": {
|
60
|
-
"@babel/core": "^7.24.
|
61
|
-
"@babel/eslint-parser": "^7.24.
|
60
|
+
"@babel/core": "^7.24.5",
|
61
|
+
"@babel/eslint-parser": "^7.24.5",
|
62
62
|
"@babel/plugin-external-helpers": "^7.24.1",
|
63
63
|
"@babel/plugin-proposal-decorators": "^7.24.1",
|
64
64
|
"@babel/plugin-transform-class-properties": "^7.24.1",
|
65
65
|
"@babel/plugin-transform-private-methods": "^7.24.1",
|
66
|
-
"@babel/plugin-transform-private-property-in-object": "^7.24.
|
66
|
+
"@babel/plugin-transform-private-property-in-object": "^7.24.5",
|
67
67
|
"@babel/plugin-transform-runtime": "^7.24.3",
|
68
|
-
"@babel/preset-env": "^7.24.
|
68
|
+
"@babel/preset-env": "^7.24.5",
|
69
69
|
"@babel/preset-react": "^7.24.1",
|
70
|
-
"@babel/runtime": "^7.24.
|
70
|
+
"@babel/runtime": "^7.24.5",
|
71
71
|
"@changesets/cli": "^2.27.1",
|
72
72
|
"@commitlint/cli": "^19.3.0",
|
73
73
|
"@commitlint/config-conventional": "^19.2.2",
|
74
74
|
"@commitlint/config-pnpm-scopes": "^19.1.0",
|
75
75
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.13",
|
76
76
|
"@types/jest": "^29.5.12",
|
77
|
-
"@types/node": "^20.12.
|
78
|
-
"@typescript-eslint/parser": "^7.
|
77
|
+
"@types/node": "^20.12.11",
|
78
|
+
"@typescript-eslint/parser": "^7.8.0",
|
79
79
|
"babel-jest": "^29.7.0",
|
80
80
|
"commitizen": "^4.3.0",
|
81
|
-
"conventional-changelog-conventionalcommits": "^
|
81
|
+
"conventional-changelog-conventionalcommits": "^8.0.0",
|
82
82
|
"cross-env": "^7.0.3",
|
83
83
|
"cz-git": "^1.9.1",
|
84
84
|
"documentation": "^14.0.3",
|
85
|
-
"easy-soft-develop": "^2.1.
|
85
|
+
"easy-soft-develop": "^2.1.92",
|
86
86
|
"eslint": "^8.57.0",
|
87
87
|
"eslint-config-airbnb": "^19.0.4",
|
88
88
|
"eslint-config-airbnb-typescript": "^18.0.0",
|
@@ -91,7 +91,7 @@
|
|
91
91
|
"eslint-import-resolver-typescript": "^3.6.1",
|
92
92
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
93
93
|
"eslint-plugin-import": "^2.29.1",
|
94
|
-
"eslint-plugin-jest": "^28.
|
94
|
+
"eslint-plugin-jest": "^28.5.0",
|
95
95
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
96
96
|
"eslint-plugin-prettier": "^5.1.3",
|
97
97
|
"eslint-plugin-promise": "^6.1.1",
|
@@ -109,7 +109,7 @@
|
|
109
109
|
"react": "^18.3.1",
|
110
110
|
"react-dnd": "^16.0.1",
|
111
111
|
"rimraf": "^5.0.5",
|
112
|
-
"stylelint": "^16.
|
112
|
+
"stylelint": "^16.5.0",
|
113
113
|
"stylelint-config-css-modules": "^4.4.0",
|
114
114
|
"stylelint-config-prettier": "^9.0.5",
|
115
115
|
"stylelint-config-standard": "^36.0.0",
|
@@ -3,6 +3,7 @@
|
|
3
3
|
/* eslint-disable no-useless-escape */
|
4
4
|
|
5
5
|
const {
|
6
|
+
writeFileSync,
|
6
7
|
promptWarn,
|
7
8
|
checkStringIsEmpty,
|
8
9
|
readJsonFileSync,
|
@@ -10,56 +11,103 @@ const {
|
|
10
11
|
exit,
|
11
12
|
promptInfo,
|
12
13
|
exec,
|
14
|
+
mkdirSync,
|
13
15
|
} = require('easy-soft-develop');
|
14
16
|
const { generate } = require('../tools/generate');
|
15
17
|
|
16
18
|
exports.run = function (s, o) {
|
17
19
|
const {
|
18
|
-
_optionValues: { dataPath = '', relativeFolder = '.' },
|
20
|
+
_optionValues: { dataPath = '', dataExtraPath = '', relativeFolder = '.' },
|
19
21
|
} = o;
|
20
22
|
|
21
|
-
if (checkStringIsEmpty(dataPath)) {
|
22
|
-
promptWarn(
|
23
|
+
if (checkStringIsEmpty(dataPath) && checkStringIsEmpty(dataExtraPath)) {
|
24
|
+
promptWarn(
|
25
|
+
'please input data json file path or data extra json file path, use --help to get help info',
|
26
|
+
);
|
23
27
|
|
24
28
|
exit();
|
25
29
|
}
|
26
30
|
|
27
|
-
const
|
31
|
+
const removeCmd = `npx rimraf ${relativeFolder}/FunctionExtra`;
|
28
32
|
|
29
|
-
|
30
|
-
|
33
|
+
promptInfo(`remove FunctionExtra: ${removeCmd}`);
|
34
|
+
|
35
|
+
exec(removeCmd);
|
36
|
+
|
37
|
+
mkdirSync(`${relativeFolder}/FunctionExtra`, {
|
38
|
+
recursive: true,
|
39
|
+
});
|
40
|
+
|
41
|
+
let crateFileSuccess = false;
|
42
|
+
|
43
|
+
let exportList = [];
|
44
|
+
|
45
|
+
if (!checkStringIsEmpty(dataPath)) {
|
46
|
+
const data = readJsonFileSync(dataPath);
|
47
|
+
|
48
|
+
if (isObject(data) && Array.isArray(data.list)) {
|
31
49
|
promptInfo('File will generate, please wait a moment');
|
32
50
|
|
33
|
-
generate(data.list, relativeFolder);
|
51
|
+
const list = generate(data.list, relativeFolder);
|
52
|
+
|
53
|
+
crateFileSuccess = true;
|
34
54
|
|
35
|
-
|
55
|
+
exportList = [...exportList, ...list];
|
56
|
+
}
|
57
|
+
}
|
36
58
|
|
37
|
-
|
59
|
+
if (!checkStringIsEmpty(dataExtraPath)) {
|
60
|
+
const dataExtra = readJsonFileSync(dataExtraPath);
|
38
61
|
|
39
|
-
|
62
|
+
if (isObject(dataExtra) && Array.isArray(dataExtra.list)) {
|
63
|
+
promptInfo('File extra will generate, please wait a moment');
|
40
64
|
|
41
|
-
const
|
65
|
+
const list = generate(dataExtra.list, relativeFolder);
|
42
66
|
|
43
|
-
|
67
|
+
crateFileSuccess = true;
|
44
68
|
|
45
|
-
|
46
|
-
}
|
47
|
-
|
48
|
-
list: [
|
49
|
-
{
|
50
|
-
functionSegment: 'SimpleStatus',
|
51
|
-
label: '状态',
|
52
|
-
name: 'status',
|
53
|
-
},
|
54
|
-
],
|
55
|
-
};
|
69
|
+
exportList = [...exportList, ...list];
|
70
|
+
}
|
71
|
+
}
|
56
72
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
73
|
+
if (crateFileSuccess) {
|
74
|
+
if (exportList.length > 0) {
|
75
|
+
writeFileSync(
|
76
|
+
`${relativeFolder}/FunctionExtra/index.jsx`,
|
77
|
+
exportList.join(''),
|
78
|
+
{
|
79
|
+
coverFile: true,
|
80
|
+
},
|
61
81
|
);
|
62
82
|
}
|
83
|
+
|
84
|
+
const cmdEslint = `npx eslint --fix --cache --ext .js,.jsx,.ts,.tsx ${relativeFolder}/`;
|
85
|
+
|
86
|
+
promptInfo(`Eslint generated file: ${cmdEslint}`);
|
87
|
+
|
88
|
+
exec(cmdEslint);
|
89
|
+
|
90
|
+
const cmdFormat = `npx prettier --cache --write ${relativeFolder}/`;
|
91
|
+
|
92
|
+
promptInfo(`Format generated file: ${cmdFormat}`);
|
93
|
+
|
94
|
+
exec(cmdFormat);
|
95
|
+
} else {
|
96
|
+
const simple = {
|
97
|
+
list: [
|
98
|
+
{
|
99
|
+
functionSegment: 'SimpleStatus',
|
100
|
+
label: '状态',
|
101
|
+
name: 'status',
|
102
|
+
},
|
103
|
+
],
|
104
|
+
};
|
105
|
+
|
106
|
+
promptWarn(
|
107
|
+
`in the data json file, key "list" value is not an array, it must be like this ${JSON.stringify(
|
108
|
+
simple,
|
109
|
+
)}`,
|
110
|
+
);
|
63
111
|
}
|
64
112
|
|
65
113
|
exit();
|
package/src/data.json
CHANGED
package/src/tools/generate.js
CHANGED
@@ -9,23 +9,11 @@ const {
|
|
9
9
|
promptSuccess,
|
10
10
|
promptWarn,
|
11
11
|
promptEmptyLine,
|
12
|
-
exec,
|
13
|
-
promptInfo,
|
14
12
|
} = require('easy-soft-develop');
|
15
13
|
|
16
14
|
let { templateContent } = require('../template');
|
17
15
|
|
18
16
|
function generate(dataSource, relativeFolder) {
|
19
|
-
const removeCmd = `npx rimraf ${relativeFolder}/FunctionExtra`;
|
20
|
-
|
21
|
-
promptInfo(`remove FunctionExtra: ${removeCmd}`);
|
22
|
-
|
23
|
-
exec(removeCmd);
|
24
|
-
|
25
|
-
mkdirSync(`${relativeFolder}/FunctionExtra`, {
|
26
|
-
recursive: true,
|
27
|
-
});
|
28
|
-
|
29
17
|
const dataAdjust = dataSource.map((o) => adjustSource(o));
|
30
18
|
|
31
19
|
const exportList = [];
|
@@ -52,15 +40,7 @@ function generate(dataSource, relativeFolder) {
|
|
52
40
|
exportList.push(`export * from './${o.functionSegment}';`);
|
53
41
|
}
|
54
42
|
|
55
|
-
|
56
|
-
writeFileSync(
|
57
|
-
`${relativeFolder}/FunctionExtra/index.jsx`,
|
58
|
-
exportList.join(''),
|
59
|
-
{
|
60
|
-
coverFile: true,
|
61
|
-
},
|
62
|
-
);
|
63
|
-
}
|
43
|
+
return exportList;
|
64
44
|
}
|
65
45
|
|
66
46
|
function adjustSource(o) {
|