antd-management-fast-develop 1.1.73 → 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 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.73",
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.6",
53
+ "@umijs/max": "^4.2.1",
54
54
  "commander": "^12.0.0",
55
- "ejs": "^3.1.9",
55
+ "ejs": "^3.1.10",
56
56
  "rimraf": "^5.0.5",
57
- "umi": "^4.1.6"
57
+ "umi": "^4.2.1"
58
58
  },
59
59
  "devDependencies": {
60
- "@babel/core": "^7.24.3",
61
- "@babel/eslint-parser": "^7.24.1",
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.1",
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.3",
68
+ "@babel/preset-env": "^7.24.5",
69
69
  "@babel/preset-react": "^7.24.1",
70
- "@babel/runtime": "^7.24.1",
70
+ "@babel/runtime": "^7.24.5",
71
71
  "@changesets/cli": "^2.27.1",
72
- "@commitlint/cli": "^19.2.1",
73
- "@commitlint/config-conventional": "^19.1.0",
72
+ "@commitlint/cli": "^19.3.0",
73
+ "@commitlint/config-conventional": "^19.2.2",
74
74
  "@commitlint/config-pnpm-scopes": "^19.1.0",
75
- "@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
75
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.13",
76
76
  "@types/jest": "^29.5.12",
77
- "@types/node": "^20.12.2",
78
- "@typescript-eslint/parser": "^7.4.0",
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": "^7.0.2",
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.72",
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,25 +91,25 @@
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": "^27.9.0",
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",
98
98
  "eslint-plugin-react": "^7.34.1",
99
- "eslint-plugin-react-hooks": "^4.6.0",
100
- "eslint-plugin-simple-import-sort": "^12.0.0",
101
- "eslint-plugin-unicorn": "^51.0.1",
99
+ "eslint-plugin-react-hooks": "^4.6.2",
100
+ "eslint-plugin-simple-import-sort": "^12.1.0",
101
+ "eslint-plugin-unicorn": "^52.0.0",
102
102
  "husky": "^9.0.11",
103
103
  "jest": "^29.7.0",
104
104
  "lint-staged": "^15.2.2",
105
- "npm-check-updates": "^16.14.18",
105
+ "npm-check-updates": "^16.14.20",
106
106
  "prettier": "^3.2.5",
107
107
  "prettier-plugin-organize-imports": "^3.2.4",
108
- "prettier-plugin-packagejson": "^2.4.14",
109
- "react": "^18.2.0",
108
+ "prettier-plugin-packagejson": "^2.5.0",
109
+ "react": "^18.3.1",
110
110
  "react-dnd": "^16.0.1",
111
111
  "rimraf": "^5.0.5",
112
- "stylelint": "^16.3.1",
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('please input data json file path, use --help to get help info');
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 data = readJsonFileSync(dataPath);
31
+ const removeCmd = `npx rimraf ${relativeFolder}/FunctionExtra`;
28
32
 
29
- if (isObject(data)) {
30
- if (Array.isArray(data.list)) {
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
- const cmdEslint = `npx eslint --fix --cache --ext .js,.jsx,.ts,.tsx ${relativeFolder}/`;
55
+ exportList = [...exportList, ...list];
56
+ }
57
+ }
36
58
 
37
- promptInfo(`Eslint generated file: ${cmdEslint}`);
59
+ if (!checkStringIsEmpty(dataExtraPath)) {
60
+ const dataExtra = readJsonFileSync(dataExtraPath);
38
61
 
39
- exec(cmdEslint);
62
+ if (isObject(dataExtra) && Array.isArray(dataExtra.list)) {
63
+ promptInfo('File extra will generate, please wait a moment');
40
64
 
41
- const cmdFormat = `npx prettier --cache --write ${relativeFolder}/`;
65
+ const list = generate(dataExtra.list, relativeFolder);
42
66
 
43
- promptInfo(`Format generated file: ${cmdFormat}`);
67
+ crateFileSuccess = true;
44
68
 
45
- exec(cmdFormat);
46
- } else {
47
- const simple = {
48
- list: [
49
- {
50
- functionSegment: 'SimpleStatus',
51
- label: '状态',
52
- name: 'status',
53
- },
54
- ],
55
- };
69
+ exportList = [...exportList, ...list];
70
+ }
71
+ }
56
72
 
57
- promptWarn(
58
- `in the data json file, key "list" value is not an array, it must be like this ${JSON.stringify(
59
- simple,
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();
@@ -0,0 +1,9 @@
1
+ {
2
+ "list": [
3
+ {
4
+ "functionSegment": "Brand",
5
+ "label": "商品品牌",
6
+ "name": "brandId"
7
+ }
8
+ ]
9
+ }
package/src/data.json CHANGED
@@ -4,11 +4,6 @@
4
4
  "functionSegment": "SimpleStatus",
5
5
  "label": "状态",
6
6
  "name": "status"
7
- },
8
- {
9
- "functionSegment": "Brand",
10
- "label": "商品品牌",
11
- "name": "brandId"
12
7
  }
13
8
  ]
14
9
  }
@@ -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
- if (exportList.length > 0) {
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) {