Skip to content
This repository was archived by the owner on Mar 2, 2026. It is now read-only.

Commit e2ccb63

Browse files
Prepare for descriptions injection v19.2 (#1094)
1 parent 79885d2 commit e2ccb63

6 files changed

Lines changed: 68 additions & 40 deletions

File tree

gulpfile.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ gulp.task('npm.content', gulp.series('build.components', function() {
148148
.pipe(gulp.dest(npmConfig.distPath));
149149
}));
150150

151-
gulp.task('npm.pack', gulp.series('npm.content', shell.task(['npm pack'], { cwd: buildConfig.npm.distPath })));
151+
gulp.task('npm.pack', gulp.series(
152+
'npm.content',
153+
shell.task('npm run inject-descriptions'),
154+
shell.task(['npm pack'], { cwd: buildConfig.npm.distPath })
155+
));
152156

153157
//------------TSLint------------
154158

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"build": "npm run gulp -- build",
1515
"test": "npm run gulp -- test",
1616
"pack": "npm run gulp -- npm.pack",
17-
"update-integration-meta": "dx-tools update-meta --output-path ./metadata/NGMetaData.json --version 19_2"
17+
"update-integration-meta": "dx-tools update-meta --output-path ./metadata/NGMetaData.json --version 19_2",
18+
"inject-descriptions": "dx-tools inject-descriptions-to-bundle --js-scripts ./npm/dist"
1819
},
1920
"author": "Developer Express Inc.",
2021
"license": "MIT",

templates/component.tst

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@ const CUSTOM_VALUE_ACCESSOR_PROVIDER = {
7070
multi: true
7171
};<#?#>
7272

73-
<#? it.description #>/**
74-
* <#= it.description #>
75-
*/<#?#>
73+
<#? it.isDeprecated #>/** @deprecated */<#?#>
74+
<#? it.docID #>/** @name <#= it.docID #> */<#?#>
7675
@Component({
7776
selector: '<#= it.selector #>',
7877
template: '<#? it.isTranscludedContent #><ng-content></ng-content><#?#>',<#? it.isViz #>
@@ -87,10 +86,9 @@ const CUSTOM_VALUE_ACCESSOR_PROVIDER = {
8786
})
8887
export class <#= it.className #>Component extends <#= baseClass #> <#? implementedInterfaces.length #>implements <#= implementedInterfaces.join(', ') #> <#?#>{
8988
instance: <#= it.className #>;
90-
<#~ it.properties :prop:i #><#? prop.description #>
91-
/**
92-
* <#= prop.description #>
93-
*/<#?#>
89+
<#~ it.properties :prop:i #>
90+
<#? prop.isDeprecated #>/** @deprecated */<#?#>
91+
<#? prop.docID #>/** @name <#= prop.docID #> */<#?#>
9492
@Input()
9593
get <#= prop.name #>(): <#= prop.type #> {
9694
return this._getOption('<#= prop.name #>');
@@ -100,10 +98,10 @@ export class <#= it.className #>Component extends <#= baseClass #> <#? implement
10098
}<#? i < it.properties.length-1 #>
10199

102100
<#?#><#~#>
103-
<#~ it.events :event:i #><#? event.description #>
104-
/**
105-
* <#= event.description #>
106-
*/<#?#>
101+
<#~ it.events :event:i #>
102+
<#? event.isDeprecated #>/** @deprecated */<#?#>
103+
<#? event.docID #>/** @name <#= event.docID #> */<#?#>
104+
<#? event.isInternal #>/** This member supports the internal infrastructure and is not intended to be used directly from your code. */<#?#>
107105
@Output() <#= event.emit #>: <#= event.type #>;<#? i < it.events.length-1 #>
108106
<#?#><#~#>
109107

