antd-management-fast-develop 1.1.91 → 1.1.93
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/cli.js +1 -1
- package/package.json +15 -15
- package/src/cliCollection/generate.js +18 -21
- package/src/tools/generate.js +4 -4
package/bin/cli.js
CHANGED
@@ -20,7 +20,7 @@ program
|
|
20
20
|
.command('generate')
|
21
21
|
.description('generate file from data source and template')
|
22
22
|
.option('--dataPath <string>', 'data json source file path')
|
23
|
-
.option('--
|
23
|
+
.option('--folderName <string>', 'folder Name contain the function component')
|
24
24
|
.option(
|
25
25
|
'--relativeFolder <bool>',
|
26
26
|
'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.93",
|
4
4
|
"description": "",
|
5
5
|
"license": "ISC",
|
6
6
|
"author": "",
|
@@ -58,17 +58,17 @@
|
|
58
58
|
"umi": "^4.2.5"
|
59
59
|
},
|
60
60
|
"devDependencies": {
|
61
|
-
"@babel/core": "^7.24.
|
62
|
-
"@babel/eslint-parser": "^7.24.
|
63
|
-
"@babel/plugin-external-helpers": "^7.24.
|
64
|
-
"@babel/plugin-proposal-decorators": "^7.24.
|
65
|
-
"@babel/plugin-transform-class-properties": "^7.24.
|
66
|
-
"@babel/plugin-transform-private-methods": "^7.24.
|
67
|
-
"@babel/plugin-transform-private-property-in-object": "^7.24.
|
68
|
-
"@babel/plugin-transform-runtime": "^7.24.
|
69
|
-
"@babel/preset-env": "^7.24.
|
70
|
-
"@babel/preset-react": "^7.24.
|
71
|
-
"@babel/runtime": "^7.24.
|
61
|
+
"@babel/core": "^7.24.6",
|
62
|
+
"@babel/eslint-parser": "^7.24.6",
|
63
|
+
"@babel/plugin-external-helpers": "^7.24.6",
|
64
|
+
"@babel/plugin-proposal-decorators": "^7.24.6",
|
65
|
+
"@babel/plugin-transform-class-properties": "^7.24.6",
|
66
|
+
"@babel/plugin-transform-private-methods": "^7.24.6",
|
67
|
+
"@babel/plugin-transform-private-property-in-object": "^7.24.6",
|
68
|
+
"@babel/plugin-transform-runtime": "^7.24.6",
|
69
|
+
"@babel/preset-env": "^7.24.6",
|
70
|
+
"@babel/preset-react": "^7.24.6",
|
71
|
+
"@babel/runtime": "^7.24.6",
|
72
72
|
"@changesets/cli": "^2.27.3",
|
73
73
|
"@commitlint/cli": "^19.3.0",
|
74
74
|
"@commitlint/config-conventional": "^19.2.2",
|
@@ -83,7 +83,7 @@
|
|
83
83
|
"cross-env": "^7.0.3",
|
84
84
|
"cz-git": "^1.9.1",
|
85
85
|
"documentation": "^14.0.3",
|
86
|
-
"easy-soft-develop": "^2.1.
|
86
|
+
"easy-soft-develop": "^2.1.169",
|
87
87
|
"eslint": "^8.57.0",
|
88
88
|
"eslint-config-airbnb": "^19.0.4",
|
89
89
|
"eslint-config-airbnb-typescript": "^18.0.0",
|
@@ -102,7 +102,7 @@
|
|
102
102
|
"eslint-plugin-unicorn": "^52.0.0",
|
103
103
|
"husky": "^9.0.11",
|
104
104
|
"jest": "^29.7.0",
|
105
|
-
"lint-staged": "^15.2.
|
105
|
+
"lint-staged": "^15.2.5",
|
106
106
|
"npm-check-updates": "^16.14.20",
|
107
107
|
"prettier": "^3.2.5",
|
108
108
|
"prettier-plugin-organize-imports": "^3.2.4",
|
@@ -110,7 +110,7 @@
|
|
110
110
|
"react": "^18.3.1",
|
111
111
|
"react-dnd": "^16.0.1",
|
112
112
|
"rimraf": "^5.0.7",
|
113
|
-
"stylelint": "^16.
|
113
|
+
"stylelint": "^16.6.0",
|
114
114
|
"stylelint-config-css-modules": "^4.4.0",
|
115
115
|
"stylelint-config-prettier": "^9.0.5",
|
116
116
|
"stylelint-config-standard": "^36.0.0",
|
@@ -12,15 +12,20 @@ const {
|
|
12
12
|
promptInfo,
|
13
13
|
exec,
|
14
14
|
mkdirSync,
|
15
|
+
promptError,
|
15
16
|
} = require('easy-soft-develop');
|
16
17
|
const { generate } = require('../tools/generate');
|
17
18
|
|
18
19
|
exports.run = function (s, o) {
|
19
20
|
const {
|
20
|
-
_optionValues: {
|
21
|
+
_optionValues: {
|
22
|
+
dataPath = '',
|
23
|
+
folderName = 'FunctionSpecialComponent',
|
24
|
+
relativeFolder = '.',
|
25
|
+
},
|
21
26
|
} = o;
|
22
27
|
|
23
|
-
if (checkStringIsEmpty(dataPath)
|
28
|
+
if (checkStringIsEmpty(dataPath)) {
|
24
29
|
promptWarn(
|
25
30
|
'please input data json file path or data extra json file path, use --help to get help info',
|
26
31
|
);
|
@@ -28,13 +33,19 @@ exports.run = function (s, o) {
|
|
28
33
|
exit();
|
29
34
|
}
|
30
35
|
|
31
|
-
|
36
|
+
if (checkStringIsEmpty(folderName)) {
|
37
|
+
promptError('folder name disallow empty, use --help to get help info!');
|
32
38
|
|
33
|
-
|
39
|
+
exit();
|
40
|
+
}
|
41
|
+
|
42
|
+
const removeCmd = `rimraf ${relativeFolder}/${folderName}`;
|
43
|
+
|
44
|
+
promptInfo(`remove ${folderName}: ${removeCmd}`);
|
34
45
|
|
35
46
|
exec(removeCmd);
|
36
47
|
|
37
|
-
mkdirSync(`${relativeFolder}
|
48
|
+
mkdirSync(`${relativeFolder}/${folderName}`, {
|
38
49
|
recursive: true,
|
39
50
|
});
|
40
51
|
|
@@ -48,21 +59,7 @@ exports.run = function (s, o) {
|
|
48
59
|
if (isObject(data) && Array.isArray(data.list)) {
|
49
60
|
promptInfo('File will generate, please wait a moment');
|
50
61
|
|
51
|
-
const list = generate(data.list, relativeFolder);
|
52
|
-
|
53
|
-
crateFileSuccess = true;
|
54
|
-
|
55
|
-
exportList = [...exportList, ...list];
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
if (!checkStringIsEmpty(dataExtraPath)) {
|
60
|
-
const dataExtra = readJsonFileSync(dataExtraPath);
|
61
|
-
|
62
|
-
if (isObject(dataExtra) && Array.isArray(dataExtra.list)) {
|
63
|
-
promptInfo('File extra will generate, please wait a moment');
|
64
|
-
|
65
|
-
const list = generate(dataExtra.list, relativeFolder);
|
62
|
+
const list = generate(data.list, folderName, relativeFolder);
|
66
63
|
|
67
64
|
crateFileSuccess = true;
|
68
65
|
|
@@ -73,7 +70,7 @@ exports.run = function (s, o) {
|
|
73
70
|
if (crateFileSuccess) {
|
74
71
|
if (exportList.length > 0) {
|
75
72
|
writeFileSync(
|
76
|
-
`${relativeFolder}/
|
73
|
+
`${relativeFolder}/${folderName}/index.jsx`,
|
77
74
|
exportList.join(''),
|
78
75
|
{
|
79
76
|
coverFile: true,
|
package/src/tools/generate.js
CHANGED
@@ -13,7 +13,7 @@ const {
|
|
13
13
|
|
14
14
|
let { templateContent } = require('../template');
|
15
15
|
|
16
|
-
function generate(dataSource, relativeFolder) {
|
16
|
+
function generate(dataSource, folderName, relativeFolder) {
|
17
17
|
const dataAdjust = dataSource.map((o) => adjustSource(o));
|
18
18
|
|
19
19
|
const exportList = [];
|
@@ -23,10 +23,10 @@ function generate(dataSource, relativeFolder) {
|
|
23
23
|
|
24
24
|
let content = compile(templateContent)({ o });
|
25
25
|
|
26
|
-
mkdirSync(`${relativeFolder}
|
26
|
+
mkdirSync(`${relativeFolder}/${folderName}/${o.functionSegment}`);
|
27
27
|
|
28
28
|
writeFileSync(
|
29
|
-
`${relativeFolder}
|
29
|
+
`${relativeFolder}/${folderName}/${o.functionSegment}/index.jsx`,
|
30
30
|
content,
|
31
31
|
{
|
32
32
|
coverFile: true,
|
@@ -34,7 +34,7 @@ function generate(dataSource, relativeFolder) {
|
|
34
34
|
);
|
35
35
|
|
36
36
|
promptSuccess(
|
37
|
-
`Generate "${relativeFolder}
|
37
|
+
`Generate "${relativeFolder}/${folderName}/${o.functionSegment}/index.jsx" complete`,
|
38
38
|
);
|
39
39
|
|
40
40
|
exportList.push(`export * from './${o.functionSegment}';`);
|