antd-management-fast-develop 1.0.19 → 1.0.21
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 +0 -9
- package/package.json +16 -15
- package/src/cliCollection/createCode.js +0 -52
- package/src/tools/createCode.js +0 -94
package/bin/cli.js
CHANGED
@@ -7,7 +7,6 @@
|
|
7
7
|
const { Command } = require('commander');
|
8
8
|
const { getArgCollection } = require('easy-soft-develop');
|
9
9
|
|
10
|
-
const code = require('../src/cliCollection/createCode');
|
11
10
|
const generator = require('../src/cliCollection/generate');
|
12
11
|
|
13
12
|
const program = new Command();
|
@@ -16,14 +15,6 @@ process.title = 'easy-soft-develop';
|
|
16
15
|
|
17
16
|
program.version(require('../package').version).usage('<command> [options]');
|
18
17
|
|
19
|
-
program
|
20
|
-
.command('code')
|
21
|
-
.description('generate code source with code.json')
|
22
|
-
.option('--dataPath <string>', 'data json source file path')
|
23
|
-
.action((a, o) => {
|
24
|
-
code.run(a, o);
|
25
|
-
});
|
26
|
-
|
27
18
|
program
|
28
19
|
.command('generate')
|
29
20
|
.description('generate file from data source and template')
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "antd-management-fast-develop",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.21",
|
4
4
|
"description": "",
|
5
5
|
"license": "ISC",
|
6
6
|
"author": "",
|
@@ -57,30 +57,31 @@
|
|
57
57
|
"umi": "^4.0.70"
|
58
58
|
},
|
59
59
|
"devDependencies": {
|
60
|
-
"@babel/core": "^7.22.
|
61
|
-
"@babel/eslint-parser": "^7.
|
62
|
-
"@babel/plugin-external-helpers": "^7.
|
60
|
+
"@babel/core": "^7.22.5",
|
61
|
+
"@babel/eslint-parser": "^7.22.5",
|
62
|
+
"@babel/plugin-external-helpers": "^7.22.5",
|
63
63
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
64
|
-
"@babel/plugin-proposal-decorators": "^7.22.
|
64
|
+
"@babel/plugin-proposal-decorators": "^7.22.5",
|
65
65
|
"@babel/plugin-proposal-private-methods": "^7.18.6",
|
66
|
-
"@babel/plugin-
|
67
|
-
"@babel/
|
68
|
-
"@babel/preset-
|
69
|
-
"@babel/
|
66
|
+
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
67
|
+
"@babel/plugin-transform-runtime": "^7.22.5",
|
68
|
+
"@babel/preset-env": "^7.22.5",
|
69
|
+
"@babel/preset-react": "^7.22.5",
|
70
|
+
"@babel/runtime": "^7.22.5",
|
70
71
|
"@commitlint/cli": "^17.6.5",
|
71
72
|
"@commitlint/config-conventional": "^17.6.5",
|
72
73
|
"@commitlint/config-lerna-scopes": "^17.6.3",
|
73
74
|
"@commitlint/cz-commitlint": "^17.5.0",
|
74
75
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
75
76
|
"@types/jest": "^29.5.2",
|
76
|
-
"@types/node": "^20.
|
77
|
-
"@typescript-eslint/parser": "^5.59.
|
77
|
+
"@types/node": "^20.3.1",
|
78
|
+
"@typescript-eslint/parser": "^5.59.11",
|
78
79
|
"commitizen": "^4.3.0",
|
79
|
-
"conventional-changelog-conventionalcommits": "^
|
80
|
+
"conventional-changelog-conventionalcommits": "^6.0.0",
|
80
81
|
"cross-env": "^7.0.3",
|
81
82
|
"documentation": "^14.0.2",
|
82
|
-
"easy-soft-develop": "^2.1.
|
83
|
-
"eslint": "^8.
|
83
|
+
"easy-soft-develop": "^2.1.21",
|
84
|
+
"eslint": "^8.42.0",
|
84
85
|
"eslint-config-airbnb": "^19.0.4",
|
85
86
|
"eslint-config-airbnb-typescript": "^17.0.0",
|
86
87
|
"eslint-config-prettier": "^8.8.0",
|
@@ -104,7 +105,7 @@
|
|
104
105
|
"prettier-plugin-packagejson": "^2.4.3",
|
105
106
|
"react": "^18.2.0",
|
106
107
|
"react-dnd": "^16.0.1",
|
107
|
-
"stylelint": "^15.
|
108
|
+
"stylelint": "^15.7.0",
|
108
109
|
"stylelint-config-prettier": "^9.0.5",
|
109
110
|
"stylelint-config-standard": "^33.0.0"
|
110
111
|
}
|
@@ -1,52 +0,0 @@
|
|
1
|
-
/* eslint-disable no-undef */
|
2
|
-
/* eslint-disable unicorn/prefer-module */
|
3
|
-
/* eslint-disable no-useless-escape */
|
4
|
-
|
5
|
-
const {
|
6
|
-
promptWarn,
|
7
|
-
checkStringIsEmpty,
|
8
|
-
readJsonFileSync,
|
9
|
-
isObject,
|
10
|
-
exit,
|
11
|
-
promptInfo,
|
12
|
-
} = require('easy-soft-develop');
|
13
|
-
const { generateCode } = require('../tools/createCode');
|
14
|
-
|
15
|
-
exports.run = function (s, o) {
|
16
|
-
const {
|
17
|
-
_optionValues: { dataPath = '' },
|
18
|
-
} = o;
|
19
|
-
|
20
|
-
if (checkStringIsEmpty(dataPath)) {
|
21
|
-
promptWarn('please input data json file path, use --help to get help info');
|
22
|
-
|
23
|
-
exit();
|
24
|
-
}
|
25
|
-
|
26
|
-
const data = readJsonFileSync(dataPath);
|
27
|
-
|
28
|
-
if (isObject(data)) {
|
29
|
-
if (Array.isArray(data.list)) {
|
30
|
-
promptInfo('Code file will create, please wait a moment');
|
31
|
-
|
32
|
-
generateCode(data.list);
|
33
|
-
} else {
|
34
|
-
const simple = {
|
35
|
-
list: [
|
36
|
-
{
|
37
|
-
sourceFilePath: 'componentA/index.jsx',
|
38
|
-
codeFilePath: 'componentA/codeSource.js',
|
39
|
-
},
|
40
|
-
],
|
41
|
-
};
|
42
|
-
|
43
|
-
promptWarn(
|
44
|
-
`in the data json file, key "list" value is not an array, it must be like this ${JSON.stringify(
|
45
|
-
simple,
|
46
|
-
)}`,
|
47
|
-
);
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
exit();
|
52
|
-
};
|
package/src/tools/createCode.js
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
/* eslint-disable no-undef */
|
2
|
-
/* eslint-disable unicorn/prefer-module */
|
3
|
-
/* eslint-disable no-useless-escape */
|
4
|
-
|
5
|
-
const {
|
6
|
-
writeFileSync,
|
7
|
-
promptSuccess,
|
8
|
-
promptWarn,
|
9
|
-
promptEmptyLine,
|
10
|
-
} = require('easy-soft-develop');
|
11
|
-
|
12
|
-
const { readFileSync } = require('node:fs');
|
13
|
-
|
14
|
-
function getCodeContent(code) {
|
15
|
-
const v = `${code}`.replaceAll('`', '\\`').replaceAll('$', '\\$');
|
16
|
-
return `export const code = \`${v}\`;
|
17
|
-
`;
|
18
|
-
}
|
19
|
-
|
20
|
-
function generateCode(dataSource) {
|
21
|
-
const dataAdjust = dataSource.map((o) => adjustSource(o));
|
22
|
-
|
23
|
-
for (const o of dataAdjust) {
|
24
|
-
checkDataItem(o);
|
25
|
-
|
26
|
-
const { sourceFilePath, codeFilePath } = o;
|
27
|
-
|
28
|
-
const codeSource = readFileSync(sourceFilePath);
|
29
|
-
|
30
|
-
const content = getCodeContent(codeSource);
|
31
|
-
|
32
|
-
writeFileSync(codeFilePath, content, {
|
33
|
-
coverFile: true,
|
34
|
-
});
|
35
|
-
|
36
|
-
promptSuccess(`Create "${codeFilePath}" complete`);
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
function adjustSource(o) {
|
41
|
-
const d = { ...o };
|
42
|
-
|
43
|
-
const sourceFilePath = d.sourceFilePath;
|
44
|
-
|
45
|
-
if (sourceFilePath === undefined) {
|
46
|
-
promptWarn('data has error, check item: ');
|
47
|
-
|
48
|
-
console.log(d);
|
49
|
-
|
50
|
-
promptEmptyLine();
|
51
|
-
|
52
|
-
throw new Error('data has not key "sourceFilePath"');
|
53
|
-
}
|
54
|
-
|
55
|
-
const codeFilePath = d.codeFilePath;
|
56
|
-
|
57
|
-
if (codeFilePath === undefined) {
|
58
|
-
promptWarn('data has error, check item: ');
|
59
|
-
|
60
|
-
console.log(d);
|
61
|
-
|
62
|
-
promptEmptyLine();
|
63
|
-
|
64
|
-
throw new Error('data has not key "codeFilePath"');
|
65
|
-
}
|
66
|
-
|
67
|
-
return d;
|
68
|
-
}
|
69
|
-
|
70
|
-
function checkDataItem(item) {
|
71
|
-
if (item.sourceFilePath === undefined) {
|
72
|
-
promptWarn('data has error, check item: ');
|
73
|
-
|
74
|
-
console.log(item);
|
75
|
-
|
76
|
-
promptEmptyLine();
|
77
|
-
|
78
|
-
throw new Error('data has not key "sourceFilePath"');
|
79
|
-
}
|
80
|
-
|
81
|
-
if (item.codeFilePath === undefined) {
|
82
|
-
promptWarn('data has error, check item: ');
|
83
|
-
|
84
|
-
console.log(item);
|
85
|
-
|
86
|
-
promptEmptyLine();
|
87
|
-
|
88
|
-
throw new Error('data has not key "codeFilePath"');
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
module.exports = {
|
93
|
-
generateCode,
|
94
|
-
};
|