@next-core/build-config-factory 2.19.0 → 2.20.0
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/CHANGELOG.md +11 -0
- package/package.json +2 -2
- package/src/generateBrickDocs.js +13 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.20.0](https://github.com/easyops-cn/next-core/compare/@next-core/build-config-factory@2.19.0...@next-core/build-config-factory@2.20.0) (2022-07-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **generateBrickDocs:** support infer required and default of property and detail of event from declaration ([6a60f26](https://github.com/easyops-cn/next-core/commit/6a60f26563683d89d5b36bb766f973cb23522e70))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [2.19.0](https://github.com/easyops-cn/next-core/compare/@next-core/build-config-factory@2.18.52...@next-core/build-config-factory@2.19.0) (2022-07-05)
|
|
7
18
|
|
|
8
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/build-config-factory",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.0",
|
|
4
4
|
"description": "build config factory",
|
|
5
5
|
"homepage": "https://github.com/easyops-cn/next-core/tree/master/packages/build-config-factory",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"typedoc": "^0.19.2",
|
|
38
38
|
"typedoc-plugin-no-inherit": "^1.2.2"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "81ac28a0f1346239d497cd23acc7795e5f8c21cc"
|
|
41
41
|
}
|
package/src/generateBrickDocs.js
CHANGED
|
@@ -101,11 +101,12 @@ function convertTagsToMapByFields(tags, fields) {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
function composeBrickDocProperties(brick) {
|
|
104
|
-
const { name, comment } = brick;
|
|
105
|
-
const type = brick.type && brick.type.type;
|
|
104
|
+
const { name, comment, type, flags, defaultValue } = brick;
|
|
106
105
|
return {
|
|
107
106
|
name,
|
|
108
|
-
type: extractRealInterfaceType(type,
|
|
107
|
+
type: extractRealInterfaceType(type?.type, type),
|
|
108
|
+
required: flags?.isOptional !== true,
|
|
109
|
+
default: defaultValue,
|
|
109
110
|
...convertTagsToMapByFields(get(comment, "tags", []), propertyDocComments),
|
|
110
111
|
};
|
|
111
112
|
}
|
|
@@ -122,11 +123,19 @@ function getEventTypeByDecorators(decorators) {
|
|
|
122
123
|
return null;
|
|
123
124
|
}
|
|
124
125
|
|
|
126
|
+
function getDetailTypeByEventType(type) {
|
|
127
|
+
if (type.name === "EventEmitter" && type.typeArguments?.length > 0) {
|
|
128
|
+
const argument = type.typeArguments[0];
|
|
129
|
+
return extractRealInterfaceType(argument.type, argument);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
125
133
|
function composeBrickDocEvents(brick) {
|
|
126
|
-
const { comment, decorators } = brick;
|
|
134
|
+
const { comment, decorators, type } = brick;
|
|
127
135
|
|
|
128
136
|
return {
|
|
129
137
|
type: getEventTypeByDecorators(decorators),
|
|
138
|
+
detail: getDetailTypeByEventType(type),
|
|
130
139
|
...convertTagsToMapByFields(get(comment, "tags", []), eventDocComments),
|
|
131
140
|
};
|
|
132
141
|
}
|