antd-management-fast-develop 1.1.90 → 1.1.92
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 -1
- package/package.json +4 -4
- 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.92",
|
4
4
|
"description": "",
|
5
5
|
"license": "ISC",
|
6
6
|
"author": "",
|
@@ -76,14 +76,14 @@
|
|
76
76
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.13",
|
77
77
|
"@types/jest": "^29.5.12",
|
78
78
|
"@types/node": "^20.12.12",
|
79
|
-
"@typescript-eslint/parser": "^7.
|
79
|
+
"@typescript-eslint/parser": "^7.10.0",
|
80
80
|
"babel-jest": "^29.7.0",
|
81
81
|
"commitizen": "^4.3.0",
|
82
82
|
"conventional-changelog-conventionalcommits": "^8.0.0",
|
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.167",
|
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.4",
|
106
106
|
"npm-check-updates": "^16.14.20",
|
107
107
|
"prettier": "^3.2.5",
|
108
108
|
"prettier-plugin-organize-imports": "^3.2.4",
|
@@ -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}';`);
|