templates/nested-component.tst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ export class <#= it.className #>Component extends <#= it.baseClass #><#? it.hasT
5656
this._setOption('<#= prop.name #>', value);
5757
}
5858
<#~#>
59-
<#~ it.events :event:i #><#? event.description #>
60-
/**
61-
* <#= event.description #>
62-
*/<#?#>
59+
<#~ it.events :event:i #>
60+
<#? event.isDeprecated #>/** @deprecated */<#?#>
61+
<#? event.docID #>/** @name <#= event.docID #> */<#?#>
62+
<#? event.isInternal #>/** This member supports the internal infrastructure and is not intended to be used directly from your code. */<#?#>
6363
@Output() <#= event.emit #>: <#= event.type #>;<#? i < it.events.length-1 #>
6464
<#?#><#~#>
6565
protected get _optionPath() {

tools/spec/tests/metadata-generator.spec.js

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,45 +46,57 @@ describe("metadata-generator", function() {
4646
dxTestWidget: {
4747
Options: {
4848
onTestEvent: {
49+
DocID: 'Widget.Options.onTestEvent',
4950
IsEvent: true,
50-
Description: 'onTestEvent description'
51+
IsDepricated: true,
5152
},
5253
testTemplate: {
54+
DocID: 'Widget.Options.testTemplate',
5355
IsTemplate: true,
5456
},
5557
testProperty: {
56-
Description: 'testProperty description'
58+
DocID: 'Widget.Options.testProperty'
5759
}
5860
},
59-
Description: 'widget description',
61+
DocID: 'dxTestWidget',
6062
Module: 'test_widget'
6163
},
6264
dxEditorWidget: {
6365
Options: {
64-
onValueChanged: {}
66+
onValueChanged: {
67+
DocID: 'Widget.Options.onValueChanged',
68+
}
6569
},
70+
DocID: 'dxEditorWidget',
6671
Module: 'test_widget'
6772
},
6873
dxCollectionWidget: {
6974
Options: {
7075
collectionProperty: {
76+
DocID: 'Widget.Options.collectionProperty',
7177
IsCollection: true
7278
},
7379
dataSourceProperty: {
80+
DocID: 'Widget.Options.dataSourceProperty',
7481
IsDataSource: true
7582
}
7683
},
84+
DocID: 'dxCollectionWidget',
7785
Module: 'test_widget'
7886
},
7987
dxExtensionWidget: {
8088
IsExtensionComponent: true,
8189
Options: {},
90+
DocID: 'dxExtensionWidget',
8291
Module: 'test_widget'
8392
},
8493
dxVizWidget: {
8594
Options: {
86-
value: {}
95+
value: {
96+
DocID: 'Widget.Options.value',
97+
}
8798
},
99+
DocID: 'dxVizWidget',
88100
Module: 'viz/test_widget'
89101
}
90102
}
@@ -123,8 +135,8 @@ describe("metadata-generator", function() {
123135
expect(metas.DxTestWidget.widgetName).toBe("dxTestWidget");
124136
});
125137

126-
it("should generate proper widget description", function() {
127-
expect(metas.DxTestWidget.description).toBe('widget description');
138+
it("should generate proper widget docID", function() {
139+
expect(metas.DxTestWidget.docID).toBe('@name dxTestWidget');
128140
});
129141

130142
it("should generate proper events emit field", function() {
@@ -144,17 +156,23 @@ describe("metadata-generator", function() {
144156
.toEqual(['testEvent']);
145157
});
146158

147-
it("should generate proper events description field", function() {
159+
it("should generate proper events docID field", function() {
148160
expect(metas.DxTestWidget.events
149161
.filter(p => p.emit === 'onTestEvent')
150-
.map(p => p.description))
151-
.toEqual(['onTestEvent description']);
162+
.map(p => p.docID))
163+
.toEqual(['@name Widget.Options.onTestEvent']);
152164
});
153-
154-
155-
it("should generate proper events description field", function() {
165+
166+
it("should generate proper events deprication field", function() {
167+
expect(metas.DxTestWidget.events
168+
.filter(p => p.emit === 'onTestEvent')
169+
.map(p => p.isDeprecated))
170+
.toEqual([true]);
171+
});
172+
173+
it("should generate proper events docID field", function() {
156174
expect(metas.DxTestWidget.events
157-
.filter(p => p.emit !== "onTestEvent" && p.description !== undefined).length)
175+
.filter(p => p.emit !== "onTestEvent" && p.docID !== undefined).length)
158176
.toEqual(2);
159177
});
160178

@@ -165,10 +183,10 @@ describe("metadata-generator", function() {
165183
]);
166184
});
167185

168-
it("should generate proper properties description", function() {
169-
expect(metas.DxTestWidget.properties.map(p => p.description)).toEqual([
186+
it("should generate proper properties docID", function() {
187+
expect(metas.DxTestWidget.properties.map(p => p.docID)).toEqual([
170188
undefined,
171-
'testProperty description'
189+
'@name Widget.Options.testProperty'
172190
]);
173191
});
174192

tools/src/metadata-generator.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,10 @@ export default class DXComponentMetadataGenerator {
8989
let eventName = inflector.camelize(optionName.substr('on'.length), true);
9090

9191
events.push({
92+
docID: option.DocID,
93+
isDeprecated: option.IsDeprecated,
9294
emit: optionName,
9395
subscribe: eventName,
94-
description: option.Description,
9596
type: 'EventEmitter<any>'
9697
});
9798
} else {
@@ -101,10 +102,11 @@ export default class DXComponentMetadataGenerator {
101102
isDevExpressRequired = isDevExpressRequired || typesDescription.isDevExpressRequired;
102103

103104
let property: any = {
105+
docID: option.DocID,
106+
isDeprecated: option.IsDeprecated,
104107
name: optionName,
105108
type: finalizedType,
106-
typesDescription: typesDescription,
107-
description: option.Description
109+
typesDescription: typesDescription
108110
};
109111

110112
if (!!option.IsCollection || !!option.IsDataSource) {
@@ -142,6 +144,8 @@ export default class DXComponentMetadataGenerator {
142144
}, []);
143145

144146
let widgetMetadata = {
147+
docID: widget.DocID,
148+
isDeprecated: widget.IsDeprecated,
145149
className: className,
146150
widgetName: widgetName,
147151
isTranscludedContent: isTranscludedContent,
@@ -153,7 +157,6 @@ export default class DXComponentMetadataGenerator {
153157
isEditor: isEditor,
154158
module: 'devextreme/' + widget.Module,
155159
isDevExpressRequired: isDevExpressRequired,
156-
description: widget.Description,
157160
nestedComponents: widgetNestedComponents
158161
};
159162

@@ -168,9 +171,9 @@ export default class DXComponentMetadataGenerator {
168171

169172
private createEvent(name, type) {
170173
return {
174+
isInternal: true,
171175
emit: `${name}Change`,
172-
type: `EventEmitter<${type}>`,
173-
description: `This member supports the internal infrastructure and is not intended to be used directly from your code.`
176+
type: `EventEmitter<${type}>`
174177
};
175178
}
176179

@@ -321,6 +324,8 @@ export default class DXComponentMetadataGenerator {
321324
path = inflector.dasherize(underscorePlural);
322325

323326
let complexOptionMetadata: any = {
327+
docID: option.DocID,
328+
isDeprecated: option.IsDeprecated,
324329
className: inflector.camelize(underscoreSelector),
325330
selector: selector,
326331
optionName: optionName,
@@ -344,6 +349,8 @@ export default class DXComponentMetadataGenerator {
344349
isDevExpressRequired = isDevExpressRequired || typesDescription.isDevExpressRequired;
345350

346351
let property: any = {
352+
docID: optionMetadata.DocID,
353+
isDeprecated: optionMetadata.IsDeprecated,
347354
name: optName,
348355
type: propertyType,
349356
typesDescription: typesDescription

0 commit comments

Comments
 (0)