repair doc tools and polish the docs code (#5038)

* set private access modifier

* repair doc build tools

* fix lit issues

* re-generate version index
This commit is contained in:
Denys Vuika
2019-08-30 17:26:10 +01:00
committed by Eugenio Romano
parent 3bebc7a18c
commit 2b1250cae7
32 changed files with 727 additions and 877 deletions

View File

@@ -33,6 +33,9 @@ backend services have been tested with each released version of ADF.
<!--v340 start--> <!--v340 start-->
- [Decimal number pipe](core/pipes/decimal-number.pipe.md) - [Decimal number pipe](core/pipes/decimal-number.pipe.md)
- [Identity group service](core/services/identity-group.service.md)
- [Local preference cloud service](process-services-cloud/services/local-preference-cloud.service.md)
- [User preference cloud service](process-services-cloud/services/user-preference-cloud.service.md)
<!--v340 end--> <!--v340 end-->

View File

@@ -1,5 +1,5 @@
<div id="userinfo_container" [class.adf-userinfo-name-right]="showOnRight()" (keyup)="onKeyPress($event)" <div id="userinfo_container" [class.adf-userinfo-name-right]="showOnRight" (keyup)="onKeyPress($event)"
class="adf-userinfo-container" *ngIf="isLoggedIn()"> class="adf-userinfo-container" *ngIf="isLoggedIn">
<ng-container *ngIf="showName"> <ng-container *ngIf="showName">
<span *ngIf="identityUser$ | async as identityUser; else showBpmAndEcmUserFullNames" id="adf-userinfo-identity-name-display" <span *ngIf="identityUser$ | async as identityUser; else showBpmAndEcmUserFullNames" id="adf-userinfo-identity-name-display"

View File

@@ -100,23 +100,23 @@ export class UserInfoComponent implements OnInit {
} }
} }
isLoggedIn(): boolean { get isLoggedIn(): boolean {
return this.authService.isLoggedIn(); return this.authService.isLoggedIn();
} }
loadEcmUserInfo(): void { private loadEcmUserInfo(): void {
this.ecmUser$ = this.ecmUserService.getCurrentUserInfo(); this.ecmUser$ = this.ecmUserService.getCurrentUserInfo();
} }
loadBpmUserInfo() { private loadBpmUserInfo() {
this.bpmUser$ = this.bpmUserService.getCurrentUserInfo(); this.bpmUser$ = this.bpmUserService.getCurrentUserInfo();
} }
loadIdentityUserInfo() { private loadIdentityUserInfo() {
this.identityUser$ = of(this.identityUserService.getCurrentUserInfo()); this.identityUser$ = of(this.identityUserService.getCurrentUserInfo());
} }
stopClosing(event) { stopClosing(event: Event) {
event.stopPropagation(); event.stopPropagation();
} }
@@ -128,7 +128,7 @@ export class UserInfoComponent implements OnInit {
return this.bpmUserService.getCurrentUserProfileImage(); return this.bpmUserService.getCurrentUserProfileImage();
} }
showOnRight(): boolean { get showOnRight(): boolean {
return this.namePosition === 'right'; return this.namePosition === 'right';
} }
} }

150
package-lock.json generated
View File

@@ -1366,6 +1366,12 @@
} }
} }
}, },
"@paperist/types-remark": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@paperist/types-remark/-/types-remark-0.1.3.tgz",
"integrity": "sha512-liJvMxGB0IinhxcoMYiSVOgk2z5CZ5/gvpNCXzVC9xVGVtON0lLJZro1ixo5qZJg1ir6N0BY99Y1u6jp2ZNYEg==",
"dev": true
},
"@phenomnomnominal/tsquery": { "@phenomnomnominal/tsquery": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/@phenomnomnominal/tsquery/-/tsquery-3.0.0.tgz", "resolved": "https://registry.npmjs.org/@phenomnomnominal/tsquery/-/tsquery-3.0.0.tgz",
@@ -1493,9 +1499,9 @@
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
"version": "6.0.90", "version": "12.7.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.90.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.3.tgz",
"integrity": "sha512-tXoGRVdi7wZX7P1VWoV9Wfk0uYDOAHdEYXAttuWgSrN76Q32wQlSrMX0Rgyv3RTEaQY2ZLQrzYHVM2e8rfo8sA==", "integrity": "sha512-3SiLAIBkDWDg6vFo0+5YJyHPWU9uwu40Qe+v+0MH8wRKYBimHvvAOyk3EzMrD/TrIlLYfXrqDqrg913PynrMJQ==",
"dev": true "dev": true
}, },
"@types/q": { "@types/q": {
@@ -6520,28 +6526,28 @@
"dependencies": { "dependencies": {
"abbrev": { "abbrev": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "resolved": false,
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"ansi-regex": { "ansi-regex": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "resolved": false,
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"aproba": { "aproba": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", "resolved": false,
"integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"are-we-there-yet": { "are-we-there-yet": {
"version": "1.1.5", "version": "1.1.5",
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", "resolved": false,
"integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6552,14 +6558,14 @@
}, },
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "resolved": false,
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "resolved": false,
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6570,42 +6576,42 @@
}, },
"chownr": { "chownr": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", "resolved": false,
"integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "resolved": false,
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "resolved": false,
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "resolved": false,
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "resolved": false,
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"debug": { "debug": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "resolved": false,
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6615,28 +6621,28 @@
}, },
"deep-extend": { "deep-extend": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", "resolved": false,
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"delegates": { "delegates": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "resolved": false,
"integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"detect-libc": { "detect-libc": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", "resolved": false,
"integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"fs-minipass": { "fs-minipass": {
"version": "1.2.5", "version": "1.2.5",
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", "resolved": false,
"integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6646,14 +6652,14 @@
}, },
"fs.realpath": { "fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": false,
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"gauge": { "gauge": {
"version": "2.7.4", "version": "2.7.4",
"resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", "resolved": false,
"integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6670,7 +6676,7 @@
}, },
"glob": { "glob": {
"version": "7.1.3", "version": "7.1.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", "resolved": false,
"integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6685,14 +6691,14 @@
}, },
"has-unicode": { "has-unicode": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "resolved": false,
"integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"iconv-lite": { "iconv-lite": {
"version": "0.4.24", "version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "resolved": false,
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6702,7 +6708,7 @@
}, },
"ignore-walk": { "ignore-walk": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", "resolved": false,
"integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6712,7 +6718,7 @@
}, },
"inflight": { "inflight": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "resolved": false,
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6723,21 +6729,21 @@
}, },
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "resolved": false,
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", "resolved": false,
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "resolved": false,
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6747,14 +6753,14 @@
}, },
"isarray": { "isarray": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "resolved": false,
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "resolved": false,
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6764,14 +6770,14 @@
}, },
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "resolved": false,
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"minipass": { "minipass": {
"version": "2.3.5", "version": "2.3.5",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", "resolved": false,
"integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6782,7 +6788,7 @@
}, },
"minizlib": { "minizlib": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", "resolved": false,
"integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6792,7 +6798,7 @@
}, },
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "resolved": false,
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6802,14 +6808,14 @@
}, },
"ms": { "ms": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", "resolved": false,
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"needle": { "needle": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/needle/-/needle-2.3.0.tgz", "resolved": false,
"integrity": "sha512-QBZu7aAFR0522EyaXZM0FZ9GLpq6lvQ3uq8gteiDUp7wKdy0lSd2hPlgFwVuW1CBkfEs9PfDQsQzZghLs/psdg==", "integrity": "sha512-QBZu7aAFR0522EyaXZM0FZ9GLpq6lvQ3uq8gteiDUp7wKdy0lSd2hPlgFwVuW1CBkfEs9PfDQsQzZghLs/psdg==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6821,7 +6827,7 @@
}, },
"node-pre-gyp": { "node-pre-gyp": {
"version": "0.12.0", "version": "0.12.0",
"resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz", "resolved": false,
"integrity": "sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A==", "integrity": "sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6840,7 +6846,7 @@
}, },
"nopt": { "nopt": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", "resolved": false,
"integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6851,14 +6857,14 @@
}, },
"npm-bundled": { "npm-bundled": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.6.tgz", "resolved": false,
"integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==", "integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"npm-packlist": { "npm-packlist": {
"version": "1.4.1", "version": "1.4.1",
"resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.1.tgz", "resolved": false,
"integrity": "sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw==", "integrity": "sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6869,7 +6875,7 @@
}, },
"npmlog": { "npmlog": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", "resolved": false,
"integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6882,21 +6888,21 @@
}, },
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "resolved": false,
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "resolved": false,
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"once": { "once": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "resolved": false,
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6906,21 +6912,21 @@
}, },
"os-homedir": { "os-homedir": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "resolved": false,
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"os-tmpdir": { "os-tmpdir": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "resolved": false,
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"osenv": { "osenv": {
"version": "0.1.5", "version": "0.1.5",
"resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", "resolved": false,
"integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6931,21 +6937,21 @@
}, },
"path-is-absolute": { "path-is-absolute": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "resolved": false,
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"process-nextick-args": { "process-nextick-args": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", "resolved": false,
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"rc": { "rc": {
"version": "1.2.8", "version": "1.2.8",
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", "resolved": false,
"integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6958,7 +6964,7 @@
"dependencies": { "dependencies": {
"minimist": { "minimist": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "resolved": false,
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"dev": true, "dev": true,
"optional": true "optional": true
@@ -6967,7 +6973,7 @@
}, },
"readable-stream": { "readable-stream": {
"version": "2.3.6", "version": "2.3.6",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "resolved": false,
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6983,7 +6989,7 @@
}, },
"rimraf": { "rimraf": {
"version": "2.6.3", "version": "2.6.3",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", "resolved": false,
"integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -6993,49 +6999,49 @@
}, },
"safe-buffer": { "safe-buffer": {
"version": "5.1.2", "version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "resolved": false,
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"safer-buffer": { "safer-buffer": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "resolved": false,
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"sax": { "sax": {
"version": "1.2.4", "version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", "resolved": false,
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"semver": { "semver": {
"version": "5.7.0", "version": "5.7.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", "resolved": false,
"integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"set-blocking": { "set-blocking": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "resolved": false,
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"signal-exit": { "signal-exit": {
"version": "3.0.2", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "resolved": false,
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"string-width": { "string-width": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "resolved": false,
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -7047,7 +7053,7 @@
}, },
"string_decoder": { "string_decoder": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "resolved": false,
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -7057,7 +7063,7 @@
}, },
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "resolved": false,
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -7067,14 +7073,14 @@
}, },
"strip-json-comments": { "strip-json-comments": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "resolved": false,
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"tar": { "tar": {
"version": "4.4.8", "version": "4.4.8",
"resolved": "https://registry.npmjs.org/tar/-/tar-4.4.8.tgz", "resolved": false,
"integrity": "sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==", "integrity": "sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -7090,14 +7096,14 @@
}, },
"util-deprecate": { "util-deprecate": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "resolved": false,
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"wide-align": { "wide-align": {
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", "resolved": false,
"integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@@ -7107,14 +7113,14 @@
}, },
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": false,
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"yallist": { "yallist": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", "resolved": false,
"integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==",
"dev": true, "dev": true,
"optional": true "optional": true
@@ -10687,6 +10693,12 @@
"safe-buffer": "^5.1.2" "safe-buffer": "^5.1.2"
} }
}, },
"mdast": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/mdast/-/mdast-3.0.0.tgz",
"integrity": "sha1-YmvOlgPtQ/tvsFMkWm5KF/RFeqg=",
"dev": true
},
"mdast-comment-marker": { "mdast-comment-marker": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/mdast-comment-marker/-/mdast-comment-marker-1.1.1.tgz", "resolved": "https://registry.npmjs.org/mdast-comment-marker/-/mdast-comment-marker-1.1.1.tgz",

View File

@@ -12,6 +12,7 @@
"webpack": "node ./node_modules/webpack/bin/webpack.js", "webpack": "node ./node_modules/webpack/bin/webpack.js",
"00": "echo -------------------------------------------- DOC -----------------------------------------------", "00": "echo -------------------------------------------- DOC -----------------------------------------------",
"00s": "", "00s": "",
"build-doc-tools": "tsc -p ./tools/doc/tsconfig.json",
"markdownlint": "markdownlint ./docs", "markdownlint": "markdownlint ./docs",
"docbuild": "node node_modules/typedoc/bin/typedoc --tsconfig lib/tsconfig.doc.json && node tools/doc/buildYamlSourceInfo.js docs/docs.json && node ./tools/doc/docProcessor.js", "docbuild": "node node_modules/typedoc/bin/typedoc --tsconfig lib/tsconfig.doc.json && node tools/doc/buildYamlSourceInfo.js docs/docs.json && node ./tools/doc/docProcessor.js",
"license-checker": "license-checker --production --failOn 'GPL' > licenses.txt", "license-checker": "license-checker --production --failOn 'GPL' > licenses.txt",
@@ -126,10 +127,11 @@
"@angular/compiler-cli": "^7.2.15", "@angular/compiler-cli": "^7.2.15",
"@nrwl/nx": "7.1.1", "@nrwl/nx": "7.1.1",
"@nrwl/schematics": "7.1.1", "@nrwl/schematics": "7.1.1",
"@paperist/types-remark": "^0.1.3",
"@types/hammerjs": "2.0.35", "@types/hammerjs": "2.0.35",
"@types/jasmine": "~2.8.3", "@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2", "@types/jasminewd2": "~2.0.2",
"@types/node": "6.0.90", "@types/node": "^12.7.3",
"@types/selenium-webdriver": "^3.0.8", "@types/selenium-webdriver": "^3.0.8",
"ajv-cli": "^3.0.0", "ajv-cli": "^3.0.0",
"bundlesize": "^0.17.2", "bundlesize": "^0.17.2",
@@ -167,6 +169,7 @@
"lite-server": "^2.4.0", "lite-server": "^2.4.0",
"lodash.wrap": "^4.1.1", "lodash.wrap": "^4.1.1",
"markdownlint-cli": "^0.16.0", "markdownlint-cli": "^0.16.0",
"mdast": "^3.0.0",
"mdast-util-compact": "^1.0.1", "mdast-util-compact": "^1.0.1",
"mdast-util-heading-range": "^2.1.0", "mdast-util-heading-range": "^2.1.0",
"mdast-util-toc": "^2.0.1", "mdast-util-toc": "^2.0.1",

View File

@@ -9,7 +9,7 @@ var remark = require("remark");
var frontMatter = require("remark-frontmatter"); var frontMatter = require("remark-frontmatter");
var mdCompact = require("mdast-util-compact"); var mdCompact = require("mdast-util-compact");
var si = require("./SourceInfoClasses"); var si = require("./sourceInfoClasses");
// "Aggregate" data collected over the whole file set. // "Aggregate" data collected over the whole file set.
var aggData = {}; var aggData = {};

View File

@@ -51,105 +51,105 @@ var MDNav = /** @class */ (function () {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) { test = function () { return true; }; }
if (index === void 0) { index = 0; } if (index === void 0) { index = 0; }
return this.find(function (h) { return this.find(function (h) {
return h.type === "emphasis" && test(h); return h.type === 'emphasis' && test(h);
}, index); }, index);
}; };
MDNav.prototype.heading = function (test, index) { MDNav.prototype.heading = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) { test = function () { return true; }; }
if (index === void 0) { index = 0; } if (index === void 0) { index = 0; }
return this.find(function (h) { return this.find(function (h) {
return h.type === "heading" && test(h); return h.type === 'heading' && test(h);
}, index); }, index);
}; };
MDNav.prototype.headings = function (test, index) { MDNav.prototype.headings = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) { test = function () { return true; }; }
if (index === void 0) { index = 0; } if (index === void 0) { index = 0; }
return this.findAll(function (h) { return this.findAll(function (h) {
return h.type === "heading" && test(h); return h.type === 'heading' && test(h);
}, index); }, index);
}; };
MDNav.prototype.html = function (test, index) { MDNav.prototype.html = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) { test = function () { return true; }; }
if (index === void 0) { index = 0; } if (index === void 0) { index = 0; }
return this.find(function (h) { return this.find(function (h) {
return h.type === "html" && test(h); return h.type === 'html' && test(h);
}, index); }, index);
}; };
MDNav.prototype.link = function (test, index) { MDNav.prototype.link = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) { test = function () { return true; }; }
if (index === void 0) { index = 0; } if (index === void 0) { index = 0; }
return this.find(function (h) { return this.find(function (h) {
return h.type === "link" && test(h); return h.type === 'link' && test(h);
}, index); }, index);
}; };
MDNav.prototype.links = function (test, index) { MDNav.prototype.links = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) { test = function () { return true; }; }
if (index === void 0) { index = 0; } if (index === void 0) { index = 0; }
return this.findAll(function (h) { return this.findAll(function (h) {
return h.type === "link" && test(h); return h.type === 'link' && test(h);
}, index); }, index);
}; };
MDNav.prototype.list = function (test, index) { MDNav.prototype.list = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) { test = function () { return true; }; }
if (index === void 0) { index = 0; } if (index === void 0) { index = 0; }
return this.find(function (h) { return this.find(function (h) {
return h.type === "list" && test(h); return h.type === 'list' && test(h);
}, index); }, index);
}; };
MDNav.prototype.listItem = function (test, index) { MDNav.prototype.listItem = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) { test = function () { return true; }; }
if (index === void 0) { index = 0; } if (index === void 0) { index = 0; }
return this.find(function (h) { return this.find(function (h) {
return h.type === "listItem" && test(h); return h.type === 'listItem' && test(h);
}, index); }, index);
}; };
MDNav.prototype.listItems = function (test, index) { MDNav.prototype.listItems = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) { test = function () { return true; }; }
if (index === void 0) { index = 0; } if (index === void 0) { index = 0; }
return this.findAll(function (h) { return this.findAll(function (h) {
return h.type === "listItem" && test(h); return h.type === 'listItem' && test(h);
}, index); }, index);
}; };
MDNav.prototype.paragraph = function (test, index) { MDNav.prototype.paragraph = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) { test = function () { return true; }; }
if (index === void 0) { index = 0; } if (index === void 0) { index = 0; }
return this.find(function (h) { return this.find(function (h) {
return h.type === "paragraph" && test(h); return h.type === 'paragraph' && test(h);
}, index); }, index);
}; };
MDNav.prototype.strong = function (test, index) { MDNav.prototype.strong = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) { test = function () { return true; }; }
if (index === void 0) { index = 0; } if (index === void 0) { index = 0; }
return this.find(function (h) { return this.find(function (h) {
return h.type === "strong" && test(h); return h.type === 'strong' && test(h);
}, index); }, index);
}; };
MDNav.prototype.table = function (test, index) { MDNav.prototype.table = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) { test = function () { return true; }; }
if (index === void 0) { index = 0; } if (index === void 0) { index = 0; }
return this.find(function (h) { return this.find(function (h) {
return h.type === "table" && test(h); return h.type === 'table' && test(h);
}, index); }, index);
}; };
MDNav.prototype.tableRow = function (test, index) { MDNav.prototype.tableRow = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) { test = function () { return true; }; }
if (index === void 0) { index = 0; } if (index === void 0) { index = 0; }
return this.find(function (h) { return this.find(function (h) {
return h.type === "tableRow" && test(h); return h.type === 'tableRow' && test(h);
}, index); }, index);
}; };
MDNav.prototype.tableCell = function (test, index) { MDNav.prototype.tableCell = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) { test = function () { return true; }; }
if (index === void 0) { index = 0; } if (index === void 0) { index = 0; }
return this.find(function (h) { return this.find(function (h) {
return h.type === "tableCell" && test(h); return h.type === 'tableCell' && test(h);
}, index); }, index);
}; };
MDNav.prototype.text = function (test, index) { MDNav.prototype.text = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) { test = function () { return true; }; }
if (index === void 0) { index = 0; } if (index === void 0) { index = 0; }
return this.find(function (h) { return this.find(function (h) {
return h.type === "text" && test(h); return h.type === 'text' && test(h);
}, index); }, index);
}; };
Object.defineProperty(MDNav.prototype, "item", { Object.defineProperty(MDNav.prototype, "item", {
@@ -182,11 +182,11 @@ var MDNav = /** @class */ (function () {
}); });
Object.defineProperty(MDNav.prototype, "value", { Object.defineProperty(MDNav.prototype, "value", {
get: function () { get: function () {
if (this.item && this.item["value"]) { if (this.item && this.item['value']) {
return this.item.value; return this.item.value;
} }
else { else {
return ""; return '';
} }
}, },
enumerable: true, enumerable: true,
@@ -195,20 +195,20 @@ var MDNav = /** @class */ (function () {
Object.defineProperty(MDNav.prototype, "textValue", { Object.defineProperty(MDNav.prototype, "textValue", {
get: function () { get: function () {
if (this.item) { if (this.item) {
if (this.item["value"]) { if (this.item['value']) {
return this.item.value; return this.item.value;
} }
else if (this.item.children && else if (this.item.children &&
(this.item.children.length > 0) && (this.item.children.length > 0) &&
(this.item.children[0].type === "text")) { (this.item.children[0].type === 'text')) {
return this.item.children[0].value; return this.item.children[0].value;
} }
else { else {
return ""; return '';
} }
} }
else { else {
return ""; return '';
} }
}, },
enumerable: true, enumerable: true,

View File

@@ -11,7 +11,7 @@ export class MDNav {
let currIndex = 0; let currIndex = 0;
for (let i = this.pos; i < this.root.children.length; i++) { for (let i = this.pos; i < this.root.children.length; i++) {
let child = this.root.children[i]; const child = this.root.children[i];
if (test(child)) { if (test(child)) {
if (currIndex === index) { if (currIndex === index) {
@@ -30,12 +30,12 @@ export class MDNav {
return []; return [];
} }
let result = []; const result = [];
let currIndex = 0; let currIndex = 0;
for (let i = this.pos; i < this.root.children.length; i++) { for (let i = this.pos; i < this.root.children.length; i++) {
let child = this.root.children[i]; const child = this.root.children[i];
if (test(child)) { if (test(child)) {
if (currIndex === index) { if (currIndex === index) {
@@ -49,107 +49,96 @@ export class MDNav {
return result; return result;
} }
emph(test: (element: any) => boolean = () => true, index: number = 0): MDNav { emph(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => { return this.find((h) => {
return h.type === "emphasis" && test(h); return h.type === 'emphasis' && test(h);
}, index); }, index);
} }
heading(test: (element: any) => boolean = () => true, index: number = 0): MDNav { heading(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => { return this.find((h) => {
return h.type === "heading" && test(h); return h.type === 'heading' && test(h);
}, index); }, index);
} }
headings(test: (element: any) => boolean = () => true, index: number = 0): MDNav[] { headings(test: (element: any) => boolean = () => true, index: number = 0): MDNav[] {
return this.findAll((h) => { return this.findAll((h) => {
return h.type === "heading" && test(h); return h.type === 'heading' && test(h);
}, index); }, index);
} }
html(test: (element: any) => boolean = () => true, index: number = 0): MDNav { html(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => { return this.find((h) => {
return h.type === "html" && test(h); return h.type === 'html' && test(h);
}, index); }, index);
} }
link(test: (element: any) => boolean = () => true, index: number = 0): MDNav { link(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => { return this.find((h) => {
return h.type === "link" && test(h); return h.type === 'link' && test(h);
}, index); }, index);
} }
links(test: (element: any) => boolean = () => true, index: number = 0): MDNav[] { links(test: (element: any) => boolean = () => true, index: number = 0): MDNav[] {
return this.findAll((h) => { return this.findAll((h) => {
return h.type === "link" && test(h); return h.type === 'link' && test(h);
}, index); }, index);
} }
list(test: (element: any) => boolean = () => true, index: number = 0): MDNav { list(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => { return this.find((h) => {
return h.type === "list" && test(h); return h.type === 'list' && test(h);
}, index); }, index);
} }
listItem(test: (element: any) => boolean = () => true, index: number = 0): MDNav { listItem(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => { return this.find((h) => {
return h.type === "listItem" && test(h); return h.type === 'listItem' && test(h);
}, index); }, index);
} }
listItems(test: (element: any) => boolean = () => true, index: number = 0): MDNav[] { listItems(test: (element: any) => boolean = () => true, index: number = 0): MDNav[] {
return this.findAll((h) => { return this.findAll((h) => {
return h.type === "listItem" && test(h); return h.type === 'listItem' && test(h);
}, index); }, index);
} }
paragraph(test: (element: any) => boolean = () => true, index: number = 0): MDNav { paragraph(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => { return this.find((h) => {
return h.type === "paragraph" && test(h); return h.type === 'paragraph' && test(h);
}, index); }, index);
} }
strong(test: (element: any) => boolean = () => true, index: number = 0): MDNav { strong(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => { return this.find((h) => {
return h.type === "strong" && test(h); return h.type === 'strong' && test(h);
}, index); }, index);
} }
table(test: (element: any) => boolean = () => true, index: number = 0): MDNav { table(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => { return this.find((h) => {
return h.type === "table" && test(h); return h.type === 'table' && test(h);
}, index); }, index);
} }
tableRow(test: (element: any) => boolean = () => true, index: number = 0): MDNav { tableRow(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => { return this.find((h) => {
return h.type === "tableRow" && test(h); return h.type === 'tableRow' && test(h);
}, index); }, index);
} }
tableCell(test: (element: any) => boolean = () => true, index: number = 0): MDNav { tableCell(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => { return this.find((h) => {
return h.type === "tableCell" && test(h); return h.type === 'tableCell' && test(h);
}, index); }, index);
} }
text(test: (element: any) => boolean = () => true, index: number = 0): MDNav { text(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => { return this.find((h) => {
return h.type === "text" && test(h); return h.type === 'text' && test(h);
}, index); }, index);
} }
get item(): any { get item(): any {
if (!this.root || !this.root.children) { if (!this.root || !this.root.children) {
return undefined; return undefined;
@@ -164,36 +153,33 @@ export class MDNav {
(this.pos >= this.root.children.length); (this.pos >= this.root.children.length);
} }
get childNav(): MDNav { get childNav(): MDNav {
return new MDNav(this.item); return new MDNav(this.item);
} }
get value(): any { get value(): any {
if (this.item && this.item["value"]) { if (this.item && this.item['value']) {
return this.item.value; return this.item.value;
} else { } else {
return ""; return '';
} }
} }
get textValue(): string {
get textValue() : string {
if (this.item) { if (this.item) {
if (this.item["value"]) { if (this.item['value']) {
return this.item.value; return this.item.value;
} else if ( } else if (
this.item.children && this.item.children &&
(this.item.children.length > 0) && (this.item.children.length > 0) &&
(this.item.children[0].type === "text") (this.item.children[0].type === 'text')
){ ) {
return this.item.children[0].value; return this.item.children[0].value;
} else { } else {
return ""; return '';
} }
} else { } else {
return ""; return '';
} }
} }
} }

View File

@@ -1,7 +1,6 @@
import { MDAST } from 'mdast'; import { MDAST } from 'mdast';
import { UNIST } from 'unist'; import { UNIST } from 'unist';
import * as mdToString from 'mdast-util-to-string'; import * as mdToString from 'mdast-util-to-string';
import * as jsyaml from 'js-yaml'; import * as jsyaml from 'js-yaml';
export let schema = ` export let schema = `
@@ -107,7 +106,6 @@ export class Node {
} }
} }
export class Parent { export class Parent {
constructor(protected orig: UNIST.Parent) {} constructor(protected orig: UNIST.Parent) {}
@@ -161,43 +159,43 @@ export class Parent {
export class Root extends Parent { export class Root extends Parent {
_meta: {}; _meta: {};
public id: string id: string;
type(): string { type(): string {
return 'root'; return 'root';
} }
folder(args): string { folder(args): string {
let depth = args['depth']; const depth = args['depth'];
const relPath = this.id.substring(this.id.indexOf('docs'));
const pathSegments = relPath.split(/[\\\/]/);
let relPath = this.id.substring(this.id.indexOf('docs'));
let pathSegments = relPath.split(/[\\\/]/);
return pathSegments[depth]; return pathSegments[depth];
} }
metadata(args): string { metadata(args): string {
if (!this._meta) { if (!this._meta) {
let yamlElement: MDAST.YAML = this.orig.children.find( const yamlElement: any = this.orig.children.find(
(ch: UNIST.Node) => (ch.type === 'yaml') (ch: UNIST.Node) => (ch.type === 'yaml')
); );
if (yamlElement) { if (yamlElement) {
this._meta = jsyaml.safeLoad(yamlElement.value) this._meta = jsyaml.safeLoad(yamlElement.value);
} else { } else {
this._meta = {}; this._meta = {};
} }
} }
if (this._meta[args['key']]) { if (this._meta[args['key']]) {
return this._meta[args['key']] return this._meta[args['key']];
} else { } else {
return ''; return '';
} }
} }
heading(args): Heading { heading(args): Heading {
let depth = args['depth']; const depth = args['depth'];
return new Heading(<MDAST.Heading> this.orig.children.find( return new Heading(<MDAST.Heading> this.orig.children.find(
(ch: UNIST.Node) => (ch: UNIST.Node) =>
(ch.type === 'heading') && (ch.type === 'heading') &&
@@ -205,32 +203,28 @@ export class Root extends Parent {
)); ));
} }
headings(args): Heading[] { headings(args): Heading[] {
let depth = args['depth']; const depth = args['depth'];
return this.orig.children.filter( return this.orig.children.filter(
(ch: UNIST.Node) => (ch: UNIST.Node) =>
(ch.type === 'heading') && (ch.type === 'heading') &&
((depth === 0) || (depth === (<MDAST.Heading> ch).depth))) ((depth === 0) || (depth === (<MDAST.Heading> ch).depth)))
.map(ch => new Heading(<MDAST.Heading> ch)); .map(ch => new Heading(<MDAST.Heading> ch));
} }
} }
export class Heading extends Parent { export class Heading extends Parent {
depth(): number { depth(): number {
return (<MDAST.Heading> this.orig).depth; return (<MDAST.Heading> this.orig).depth;
} }
} }
export class Paragraph extends Parent { export class Paragraph extends Parent {
} }
export class Link extends Parent { export class Link extends Parent {
title(): string { title(): string {
return (<MDAST.Link> this.orig).title; return (<MDAST.Link> this.orig).title;
} }
@@ -248,9 +242,7 @@ export class Text {
} }
} }
const libNamesRegex = /content-services|core|extensions|insights|process-services|process-services-cloud/;
let libNamesRegex = /content-services|core|extensions|insights|process-services|process-services-cloud/;
export class Docset { export class Docset {
public docs: Root[]; public docs: Root[];
@@ -258,14 +250,14 @@ export class Docset {
constructor(mdCache) { constructor(mdCache) {
this.docs = []; this.docs = [];
let pathnames = Object.keys(mdCache); const pathnames = Object.keys(mdCache);
pathnames.forEach(pathname => { pathnames.forEach(pathname => {
if (!pathname.match(/README/) && if (!pathname.match(/README/) &&
pathname.match(libNamesRegex) pathname.match(libNamesRegex)
) { ) {
let doc = new Root(mdCache[pathname].mdInTree); const doc = new Root(mdCache[pathname].mdInTree);
doc.id = pathname.replace(/\\/g, '/'); doc.id = pathname.replace(/\\/g, '/');
this.docs.push(doc); this.docs.push(doc);
} }
@@ -283,4 +275,4 @@ export class Docset {
size(): number { size(): number {
return this.docs.length; return this.docs.length;
} }
} }

View File

@@ -10,15 +10,15 @@ var MQ = require("./mqDefs");
var docFilePath = path.resolve('..', '..', 'docs', 'core', 'about.component.md'); var docFilePath = path.resolve('..', '..', 'docs', 'core', 'about.component.md');
var docSrc = fs.readFileSync(docFilePath, 'utf8'); var docSrc = fs.readFileSync(docFilePath, 'utf8');
var tree = remark() var tree = remark()
.use(frontMatter, ["yaml"]) .use(frontMatter, ['yaml'])
.parse(docSrc); .parse(docSrc);
tree = removePosInfo(tree); tree = removePosInfo(tree);
//console.log(JSON.stringify(tree));
var schema = graphql_1.buildSchema(MQ.schema); var schema = graphql_1.buildSchema(MQ.schema);
var root = { var root = {
document: function () { return new MQ.Root(tree); } document: function () { return new MQ.Root(tree); }
}; };
var query = "\n {\n document {\n metadata(key: \"Status\")\n heading {\n link {\n text {\n value\n }\n }\n }\n paragraph {\n plaintext\n }\n }\n }\n"; var query = "\n {\n document {\n metadata(key: \"Status\")\n heading {\n link {\n text {\n value\n }\n }\n }\n paragraph {\n plaintext\n }\n }\n }\n";
graphql_1.graphql(schema, query, root).then(function (response) { graphql_1.graphql(schema, query, root).then(function (response) {
// tslint:disable-next-line: no-console
console.log(JSON.stringify(response)); console.log(JSON.stringify(response));
}); });

View File

@@ -10,25 +10,22 @@ import * as removePosInfo from 'unist-util-remove-position';
import * as MQ from './mqDefs'; import * as MQ from './mqDefs';
let docFilePath = path.resolve('..', '..', 'docs', 'core', 'about.component.md'); const docFilePath = path.resolve('..', '..', 'docs', 'core', 'about.component.md');
let docSrc = fs.readFileSync(docFilePath, 'utf8'); const docSrc = fs.readFileSync(docFilePath, 'utf8');
let tree: MDAST.Root = remark() let tree: MDAST.Root = remark()
.use(frontMatter, ["yaml"]) .use(frontMatter, ['yaml'])
.parse(docSrc); .parse(docSrc);
tree = removePosInfo(tree); tree = removePosInfo(tree);
//console.log(JSON.stringify(tree)); const schema = buildSchema(MQ.schema);
let schema = buildSchema(MQ.schema); const root = {
let root = {
document: () => new MQ.Root(tree) document: () => new MQ.Root(tree)
}; };
const query = `
let query = `
{ {
document { document {
metadata(key: "Status") metadata(key: "Status")
@@ -47,5 +44,6 @@ let query = `
`; `;
graphql(schema, query, root).then((response) => { graphql(schema, query, root).then((response) => {
// tslint:disable-next-line: no-console
console.log(JSON.stringify(response)); console.log(JSON.stringify(response));
}); });

View File

@@ -1,4 +1,5 @@
"use strict"; "use strict";
// tslint:disable: no-console
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var path = require("path"); var path = require("path");
var fs = require("fs"); var fs = require("fs");
@@ -8,27 +9,20 @@ var remark = require("remark");
var frontMatter = require("remark-frontmatter"); var frontMatter = require("remark-frontmatter");
var yaml = require("js-yaml"); var yaml = require("js-yaml");
var moment = require("moment"); var moment = require("moment");
var Rx_1 = require("rxjs/Rx"); var rxjs_1 = require("rxjs");
var libsearch = require("./libsearch"); var libsearch = require("./libsearch");
var stoplist_1 = require("./stoplist"); var stoplist_1 = require("./stoplist");
var adf20StartDate = "2017-11-20"; var adf20StartDate = '2017-11-20';
var commitWeight = 0.1; var commitWeight = 0.1;
var scoreTimeBase = 60; var scoreTimeBase = 60;
var libFolder = "lib"; var libFolder = 'lib';
var stoplistFilePath = path.resolve("tools", "doc", "commitStoplist.json"); var stoplistFilePath = path.resolve('tools', 'doc', 'commitStoplist.json');
var angFilePattern = /(component)|(directive)|(model)|(pipe)|(service)|(widget)/; var angFilePattern = /(component)|(directive)|(model)|(pipe)|(service)|(widget)/;
var srcData = {}; var srcData = {};
var stoplist = new stoplist_1.Stoplist(stoplistFilePath); var stoplist = new stoplist_1.Stoplist(stoplistFilePath);
var docsFolderPath = path.resolve("docs"); var docsFolderPath = path.resolve('docs');
var libFolders = ["core", "content-services", "extensions", "insights", "process-services", "process-services-cloud"]; var libFolders = ['core', 'content-services', 'extensions', 'insights', 'process-services', 'process-services-cloud'];
libsearch(srcData, path.resolve(libFolder)); libsearch(srcData, path.resolve(libFolder));
/*
let keys = Object.keys(srcData);
for (let i = 0; i < keys.length; i++) {
console.log(keys[i]);
}
*/
var authToken = process.env.graphAuthToken; var authToken = process.env.graphAuthToken;
var client = new graphql_request_1.GraphQLClient('https://api.github.com/graphql', { var client = new graphql_request_1.GraphQLClient('https://api.github.com/graphql', {
headers: { headers: {
@@ -37,20 +31,21 @@ var client = new graphql_request_1.GraphQLClient('https://api.github.com/graphql
}); });
var query = "query commitHistory($path: String) {\n repository(name: \"alfresco-ng2-components\", owner: \"alfresco\") {\n ref(qualifiedName: \"development\") {\n target {\n ... on Commit {\n history(first: 15, path: $path) {\n nodes {\n pushedDate\n message\n }\n }\n }\n }\n }\n }\n}"; var query = "query commitHistory($path: String) {\n repository(name: \"alfresco-ng2-components\", owner: \"alfresco\") {\n ref(qualifiedName: \"development\") {\n target {\n ... on Commit {\n history(first: 15, path: $path) {\n nodes {\n pushedDate\n message\n }\n }\n }\n }\n }\n }\n}";
var docFiles = getDocFilePaths(docsFolderPath); var docFiles = getDocFilePaths(docsFolderPath);
var docNames = Rx_1.Observable.from(docFiles); var docNames = rxjs_1.of(docFiles);
console.log("'Name','Review date','Commits since review','Score'"); console.log("'Name','Review date','Commits since review','Score'");
docNames.subscribe(function (x) { docNames.subscribe(function (x) {
var key = path.basename(x, ".md"); var key = path.basename(x, '.md');
if (!srcData[key]) if (!srcData[key]) {
return; return;
}
var vars = { var vars = {
"path": "lib/" + srcData[key].path 'path': 'lib/' + srcData[key].path
}; };
client.request(query, vars).then(function (data) { client.request(query, vars).then(function (data) {
var nodes = data["repository"].ref.target.history.nodes; var nodes = data['repository'].ref.target.history.nodes;
var lastReviewDate = getDocReviewDate(x); //(key + ".md"); var lastReviewDate = getDocReviewDate(x); // (key + ".md");
var numUsefulCommits = extractCommitInfo(nodes, lastReviewDate, stoplist); var numUsefulCommits = extractCommitInfo(nodes, lastReviewDate, stoplist);
var dateString = lastReviewDate.format("YYYY-MM-DD"); var dateString = lastReviewDate.format('YYYY-MM-DD');
var score = priorityScore(lastReviewDate, numUsefulCommits).toPrecision(3); var score = priorityScore(lastReviewDate, numUsefulCommits).toPrecision(3);
console.log("'" + key + "','" + dateString + "','" + numUsefulCommits + "','" + score + "'"); console.log("'" + key + "','" + dateString + "','" + numUsefulCommits + "','" + score + "'");
}); });
@@ -63,12 +58,13 @@ function priorityScore(reviewDate, numCommits) {
function getDocReviewDate(docFileName) { function getDocReviewDate(docFileName) {
var mdFilePath = path.resolve(docsFolderPath, docFileName); var mdFilePath = path.resolve(docsFolderPath, docFileName);
var mdText = fs.readFileSync(mdFilePath); var mdText = fs.readFileSync(mdFilePath);
var tree = remark().use(frontMatter, ["yaml"]).parse(mdText); var tree = remark().use(frontMatter, ['yaml']).parse(mdText);
var lastReviewDate = moment(adf20StartDate); var lastReviewDate = moment(adf20StartDate);
if (tree.children[0].type == "yaml") { if (tree.children[0].type === 'yaml') {
var metadata = yaml.load(tree.children[0].value); var metadata = yaml.load(tree.children[0].value);
if (metadata["Last reviewed"]) if (metadata['Last reviewed']) {
lastReviewDate = moment(metadata["Last reviewed"]); lastReviewDate = moment(metadata['Last reviewed']);
}
} }
return lastReviewDate; return lastReviewDate;
} }
@@ -76,7 +72,7 @@ function extractCommitInfo(commitNodes, cutOffDate, stoplist) {
var numUsefulCommits = 0; var numUsefulCommits = 0;
commitNodes.forEach(function (element) { commitNodes.forEach(function (element) {
if (!stoplist.isRejected(element.message)) { if (!stoplist.isRejected(element.message)) {
var abbr = element.message.substr(0, 15); // const abbr = element.message.substr(0, 15);
var commitDate = moment(element.pushedDate); var commitDate = moment(element.pushedDate);
if (commitDate.isAfter(cutOffDate)) { if (commitDate.isAfter(cutOffDate)) {
numUsefulCommits++; numUsefulCommits++;
@@ -90,31 +86,18 @@ function getDocFilePaths(folderPath) {
libFolders.forEach(function (element) { libFolders.forEach(function (element) {
var libPath = path.resolve(folderPath, element); var libPath = path.resolve(folderPath, element);
addItemsRecursively(libPath, result); addItemsRecursively(libPath, result);
var items = fs.readdirSync(libPath);
/*
files = files.filter(filename =>
(path.extname(filename) === ".md") &&
(filename !== "README.md") &&
(filename.match(angFilePattern))
);
files.forEach(element => {
result.push(path.join(libPath, element));
});
*/
}); });
return result; return result;
function addItemsRecursively(folderPath, resultList) { function addItemsRecursively(elementPath, resultList) {
var items = fs.readdirSync(folderPath); var items = fs.readdirSync(elementPath);
items.forEach(function (item) { items.forEach(function (item) {
var fullItemPath = path.resolve(folderPath, item); var fullItemPath = path.resolve(elementPath, item);
var itemInfo = fs.statSync(fullItemPath); var itemInfo = fs.statSync(fullItemPath);
if (itemInfo.isDirectory()) { if (itemInfo.isDirectory()) {
addItemsRecursively(fullItemPath, resultList); addItemsRecursively(fullItemPath, resultList);
} }
else if ((path.extname(fullItemPath) === ".md") && else if ((path.extname(fullItemPath) === '.md') &&
(item !== "README.md") && (item !== 'README.md') &&
(item.match(angFilePattern))) { (item.match(angFilePattern))) {
resultList.push(fullItemPath); resultList.push(fullItemPath);
} }

View File

@@ -1,35 +1,35 @@
import * as path from "path"; // tslint:disable: no-console
import * as fs from "fs";
import * as process from "process"
import { GraphQLClient } from "graphql-request"; import * as path from 'path';
import * as remark from "remark"; import * as fs from 'fs';
import * as frontMatter from "remark-frontmatter"; import * as process from 'process';
import * as yaml from "js-yaml";
import * as moment from "moment";
import { Observable } from 'rxjs/Rx';
import * as libsearch from "./libsearch"; import { GraphQLClient } from 'graphql-request';
import { Stoplist } from "./stoplist"; import * as remark from 'remark';
import { last } from "rxjs/operator/last"; import * as frontMatter from 'remark-frontmatter';
import * as yaml from 'js-yaml';
import * as moment from 'moment';
import { of } from 'rxjs';
import * as libsearch from './libsearch';
import { Stoplist } from './stoplist';
const adf20StartDate = "2017-11-20"; const adf20StartDate = '2017-11-20';
const commitWeight = 0.1; const commitWeight = 0.1;
const scoreTimeBase = 60; const scoreTimeBase = 60;
const libFolder = "lib"; const libFolder = 'lib';
const stoplistFilePath = path.resolve("tools", "doc", "commitStoplist.json"); const stoplistFilePath = path.resolve('tools', 'doc', 'commitStoplist.json');
const angFilePattern = /(component)|(directive)|(model)|(pipe)|(service)|(widget)/; const angFilePattern = /(component)|(directive)|(model)|(pipe)|(service)|(widget)/;
let srcData = {}; const srcData = {};
let stoplist = new Stoplist(stoplistFilePath); const stoplist = new Stoplist(stoplistFilePath);
let docsFolderPath = path.resolve("docs"); const docsFolderPath = path.resolve('docs');
let libFolders = ["core", "content-services", "extensions", "insights", "process-services", "process-services-cloud"]; const libFolders = ['core', 'content-services', 'extensions', 'insights', 'process-services', 'process-services-cloud'];
libsearch(srcData, path.resolve(libFolder)); libsearch(srcData, path.resolve(libFolder));
@@ -58,70 +58,69 @@ const query = `query commitHistory($path: String) {
} }
}`; }`;
let docFiles = getDocFilePaths(docsFolderPath); const docFiles = getDocFilePaths(docsFolderPath);
let docNames = Observable.from(docFiles); const docNames = of(docFiles);
console.log("'Name','Review date','Commits since review','Score'"); console.log("'Name','Review date','Commits since review','Score'");
docNames.subscribe(x => { docNames.subscribe(x => {
let key = path.basename(x, ".md"); const key = path.basename(x, '.md');
if (!srcData[key]) if (!srcData[key]) {
return; return;
}
let vars = { const vars = {
"path": "lib/" + srcData[key].path 'path': 'lib/' + srcData[key].path
}; };
client.request(query, vars).then(data => { client.request(query, vars).then(data => {
let nodes = data["repository"].ref.target.history.nodes; const nodes = data['repository'].ref.target.history.nodes;
let lastReviewDate = getDocReviewDate(x);//(key + ".md"); const lastReviewDate = getDocReviewDate(x); // (key + ".md");
let numUsefulCommits = extractCommitInfo(nodes, lastReviewDate, stoplist); const numUsefulCommits = extractCommitInfo(nodes, lastReviewDate, stoplist);
let dateString = lastReviewDate.format("YYYY-MM-DD"); const dateString = lastReviewDate.format('YYYY-MM-DD');
let score = priorityScore(lastReviewDate, numUsefulCommits).toPrecision(3); const score = priorityScore(lastReviewDate, numUsefulCommits).toPrecision(3);
console.log(`'${key}','${dateString}','${numUsefulCommits}','${score}'`); console.log(`'${key}','${dateString}','${numUsefulCommits}','${score}'`);
}); });
}); });
function priorityScore(reviewDate, numCommits) { function priorityScore(reviewDate, numCommits) {
let daysSinceReview = moment().diff(reviewDate, 'days'); const daysSinceReview = moment().diff(reviewDate, 'days');
let commitScore = 2 + numCommits * commitWeight; const commitScore = 2 + numCommits * commitWeight;
return Math.pow(commitScore, daysSinceReview / scoreTimeBase); return Math.pow(commitScore, daysSinceReview / scoreTimeBase);
} }
function getDocReviewDate(docFileName) { function getDocReviewDate(docFileName) {
let mdFilePath = path.resolve(docsFolderPath, docFileName); const mdFilePath = path.resolve(docsFolderPath, docFileName);
let mdText = fs.readFileSync(mdFilePath); const mdText = fs.readFileSync(mdFilePath);
let tree = remark().use(frontMatter, ["yaml"]).parse(mdText); const tree = remark().use(frontMatter, ['yaml']).parse(mdText);
let lastReviewDate = moment(adf20StartDate); let lastReviewDate = moment(adf20StartDate);
if (tree.children[0].type == "yaml") { if (tree.children[0].type === 'yaml') {
let metadata = yaml.load(tree.children[0].value); const metadata = yaml.load(tree.children[0].value);
if (metadata["Last reviewed"]) if (metadata['Last reviewed']) {
lastReviewDate = moment(metadata["Last reviewed"]); lastReviewDate = moment(metadata['Last reviewed']);
}
} }
return lastReviewDate; return lastReviewDate;
} }
function extractCommitInfo(commitNodes, cutOffDate, stoplist) { function extractCommitInfo(commitNodes, cutOffDate, stoplist) {
let numUsefulCommits = 0; let numUsefulCommits = 0;
commitNodes.forEach(element => { commitNodes.forEach(element => {
if (!stoplist.isRejected(element.message)) { if (!stoplist.isRejected(element.message)) {
let abbr = element.message.substr(0, 15); // const abbr = element.message.substr(0, 15);
let commitDate = moment(element.pushedDate); const commitDate = moment(element.pushedDate);
if (commitDate.isAfter(cutOffDate)) { if (commitDate.isAfter(cutOffDate)) {
numUsefulCommits++; numUsefulCommits++;
@@ -132,30 +131,28 @@ function extractCommitInfo(commitNodes, cutOffDate, stoplist) {
return numUsefulCommits; return numUsefulCommits;
} }
function getDocFilePaths(folderPath) { function getDocFilePaths(folderPath) {
let result = []; const result = [];
libFolders.forEach(element => { libFolders.forEach(element => {
let libPath = path.resolve(folderPath, element); const libPath = path.resolve(folderPath, element);
addItemsRecursively(libPath, result); addItemsRecursively(libPath, result);
}); });
return result; return result;
function addItemsRecursively(folderPath: string, resultList: string[]) { function addItemsRecursively(elementPath: string, resultList: string[]) {
let items = fs.readdirSync(folderPath); const items = fs.readdirSync(elementPath);
items.forEach(item => { items.forEach(item => {
let fullItemPath = path.resolve(folderPath, item); const fullItemPath = path.resolve(elementPath, item);
let itemInfo = fs.statSync(fullItemPath); const itemInfo = fs.statSync(fullItemPath);
if (itemInfo.isDirectory()) { if (itemInfo.isDirectory()) {
addItemsRecursively(fullItemPath, resultList); addItemsRecursively(fullItemPath, resultList);
} else if ( } else if (
(path.extname(fullItemPath) === ".md") && (path.extname(fullItemPath) === '.md') &&
(item !== "README.md") && (item !== 'README.md') &&
(item.match(angFilePattern)) (item.match(angFilePattern))
) { ) {
resultList.push(fullItemPath); resultList.push(fullItemPath);

View File

@@ -1,44 +1,46 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var undocMethodNames = { var skipMethodNames = [
"ngOnChanges": 1 'ngOnChanges',
}; 'ngOnDestroy',
'ngOnInit'
];
var PropInfo = /** @class */ (function () { var PropInfo = /** @class */ (function () {
function PropInfo(sourceData) { function PropInfo(sourceData) {
var _this = this; var _this = this;
this.errorMessages = []; this.errorMessages = [];
this.name = sourceData.name; this.name = sourceData.name;
this.docText = sourceData.summary || ""; this.docText = sourceData.summary || '';
this.docText = this.docText.replace(/[\n\r]+/g, " ").trim(); this.docText = this.docText.replace(/[\n\r]+/g, ' ').trim();
var tempDefaultVal = sourceData.syntax["return"].defaultValue; var tempDefaultVal = sourceData.syntax['return'].defaultValue;
this.defaultValue = tempDefaultVal ? tempDefaultVal.toString() : ""; this.defaultValue = tempDefaultVal ? tempDefaultVal.toString() : '';
this.defaultValue = this.defaultValue.replace(/\|/, "\\|"); this.defaultValue = this.defaultValue.replace(/\|/, '\\|');
this.type = sourceData.syntax["return"].type || ""; this.type = sourceData.syntax['return'].type || '';
this.type = this.type.toString().replace(/\|/, "\\|"); this.type = this.type.toString().replace(/\|/, '\\|');
if (sourceData.tags) { if (sourceData.tags) {
var depTag = sourceData.tags.find(function (tag) { return tag.name === "deprecated"; }); var depTag = sourceData.tags.find(function (tag) { return tag.name === 'deprecated'; });
if (depTag) { if (depTag) {
this.isDeprecated = true; this.isDeprecated = true;
this.docText = "(**Deprecated:** " + depTag.text.replace(/[\n\r]+/g, " ").trim() + ") " + this.docText; this.docText = '(**Deprecated:** ' + depTag.text.replace(/[\n\r]+/g, ' ').trim() + ') ' + this.docText;
} }
} }
this.isInput = false; this.isInput = false;
this.isOutput = false; this.isOutput = false;
if (sourceData.decorators) { if (sourceData.decorators) {
sourceData.decorators.forEach(function (dec) { sourceData.decorators.forEach(function (dec) {
//console.log(dec); if (dec.name === 'Input') {
if (dec.name === "Input") {
_this.isInput = true; _this.isInput = true;
if (dec.arguments) { if (dec.arguments) {
var bindingName = dec.arguments["bindingPropertyName"]; var bindingName = dec.arguments['bindingPropertyName'];
if (bindingName && (bindingName !== "")) if (bindingName && (bindingName !== '')) {
_this.name = bindingName.replace(/['"]/g, ""); _this.name = bindingName.replace(/['"]/g, '');
}
} }
if (!_this.docText && !_this.isDeprecated) { if (!_this.docText && !_this.isDeprecated) {
_this.errorMessages.push("Warning: Input \"" + sourceData.name + "\" has no doc text."); _this.errorMessages.push("Warning: Input \"" + sourceData.name + "\" has no doc text.");
} }
} }
if (dec.name === "Output") { if (dec.name === 'Output') {
_this.isOutput = true; _this.isOutput = true;
if (!_this.docText && !_this.isDeprecated) { if (!_this.docText && !_this.isDeprecated) {
_this.errorMessages.push("Warning: Output \"" + sourceData.name + "\" has no doc text."); _this.errorMessages.push("Warning: Output \"" + sourceData.name + "\" has no doc text.");
@@ -57,26 +59,27 @@ var PropInfo = /** @class */ (function () {
return PropInfo; return PropInfo;
}()); }());
exports.PropInfo = PropInfo; exports.PropInfo = PropInfo;
;
var ParamInfo = /** @class */ (function () { var ParamInfo = /** @class */ (function () {
function ParamInfo(sourceData) { function ParamInfo(sourceData) {
this.name = sourceData.id; this.name = sourceData.id;
this.type = sourceData.type.toString().replace(/\s/g, ""); this.type = sourceData.type.toString().replace(/\s/g, '');
this.defaultValue = sourceData.defaultValue; this.defaultValue = sourceData.defaultValue;
this.docText = sourceData.description.replace(/[\n\r]+/g, " ").trim(); this.docText = sourceData.description.replace(/[\n\r]+/g, ' ').trim();
this.isOptional = false; this.isOptional = false;
if (sourceData.flags) { if (sourceData.flags) {
var flag = sourceData.flags.find(function (flag) { return flag.name === "isOptional"; }); var flag = sourceData.flags.find(function (sourceFlag) { return sourceFlag.name === 'isOptional'; });
if (flag) { if (flag) {
this.isOptional = true; this.isOptional = true;
} }
} }
this.combined = this.name; this.combined = this.name;
if (this.isOptional) if (this.isOptional) {
this.combined += "?"; this.combined += '?';
}
this.combined += ": `" + this.type + "`"; this.combined += ": `" + this.type + "`";
if (this.defaultValue !== "") if (this.defaultValue !== '') {
this.combined += " = `" + this.defaultValue + "`"; this.combined += " = `" + this.defaultValue + "`";
}
} }
return ParamInfo; return ParamInfo;
}()); }());
@@ -86,16 +89,16 @@ var MethodSigInfo = /** @class */ (function () {
var _this = this; var _this = this;
this.errorMessages = []; this.errorMessages = [];
this.name = sourceData.name; this.name = sourceData.name;
this.docText = sourceData.summary || ""; this.docText = sourceData.summary || '';
this.docText = this.docText.replace(/[\n\r]+/g, " ").trim(); this.docText = this.docText.replace(/[\n\r]+/g, ' ').trim();
if (!this.docText) { if (!this.docText) {
this.errorMessages.push("Warning: method \"" + sourceData.name + "\" has no doc text."); this.errorMessages.push("Warning: method \"" + sourceData.name + "\" has no doc text.");
} }
this.returnType = sourceData.syntax["return"].type || ""; this.returnType = sourceData.syntax['return'].type || '';
this.returnType = this.returnType.toString().replace(/\s/g, ""); this.returnType = this.returnType.toString().replace(/\s/g, '');
this.returnsSomething = this.returnType && (this.returnType !== "void"); this.returnsSomething = this.returnType && (this.returnType !== 'void');
this.returnDocText = sourceData.syntax["return"].summary || ""; this.returnDocText = sourceData.syntax['return'].summary || '';
if (this.returnDocText.toLowerCase() === "nothing") { if (this.returnDocText.toLowerCase() === 'nothing') {
this.returnsSomething = false; this.returnsSomething = false;
} }
if (this.returnsSomething && !this.returnDocText) { if (this.returnsSomething && !this.returnDocText) {
@@ -103,10 +106,10 @@ var MethodSigInfo = /** @class */ (function () {
} }
this.isDeprecated = false; this.isDeprecated = false;
if (sourceData.tags) { if (sourceData.tags) {
var depTag = sourceData.tags.find(function (tag) { return tag.name === "deprecated"; }); var depTag = sourceData.tags.find(function (tag) { return tag.name === 'deprecated'; });
if (depTag) { if (depTag) {
this.isDeprecated = true; this.isDeprecated = true;
this.docText = "(**Deprecated:** " + depTag.text.replace(/[\n\r]+/g, " ").trim() + ") " + this.docText; this.docText = '(**Deprecated:** ' + depTag.text.replace(/[\n\r]+/g, ' ').trim() + ') ' + this.docText;
} }
} }
this.params = []; this.params = [];
@@ -121,7 +124,7 @@ var MethodSigInfo = /** @class */ (function () {
paramStrings.push(param.combined); paramStrings.push(param.combined);
}); });
} }
this.signature = "(" + paramStrings.join(", ") + ")"; this.signature = '(' + paramStrings.join(', ') + ')';
} }
Object.defineProperty(MethodSigInfo.prototype, "errors", { Object.defineProperty(MethodSigInfo.prototype, "errors", {
get: function () { get: function () {
@@ -150,8 +153,8 @@ var ComponentInfo = /** @class */ (function () {
this.methods = []; this.methods = [];
sourceData.items.forEach(function (item) { sourceData.items.forEach(function (item) {
switch (item.type) { switch (item.type) {
case "property": case 'property':
case "accessor": case 'accessor':
var prop = new PropInfo(item); var prop = new PropInfo(item);
_this.properties.push(prop); _this.properties.push(prop);
if (prop.isInput) { if (prop.isInput) {
@@ -161,11 +164,11 @@ var ComponentInfo = /** @class */ (function () {
_this.hasOutputs = true; _this.hasOutputs = true;
} }
break; break;
case "method": case 'method':
if (item.flags && (item.flags.length > 0) && if (item.flags && (item.flags.length > 0) &&
!item.flags.find(function (flag) { return flag.name === "isPrivate"; }) && !item.flags.find(function (flag) { return flag.name === 'isPrivate'; }) &&
!item.flags.find(function (flag) { return flag.name === "isProtected"; }) && !item.flags.find(function (flag) { return flag.name === 'isProtected'; }) &&
!undocMethodNames[item.name]) { !skipMethodNames.includes(item.name)) {
_this.methods.push(new MethodSigInfo(item)); _this.methods.push(new MethodSigInfo(item));
_this.hasMethods = true; _this.hasMethods = true;
} }

View File

@@ -1,8 +1,9 @@
let undocMethodNames = { const skipMethodNames = [
"ngOnChanges": 1 'ngOnChanges',
}; 'ngOnDestroy',
'ngOnInit'
];
export class PropInfo { export class PropInfo {
name: string; name: string;
type: string; type: string;
@@ -15,26 +16,25 @@ export class PropInfo {
errorMessages: string[]; errorMessages: string[];
constructor(sourceData) { constructor(sourceData) {
this.errorMessages = []; this.errorMessages = [];
this.name = sourceData.name; this.name = sourceData.name;
this.docText = sourceData.summary || ""; this.docText = sourceData.summary || '';
this.docText = this.docText.replace(/[\n\r]+/g, " ").trim(); this.docText = this.docText.replace(/[\n\r]+/g, ' ').trim();
let tempDefaultVal = sourceData.syntax["return"].defaultValue; const tempDefaultVal = sourceData.syntax['return'].defaultValue;
this.defaultValue = tempDefaultVal ? tempDefaultVal.toString() : ""; this.defaultValue = tempDefaultVal ? tempDefaultVal.toString() : '';
this.defaultValue = this.defaultValue.replace(/\|/, "\\|"); this.defaultValue = this.defaultValue.replace(/\|/, '\\|');
this.type = sourceData.syntax["return"].type || ""; this.type = sourceData.syntax['return'].type || '';
this.type = this.type.toString().replace(/\|/, "\\|"); this.type = this.type.toString().replace(/\|/, '\\|');
if (sourceData.tags) { if (sourceData.tags) {
let depTag = sourceData.tags.find(tag => tag.name === "deprecated"); const depTag = sourceData.tags.find(tag => tag.name === 'deprecated');
if (depTag) { if (depTag) {
this.isDeprecated = true; this.isDeprecated = true;
this.docText = "(**Deprecated:** " + depTag.text.replace(/[\n\r]+/g, " ").trim() + ") " + this.docText; this.docText = '(**Deprecated:** ' + depTag.text.replace(/[\n\r]+/g, ' ').trim() + ') ' + this.docText;
} }
} }
@@ -43,23 +43,23 @@ export class PropInfo {
if (sourceData.decorators) { if (sourceData.decorators) {
sourceData.decorators.forEach(dec => { sourceData.decorators.forEach(dec => {
//console.log(dec); if (dec.name === 'Input') {
if (dec.name === "Input") {
this.isInput = true; this.isInput = true;
if (dec.arguments) { if (dec.arguments) {
let bindingName = dec.arguments["bindingPropertyName"]; const bindingName = dec.arguments['bindingPropertyName'];
if (bindingName && (bindingName !== "")) if (bindingName && (bindingName !== '')) {
this.name = bindingName.replace(/['"]/g, ""); this.name = bindingName.replace(/['"]/g, '');
}
} }
if (!this.docText && !this.isDeprecated) { if (!this.docText && !this.isDeprecated) {
this.errorMessages.push(`Warning: Input "${sourceData.name}" has no doc text.`); this.errorMessages.push(`Warning: Input "${sourceData.name}" has no doc text.`);
} }
} }
if (dec.name === "Output") { if (dec.name === 'Output') {
this.isOutput = true; this.isOutput = true;
if (!this.docText && !this.isDeprecated) { if (!this.docText && !this.isDeprecated) {
@@ -73,8 +73,7 @@ export class PropInfo {
get errors() { get errors() {
return this.errorMessages; return this.errorMessages;
} }
}; }
export class ParamInfo { export class ParamInfo {
name: string; name: string;
@@ -84,17 +83,16 @@ export class ParamInfo {
combined: string; combined: string;
isOptional: boolean; isOptional: boolean;
constructor(sourceData) { constructor(sourceData) {
this.name = sourceData.id; this.name = sourceData.id;
this.type = sourceData.type.toString().replace(/\s/g, ""); this.type = sourceData.type.toString().replace(/\s/g, '');
this.defaultValue = sourceData.defaultValue; this.defaultValue = sourceData.defaultValue;
this.docText = sourceData.description.replace(/[\n\r]+/g, " ").trim(); this.docText = sourceData.description.replace(/[\n\r]+/g, ' ').trim();
this.isOptional = false; this.isOptional = false;
if (sourceData.flags) { if (sourceData.flags) {
let flag = sourceData.flags.find(flag => flag.name === "isOptional"); const flag = sourceData.flags.find((sourceFlag: any) => sourceFlag.name === 'isOptional');
if (flag) { if (flag) {
this.isOptional = true; this.isOptional = true;
@@ -103,17 +101,18 @@ export class ParamInfo {
this.combined = this.name; this.combined = this.name;
if (this.isOptional) if (this.isOptional) {
this.combined += "?"; this.combined += '?';
}
this.combined += `: \`${this.type}\``; this.combined += `: \`${this.type}\``;
if (this.defaultValue !== "") if (this.defaultValue !== '') {
this.combined += ` = \`${this.defaultValue}\``; this.combined += ` = \`${this.defaultValue}\``;
}
} }
} }
export class MethodSigInfo { export class MethodSigInfo {
name: string; name: string;
docText: string; docText: string;
@@ -123,28 +122,26 @@ export class MethodSigInfo {
signature: string; signature: string;
params: ParamInfo[]; params: ParamInfo[];
isDeprecated: boolean; isDeprecated: boolean;
errorMessages: string[]; errorMessages: string[];
constructor(sourceData) { constructor(sourceData) {
this.errorMessages = []; this.errorMessages = [];
this.name = sourceData.name; this.name = sourceData.name;
this.docText = sourceData.summary || ""; this.docText = sourceData.summary || '';
this.docText = this.docText.replace(/[\n\r]+/g, " ").trim(); this.docText = this.docText.replace(/[\n\r]+/g, ' ').trim();
if (!this.docText) { if (!this.docText) {
this.errorMessages.push(`Warning: method "${sourceData.name}" has no doc text.`); this.errorMessages.push(`Warning: method "${sourceData.name}" has no doc text.`);
} }
this.returnType = sourceData.syntax["return"].type || ""; this.returnType = sourceData.syntax['return'].type || '';
this.returnType = this.returnType.toString().replace(/\s/g, ""); this.returnType = this.returnType.toString().replace(/\s/g, '');
this.returnsSomething = this.returnType && (this.returnType !== "void"); this.returnsSomething = this.returnType && (this.returnType !== 'void');
this.returnDocText = sourceData.syntax["return"].summary || ""; this.returnDocText = sourceData.syntax['return'].summary || '';
if (this.returnDocText.toLowerCase() === "nothing") { if (this.returnDocText.toLowerCase() === 'nothing') {
this.returnsSomething = false; this.returnsSomething = false;
} }
@@ -155,16 +152,16 @@ export class MethodSigInfo {
this.isDeprecated = false; this.isDeprecated = false;
if (sourceData.tags) { if (sourceData.tags) {
let depTag = sourceData.tags.find(tag => tag.name === "deprecated"); const depTag = sourceData.tags.find(tag => tag.name === 'deprecated');
if (depTag) { if (depTag) {
this.isDeprecated = true; this.isDeprecated = true;
this.docText = "(**Deprecated:** " + depTag.text.replace(/[\n\r]+/g, " ").trim() + ") " + this.docText; this.docText = '(**Deprecated:** ' + depTag.text.replace(/[\n\r]+/g, ' ').trim() + ') ' + this.docText;
} }
} }
this.params = []; this.params = [];
let paramStrings = []; const paramStrings = [];
if (sourceData.syntax.parameters) { if (sourceData.syntax.parameters) {
sourceData.syntax.parameters.forEach(rawParam => { sourceData.syntax.parameters.forEach(rawParam => {
@@ -172,13 +169,13 @@ export class MethodSigInfo {
this.errorMessages.push(`Warning: parameter "${rawParam.name}" of method "${sourceData.name}" has no doc text.`); this.errorMessages.push(`Warning: parameter "${rawParam.name}" of method "${sourceData.name}" has no doc text.`);
} }
let param = new ParamInfo(rawParam); const param = new ParamInfo(rawParam);
this.params.push(param); this.params.push(param);
paramStrings.push(param.combined); paramStrings.push(param.combined);
}); });
} }
this.signature = "(" + paramStrings.join(", ") + ")"; this.signature = '(' + paramStrings.join(', ') + ')';
} }
get errors() { get errors() {
@@ -186,7 +183,6 @@ export class MethodSigInfo {
} }
} }
export class ComponentInfo { export class ComponentInfo {
name: string; name: string;
itemType: string; itemType: string;
@@ -198,7 +194,6 @@ export class ComponentInfo {
sourcePath: string; sourcePath: string;
sourceLine: number; sourceLine: number;
constructor(sourceData) { constructor(sourceData) {
this.name = sourceData.items[0].name; this.name = sourceData.items[0].name;
this.itemType = sourceData.items[0].type; this.itemType = sourceData.items[0].type;
@@ -213,15 +208,15 @@ export class ComponentInfo {
if (this.itemType === 'type alias') { if (this.itemType === 'type alias') {
return; return;
} }
this.properties = []; this.properties = [];
this.methods = []; this.methods = [];
sourceData.items.forEach(item => { sourceData.items.forEach(item => {
switch(item.type) { switch (item.type) {
case "property": case 'property':
case "accessor": case 'accessor':
var prop = new PropInfo(item); const prop = new PropInfo(item);
this.properties.push(prop); this.properties.push(prop);
if (prop.isInput) { if (prop.isInput) {
@@ -232,12 +227,12 @@ export class ComponentInfo {
this.hasOutputs = true; this.hasOutputs = true;
} }
break; break;
case "method": case 'method':
if (item.flags && (item.flags.length > 0) && if (item.flags && (item.flags.length > 0) &&
!item.flags.find(flag => flag.name === "isPrivate") && !item.flags.find(flag => flag.name === 'isPrivate') &&
!item.flags.find(flag => flag.name === "isProtected") && !item.flags.find(flag => flag.name === 'isProtected') &&
!undocMethodNames[item.name] !skipMethodNames.includes(item.name)
) { ) {
this.methods.push(new MethodSigInfo(item)); this.methods.push(new MethodSigInfo(item));
this.hasMethods = true; this.hasMethods = true;
@@ -250,14 +245,13 @@ export class ComponentInfo {
}); });
} }
get errors() { get errors() {
let combinedErrors = []; const combinedErrors = [];
this.methods.forEach(method => { this.methods.forEach(method => {
method.errors.forEach(err => { method.errors.forEach(err => {
combinedErrors.push(err); combinedErrors.push(err);
}) });
}); });
this.properties.forEach(prop => { this.properties.forEach(prop => {

View File

@@ -1,15 +1,15 @@
import * as fs from "fs"; import * as fs from 'fs';
/* "Stoplist" of regular expressions to match against strings. */ /* "Stoplist" of regular expressions to match against strings. */
export class Stoplist { export class Stoplist {
regexes: RegExp[]; regexes: RegExp[];
constructor(slFilePath: string) { constructor(slFilePath: string) {
let listExpressions = JSON.parse(fs.readFileSync(slFilePath, 'utf8')); const listExpressions = JSON.parse(fs.readFileSync(slFilePath, 'utf8'));
this.regexes = []; this.regexes = [];
if (listExpressions) { if (listExpressions) {
for (var i = 0; i < listExpressions.length; i++) { for (let i = 0; i < listExpressions.length; i++) {
this.regexes.push(new RegExp(listExpressions[i])); this.regexes.push(new RegExp(listExpressions[i]));
} }
} else { } else {
@@ -19,13 +19,13 @@ export class Stoplist {
// Check if an item is covered by the stoplist and reject it if so. // Check if an item is covered by the stoplist and reject it if so.
isRejected(itemName: string) { isRejected(itemName: string) {
for (var i = 0; i < this.regexes.length; i++) { for (let i = 0; i < this.regexes.length; i++) {
if (this.regexes[i].test(itemName)) { if (this.regexes[i].test(itemName)) {
return true; return true;
} }
} }
return false; return false;
} }
} }

View File

@@ -1,4 +1,5 @@
"use strict"; "use strict";
// tslint:disable: no-console
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var path = require("path"); var path = require("path");
var fs = require("fs"); var fs = require("fs");
@@ -16,7 +17,7 @@ function processDocs(mdCache, aggData, errorMessages) {
var linkRefs = {}; var linkRefs = {};
var imageRefs = {}; var imageRefs = {};
var brokenImageRefs = {}; var brokenImageRefs = {};
var filters = makeFilepathFilters(aggData.config["fileCheckerFilter"]); var filters = makeFilepathFilters(aggData.config['fileCheckerFilter']);
pathnames.forEach(function (pathname) { pathnames.forEach(function (pathname) {
var fileBaseName = path.basename(pathname, '.md'); var fileBaseName = path.basename(pathname, '.md');
var tree = mdCache[pathname].mdOutTree; var tree = mdCache[pathname].mdOutTree;
@@ -86,8 +87,8 @@ function getImagePaths(imageFolder) {
var files = fs.readdirSync(imageFolder); var files = fs.readdirSync(imageFolder);
return files.map(function (f) { return path.resolve(imageFolder, f); }); return files.map(function (f) { return path.resolve(imageFolder, f); });
} }
function makeFilepathFilters(regexes) { function makeFilepathFilters(patterns) {
return regexes.map(function (r) { return new RegExp(r); }); return patterns.map(function (r) { return new RegExp(r); });
} }
function filterFilepath(filters, filepath) { function filterFilepath(filters, filepath) {
for (var i = 0; i < filters.length; i++) { for (var i = 0; i < filters.length; i++) {

View File

@@ -1,11 +1,10 @@
import * as path from "path"; // tslint:disable: no-console
import * as fs from "fs";
import { select, selectAll } from "unist-util-select"; import * as path from 'path';
import * as fs from 'fs';
import * as lev from "fast-levenshtein"; import { selectAll } from 'unist-util-select';
import * as lev from 'fast-levenshtein';
import * as ngHelpers from "../ngHelpers"; import * as ngHelpers from '../ngHelpers';
const imageFolderPath = path.resolve('docs', 'docassets', 'images'); const imageFolderPath = path.resolve('docs', 'docassets', 'images');
@@ -15,39 +14,39 @@ const imageFolderPath = path.resolve('docs', 'docassets', 'images');
const maxImagePathLevDistance = 7; const maxImagePathLevDistance = 7;
export function processDocs(mdCache, aggData, errorMessages) { export function processDocs(mdCache, aggData, errorMessages) {
var pathnames = Object.keys(mdCache); const pathnames = Object.keys(mdCache);
let classlessDocs = []; const classlessDocs = [];
let linkRefs = {}; const linkRefs = {};
let imageRefs = {}; const imageRefs = {};
let brokenImageRefs = {}; const brokenImageRefs = {};
let filters = makeFilepathFilters(aggData.config["fileCheckerFilter"]); const filters = makeFilepathFilters(aggData.config['fileCheckerFilter']);
pathnames.forEach(pathname => { pathnames.forEach(pathname => {
let fileBaseName = path.basename(pathname, '.md'); const fileBaseName = path.basename(pathname, '.md');
let tree = mdCache[pathname].mdOutTree; const tree = mdCache[pathname].mdOutTree;
let className = ngHelpers.ngNameToClassName(fileBaseName, aggData.config.typeNameExceptions); const className = ngHelpers.ngNameToClassName(fileBaseName, aggData.config.typeNameExceptions);
let classInfo = aggData.classInfo[className]; const classInfo = aggData.classInfo[className];
if (!classInfo) { if (!classInfo) {
if (!filterFilepath(filters, pathname)) { if (!filterFilepath(filters, pathname)) {
classlessDocs.push(pathname); classlessDocs.push(pathname);
} }
} else { } else {
let linkElems = selectAll('link', tree); const linkElems = selectAll('link', tree);
linkElems.forEach(linkElem => { linkElems.forEach(linkElem => {
let normUrl = normaliseLinkPath(pathname, linkElem.url); const normUrl = normaliseLinkPath(pathname, linkElem.url);
multiSetAdd(linkRefs, normUrl, pathname); multiSetAdd(linkRefs, normUrl, pathname);
}); });
} }
let imageElems = selectAll('image', tree); const imageElems = selectAll('image', tree);
imageElems.forEach(imageElem => { imageElems.forEach(imageElem => {
let normUrl = normaliseLinkPath(pathname, imageElem.url); const normUrl = normaliseLinkPath(pathname, imageElem.url);
multiSetAdd(imageRefs, normUrl, pathname); multiSetAdd(imageRefs, normUrl, pathname);
if (!fs.existsSync(normUrl)) { if (!fs.existsSync(normUrl)) {
@@ -57,12 +56,12 @@ export function processDocs(mdCache, aggData, errorMessages) {
}); });
classlessDocs.forEach(docPath => { classlessDocs.forEach(docPath => {
let relDocPath = docPath.substring(docPath.indexOf('docs')); const relDocPath = docPath.substring(docPath.indexOf('docs'));
console.group(`Warning: no source class found for "${relDocPath}"`); console.group(`Warning: no source class found for "${relDocPath}"`);
if (linkRefs[docPath]) { if (linkRefs[docPath]) {
linkRefs[docPath].forEach(linkRef => { linkRefs[docPath].forEach(linkRef => {
let relLinkPath = linkRef.substring(linkRef.indexOf('docs')); const relLinkPath = linkRef.substring(linkRef.indexOf('docs'));
console.log(`Linked from: "${relLinkPath}"`); console.log(`Linked from: "${relLinkPath}"`);
}); });
} }
@@ -72,28 +71,28 @@ export function processDocs(mdCache, aggData, errorMessages) {
console.log(); console.log();
let imagePaths = getImagePaths(imageFolderPath); const imagePaths = getImagePaths(imageFolderPath);
imagePaths.forEach(imagePath => { imagePaths.forEach(imagePath => {
if (!imageRefs[imagePath]) { if (!imageRefs[imagePath]) {
let relImagePath = imagePath.substring(imagePath.indexOf('docs')); const relImagePath = imagePath.substring(imagePath.indexOf('docs'));
console.log(`Warning: no links to image file "${relImagePath}"`); console.log(`Warning: no links to image file "${relImagePath}"`);
} }
}); });
console.log(); console.log();
let brokenImUrls = Object.keys(brokenImageRefs); const brokenImUrls = Object.keys(brokenImageRefs);
brokenImUrls.forEach(url => { brokenImUrls.forEach(url => {
let relUrl = url.substring(url.indexOf('docs')); const relUrl = url.substring(url.indexOf('docs'));
let relDocPath = brokenImageRefs[url].substring(brokenImageRefs[url].indexOf('docs')); const relDocPath = brokenImageRefs[url].substring(brokenImageRefs[url].indexOf('docs'));
console.group(`Broken image link "${relUrl}" found in "${relDocPath}`); console.group(`Broken image link "${relUrl}" found in "${relDocPath}`);
imagePaths.forEach(imPath => { imagePaths.forEach(imPath => {
if (lev.get(imPath, url) <= maxImagePathLevDistance) { if (lev.get(imPath, url) <= maxImagePathLevDistance) {
let relImPath = imPath.substring(imPath.indexOf('docs')); const relImPath = imPath.substring(imPath.indexOf('docs'));
console.log(`Should it be "${relImPath}"?`) console.log(`Should it be "${relImPath}"?`);
} }
}); });
@@ -101,34 +100,29 @@ export function processDocs(mdCache, aggData, errorMessages) {
}); });
} }
function normaliseLinkPath(homeFilePath, linkUrl) { function normaliseLinkPath(homeFilePath, linkUrl) {
let homeFolder = path.dirname(homeFilePath); const homeFolder = path.dirname(homeFilePath);
return path.resolve(homeFolder, linkUrl); return path.resolve(homeFolder, linkUrl);
} }
function getImagePaths(imageFolder) { function getImagePaths(imageFolder) {
let files = fs.readdirSync(imageFolder); const files = fs.readdirSync(imageFolder);
return files.map(f => path.resolve(imageFolder, f)); return files.map(f => path.resolve(imageFolder, f));
} }
function makeFilepathFilters(patterns: string[]) {
function makeFilepathFilters(regexes: string[]) { return patterns.map(r => new RegExp(r));
return regexes.map(r => new RegExp(r));
} }
function filterFilepath(filters: RegExp[], filepath: string): boolean { function filterFilepath(filters: RegExp[], filepath: string): boolean {
for (let i = 0; i < filters.length; i++) { for (let i = 0; i < filters.length; i++) {
if (filters[i].test(filepath)) { if (filters[i].test(filepath)) {
return true return true;
} }
} }
return false; return false;
} }
function multiSetAdd(container: {}, key: string, value: string) { function multiSetAdd(container: {}, key: string, value: string) {
if (container[key]) { if (container[key]) {
container[key].push(value); container[key].push(value);

View File

@@ -1,4 +1,5 @@
"use strict"; "use strict";
// tslint:disable: no-console
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var fs = require("fs"); var fs = require("fs");
var path = require("path"); var path = require("path");
@@ -21,7 +22,7 @@ function processDocs(mdCache, aggData) {
var indexFilePath = path.resolve(aggData['rootFolder'], 'docs', 'README.md'); var indexFilePath = path.resolve(aggData['rootFolder'], 'docs', 'README.md');
var indexFileText = fs.readFileSync(indexFilePath, 'utf8'); var indexFileText = fs.readFileSync(indexFilePath, 'utf8');
var indexMD = remark() var indexMD = remark()
.use(frontMatter, ["yaml"]) .use(frontMatter, ['yaml'])
.parse(indexFileText); .parse(indexFileText);
var schema = graphql_1.buildSchema(MQ.schema); var schema = graphql_1.buildSchema(MQ.schema);
libNamesList.forEach(function (libName) { libNamesList.forEach(function (libName) {
@@ -31,7 +32,7 @@ function processDocs(mdCache, aggData) {
console.log(JSON.stringify(response)); console.log(JSON.stringify(response));
} }
else { else {
//console.log(template(response['data'])); // console.log(template(response['data']));
var newSection_1 = remark().parse(template(response['data'])).children; var newSection_1 = remark().parse(template(response['data'])).children;
replaceZone(indexMD, libName, function (start, _oldZone, end) { replaceZone(indexMD, libName, function (start, _oldZone, end) {
newSection_1.unshift(start); newSection_1.unshift(start);
@@ -40,7 +41,7 @@ function processDocs(mdCache, aggData) {
}); });
var outText = remark() var outText = remark()
.use(frontMatter, { type: 'yaml', fence: '---' }) .use(frontMatter, { type: 'yaml', fence: '---' })
.data("settings", { paddedTable: false, gfm: false }) .data('settings', { paddedTable: false, gfm: false })
.stringify(indexMD); .stringify(indexMD);
fs.writeFileSync(indexFilePath, outText); fs.writeFileSync(indexFilePath, outText);
} }

View File

@@ -1,23 +1,20 @@
// tslint:disable: no-console
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
import * as ejs from 'ejs'; import * as ejs from 'ejs';
import * as remark from 'remark'; import * as remark from 'remark';
import * as frontMatter from 'remark-frontmatter'; import * as frontMatter from 'remark-frontmatter';
import * as replaceZone from 'mdast-zone'; import * as replaceZone from 'mdast-zone';
import { graphql, buildSchema } from 'graphql'; import { graphql, buildSchema } from 'graphql';
import * as MQ from '../mqDefs'; import * as MQ from '../mqDefs';
let libNamesList = [ const libNamesList = [
'content-services', 'core', 'extensions', 'content-services', 'core', 'extensions',
'insights', 'process-services', 'process-services-cloud' 'insights', 'process-services', 'process-services-cloud'
]; ];
const query = `
let query = `
query libIndex($libName: String) { query libIndex($libName: String) {
documents(idFilter: $libName) { documents(idFilter: $libName) {
title: metadata(key: "Title") title: metadata(key: "Title")
@@ -36,21 +33,20 @@ let query = `
} }
`; `;
export function processDocs(mdCache, aggData) { export function processDocs(mdCache, aggData) {
let docset: MQ.Docset = new MQ.Docset(mdCache); const docset: MQ.Docset = new MQ.Docset(mdCache);
let templateFilePath = path.resolve(__dirname, '..', 'templates', 'gqIndex.ejs'); const templateFilePath = path.resolve(__dirname, '..', 'templates', 'gqIndex.ejs');
let templateSource = fs.readFileSync(templateFilePath, 'utf8'); const templateSource = fs.readFileSync(templateFilePath, 'utf8');
let template = ejs.compile(templateSource); const template = ejs.compile(templateSource);
let indexFilePath = path.resolve(aggData['rootFolder'], 'docs', 'README.md'); const indexFilePath = path.resolve(aggData['rootFolder'], 'docs', 'README.md');
let indexFileText = fs.readFileSync(indexFilePath, 'utf8'); const indexFileText = fs.readFileSync(indexFilePath, 'utf8');
let indexMD = remark() const indexMD = remark()
.use(frontMatter, ["yaml"]) .use(frontMatter, ['yaml'])
.parse(indexFileText); .parse(indexFileText);
let schema = buildSchema(MQ.schema); const schema = buildSchema(MQ.schema);
libNamesList.forEach(libName => { libNamesList.forEach(libName => {
graphql(schema, query, docset, null, {'libName': libName}) graphql(schema, query, docset, null, {'libName': libName})
@@ -58,8 +54,8 @@ export function processDocs(mdCache, aggData) {
if (!response['data']) { if (!response['data']) {
console.log(JSON.stringify(response)); console.log(JSON.stringify(response));
} else { } else {
//console.log(template(response['data'])); // console.log(template(response['data']));
let newSection = remark().parse(template(response['data'])).children; const newSection = remark().parse(template(response['data'])).children;
replaceZone(indexMD, libName, (start, _oldZone, end) => { replaceZone(indexMD, libName, (start, _oldZone, end) => {
newSection.unshift(start); newSection.unshift(start);
@@ -67,9 +63,9 @@ export function processDocs(mdCache, aggData) {
return newSection; return newSection;
}); });
let outText = remark() const outText = remark()
.use(frontMatter, {type: 'yaml', fence: '---'}) .use(frontMatter, {type: 'yaml', fence: '---'})
.data("settings", {paddedTable: false, gfm: false}) .data('settings', {paddedTable: false, gfm: false})
.stringify(indexMD); .stringify(indexMD);
fs.writeFileSync(indexFilePath, outText); fs.writeFileSync(indexFilePath, outText);
@@ -77,7 +73,4 @@ export function processDocs(mdCache, aggData) {
}); });
}); });
} }

View File

@@ -1,4 +1,5 @@
"use strict"; "use strict";
// tslint:disable: no-console
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var path = require("path"); var path = require("path");
var fs = require("fs"); var fs = require("fs");

View File

@@ -1,38 +1,38 @@
// tslint:disable: no-console
import * as path from 'path'; import * as path from 'path';
import * as fs from 'fs'; import * as fs from 'fs';
import { selectAll } from 'unist-util-select'; import { selectAll } from 'unist-util-select';
import { MDAST } from 'mdast'; import { MDAST } from 'mdast';
const suffixesNotToCheck = /\.ts/; const suffixesNotToCheck = /\.ts/;
export function processDocs(mdCache, aggData, errorMessages) { export function processDocs(mdCache, aggData, errorMessages) {
var pathnames = Object.keys(mdCache); const pathnames = Object.keys(mdCache);
let linkSet = new LinkSet(pathnames); const linkSet = new LinkSet(pathnames);
let imageFolderPath = path.resolve(aggData['rootFolder'], 'docs', 'docassets', 'images'); const imageFolderPath = path.resolve(aggData['rootFolder'], 'docs', 'docassets', 'images');
let imageSet = new LinkSet(getImagePaths(imageFolderPath)); const imageSet = new LinkSet(getImagePaths(imageFolderPath));
pathnames.forEach(pathname => { pathnames.forEach(pathname => {
let tree = mdCache[pathname].mdOutTree; const tree = mdCache[pathname].mdOutTree;
fixUrls(tree, pathname, linkSet, 'link'); fixUrls(tree, pathname, linkSet, 'link');
fixUrls(tree, pathname, imageSet, 'image'); fixUrls(tree, pathname, imageSet, 'image');
}); });
} }
function fixUrls(tree: MDAST.Root, docFilePath: string, linkSet: LinkSet, selector: string) { function fixUrls(tree: MDAST.Root, docFilePath: string, linkSet: LinkSet, selector: string) {
let linksInDoc = selectAll(selector, tree); const linksInDoc = selectAll(selector, tree);
let errors: string[] = []; const errors: string[] = [];
linksInDoc.forEach(linkElem => { linksInDoc.forEach(linkElem => {
let origFullUrlPath = path.resolve(path.dirname(docFilePath), linkElem.url); let origFullUrlPath = path.resolve(path.dirname(docFilePath), linkElem.url);
let hashPos = origFullUrlPath.indexOf('#'); const hashPos = origFullUrlPath.indexOf('#');
let anchor = ''; let anchor = '';
if (hashPos !== -1) { if (hashPos !== -1) {
@@ -45,8 +45,8 @@ function fixUrls(tree: MDAST.Root, docFilePath: string, linkSet: LinkSet, select
(origFullUrlPath !== '') && (origFullUrlPath !== '') &&
!fs.existsSync(origFullUrlPath) !fs.existsSync(origFullUrlPath)
) { ) {
let newUrl = linkSet.update(origFullUrlPath) || origFullUrlPath; const newUrl = linkSet.update(origFullUrlPath) || origFullUrlPath;
linkElem.url = path.relative(path.dirname(docFilePath), newUrl).replace(/\\/g,'/') + anchor; linkElem.url = path.relative(path.dirname(docFilePath), newUrl).replace(/\\/g, '/') + anchor;
errors.push(`Bad link: ${origFullUrlPath}\nReplacing with ${linkElem.url}`); errors.push(`Bad link: ${origFullUrlPath}\nReplacing with ${linkElem.url}`);
} /*else { } /*else {
console.log(`Link OK: ${origFullUrlPath}`); console.log(`Link OK: ${origFullUrlPath}`);
@@ -59,7 +59,6 @@ function fixUrls(tree: MDAST.Root, docFilePath: string, linkSet: LinkSet, select
} }
} }
function showMessages(groupName: string, messages: string[]) { function showMessages(groupName: string, messages: string[]) {
console.group(groupName); console.group(groupName);
@@ -75,7 +74,6 @@ function getImagePaths(imageFolderPath: string): string[] {
.map(imageFileName => path.resolve(imageFolderPath, imageFileName)); .map(imageFileName => path.resolve(imageFolderPath, imageFileName));
} }
class LinkSet { class LinkSet {
links: Map<string, string[]>; links: Map<string, string[]>;
@@ -83,10 +81,10 @@ class LinkSet {
this.links = new Map(); this.links = new Map();
urls.forEach(url => { urls.forEach(url => {
let fileName = path.basename(url); const fileName = path.basename(url);
if (this.links.has(fileName)) { if (this.links.has(fileName)) {
let item = this.links.get(fileName); const item = this.links.get(fileName);
item.push(url); item.push(url);
} else { } else {
this.links.set(fileName, [url]); this.links.set(fileName, [url]);
@@ -95,12 +93,12 @@ class LinkSet {
} }
update(oldUrl: string): string { update(oldUrl: string): string {
let oldFileName = path.basename(oldUrl); const oldFileName = path.basename(oldUrl);
if (!this.links.has(oldFileName)) { if (!this.links.has(oldFileName)) {
return ''; return '';
} else { } else {
let candidates = this.links.get(oldFileName); const candidates = this.links.get(oldFileName);
if (candidates.length === 1) { if (candidates.length === 1) {
return candidates[0]; return candidates[0];

View File

@@ -1,5 +0,0 @@
import { select, selectAll } from "unist-util-select";
export function processDocs(mdCache, aggData, errorMessages) {
}

View File

@@ -1,5 +1,5 @@
"use strict"; "use strict";
exports.__esModule = true; Object.defineProperty(exports, "__esModule", { value: true });
var path = require("path"); var path = require("path");
var unist_util_select_1 = require("unist-util-select"); var unist_util_select_1 = require("unist-util-select");
var ngHelpers = require("../ngHelpers"); var ngHelpers = require("../ngHelpers");
@@ -18,7 +18,7 @@ function processDocs(mdCache, aggData) {
var titleHeading = unist_util_select_1.select('heading[depth=1]:first-of-type', tree); var titleHeading = unist_util_select_1.select('heading[depth=1]:first-of-type', tree);
var relDocPath = pathname.substring(pathname.indexOf('docs')); var relDocPath = pathname.substring(pathname.indexOf('docs'));
var srcUrl = fixRelSrcUrl(relDocPath, sourcePath); var srcUrl = fixRelSrcUrl(relDocPath, sourcePath);
if (titleHeading && titleHeading.children[0] && titleHeading.children[0].type === "text") { if (titleHeading && titleHeading.children[0] && titleHeading.children[0].type === 'text') {
var titleText = titleHeading.children[0]; var titleText = titleHeading.children[0];
titleHeading.children[0] = { titleHeading.children[0] = {
type: 'link', type: 'link',
@@ -27,9 +27,9 @@ function processDocs(mdCache, aggData) {
children: [titleText] children: [titleText]
}; };
} }
else if ((titleHeading && titleHeading.children[0].type === "link") && sourcePath) { else if ((titleHeading && titleHeading.children[0].type === 'link') && sourcePath) {
var linkElem = titleHeading.children[0]; var linkElem = titleHeading.children[0];
linkElem.url = srcUrl, linkElem.url = srcUrl, // `../../${sourcePath}`;
linkElem.title = "Defined in " + path.basename(sourcePath); linkElem.title = "Defined in " + path.basename(sourcePath);
} }
}); });

View File

@@ -1,48 +1,45 @@
import * as path from "path"; import * as path from 'path';
import { select } from 'unist-util-select';
import { select } from "unist-util-select"; import * as ngHelpers from '../ngHelpers';
import * as ngHelpers from "../ngHelpers";
const angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(dialog)|(directive)|(interface)|(model)|(pipe)|(service)|(widget))/; const angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(dialog)|(directive)|(interface)|(model)|(pipe)|(service)|(widget))/;
export function processDocs(mdCache, aggData) { export function processDocs(mdCache, aggData) {
var pathnames = Object.keys(mdCache); const pathnames = Object.keys(mdCache);
pathnames.forEach(pathname => { pathnames.forEach(pathname => {
let fileBaseName = path.basename(pathname, '.md'); const fileBaseName = path.basename(pathname, '.md');
if (!fileBaseName.match(angFilenameRegex)) { if (!fileBaseName.match(angFilenameRegex)) {
return; return;
} }
let tree = mdCache[pathname].mdOutTree; const tree = mdCache[pathname].mdOutTree;
let className = ngHelpers.ngNameToClassName(fileBaseName, aggData.config.typeNameExceptions); const className = ngHelpers.ngNameToClassName(fileBaseName, aggData.config.typeNameExceptions);
let classInfo = aggData.classInfo[className]; const classInfo = aggData.classInfo[className];
let sourcePath = classInfo ? classInfo.sourcePath : ''; const sourcePath = classInfo ? classInfo.sourcePath : '';
let titleHeading = select('heading[depth=1]:first-of-type', tree); const titleHeading = select('heading[depth=1]:first-of-type', tree);
let relDocPath = pathname.substring(pathname.indexOf('docs')); const relDocPath = pathname.substring(pathname.indexOf('docs'));
let srcUrl = fixRelSrcUrl(relDocPath, sourcePath); const srcUrl = fixRelSrcUrl(relDocPath, sourcePath);
if (titleHeading && titleHeading.children[0] && titleHeading.children[0].type === "text") { if (titleHeading && titleHeading.children[0] && titleHeading.children[0].type === 'text') {
let titleText = titleHeading.children[0]; const titleText = titleHeading.children[0];
titleHeading.children[0] = { titleHeading.children[0] = {
type: 'link', type: 'link',
url: srcUrl,//`../../${sourcePath}`, url: srcUrl, // `../../${sourcePath}`,
title: `Defined in ${path.basename(sourcePath)}`, title: `Defined in ${path.basename(sourcePath)}`,
children: [titleText] children: [titleText]
} };
} else if ((titleHeading && titleHeading.children[0].type === "link") && sourcePath) { } else if ((titleHeading && titleHeading.children[0].type === 'link') && sourcePath) {
let linkElem = titleHeading.children[0]; const linkElem = titleHeading.children[0];
linkElem.url = srcUrl, //`../../${sourcePath}`; linkElem.url = srcUrl, // `../../${sourcePath}`;
linkElem.title = `Defined in ${path.basename(sourcePath)}`; linkElem.title = `Defined in ${path.basename(sourcePath)}`;
} }
}); });
} }
function fixRelSrcUrl(docPath: string, srcPath: string) { function fixRelSrcUrl(docPath: string, srcPath: string) {
let docPathSegments = docPath.split(/[\\\/]/); const docPathSegments = docPath.split(/[\\\/]/);
let dotPathPart = ''; let dotPathPart = '';
for (let i = 0; i < (docPathSegments.length - 1); i++) { for (let i = 0; i < (docPathSegments.length - 1); i++) {

View File

@@ -1,22 +1,16 @@
"use strict"; "use strict";
// tslint:disable: no-console
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var fs = require("fs"); var fs = require("fs");
var path = require("path"); var path = require("path");
var replaceSection = require("mdast-util-heading-range"); var replaceSection = require("mdast-util-heading-range");
var remark = require("remark"); var remark = require("remark");
// import * as stringify from "remark-stringify";
// import * as frontMatter from "remark-frontmatter";
var ejs = require("ejs"); var ejs = require("ejs");
var mdNav_1 = require("../mdNav"); var mdNav_1 = require("../mdNav");
var ngHelpers_1 = require("../ngHelpers"); var ngHelpers_1 = require("../ngHelpers");
var libFolders = ["core", "content-services", "process-services", "insights", "process-services-cloud"]; var templateFolder = path.resolve('tools', 'doc', 'templates');
var templateFolder = path.resolve("tools", "doc", "templates");
var excludePatterns = [
"**/*.spec.ts"
];
var nameExceptions; var nameExceptions;
function processDocs(mdCache, aggData, _errorMessages) { function processDocs(mdCache, aggData, _errorMessages) {
//initPhase(aggData);
nameExceptions = aggData.config.typeNameExceptions; nameExceptions = aggData.config.typeNameExceptions;
var pathnames = Object.keys(mdCache); var pathnames = Object.keys(mdCache);
var internalErrors; var internalErrors;
@@ -32,60 +26,31 @@ exports.processDocs = processDocs;
function showErrors(filename, errorMessages) { function showErrors(filename, errorMessages) {
console.log(filename); console.log(filename);
errorMessages.forEach(function (message) { errorMessages.forEach(function (message) {
console.log(" " + message); console.log(' ' + message);
}); });
console.log(""); console.log('');
} }
/*
function initPhase(aggData) {
nameExceptions = aggData.config.typeNameExceptions;
let app = new Application({
exclude: excludePatterns,
ignoreCompilerErrors: true,
experimentalDecorators: true,
tsconfig: "tsconfig.json"
});
let sources = app.expandInputFiles(libFolders.map(folder => {
return path.resolve("lib", folder);
}));
aggData.projData = app.convert(sources);
}
*/
function updateFile(tree, pathname, aggData, errorMessages) { function updateFile(tree, pathname, aggData, errorMessages) {
/* var className = ngHelpers_1.ngNameToClassName(path.basename(pathname, '.md'), nameExceptions);
let compName = angNameToClassName(path.basename(pathname, ".md"));
let classRef = aggData.projData.findReflectionByName(compName);
if (!classRef) {
// A doc file with no corresponding class (eg, Document Library Model).
return false;
}
let compData = new ComponentInfo(classRef);
*/
var className = ngHelpers_1.ngNameToClassName(path.basename(pathname, ".md"), nameExceptions);
var classTypeMatch = className.match(/component|directive|service/i); var classTypeMatch = className.match(/component|directive|service/i);
var compData = aggData.classInfo[className]; var compData = aggData.classInfo[className];
if (classTypeMatch && compData) { if (classTypeMatch && compData) {
var classType = classTypeMatch[0].toLowerCase(); var classType = classTypeMatch[0].toLowerCase();
// Copy docs back from the .md file when the JSDocs are empty. // Copy docs back from the .md file when the JSDocs are empty.
var inputMD = getPropDocsFromMD(tree, "Properties", 3); var inputMD = getPropDocsFromMD(tree, 'Properties', 3);
var outputMD = getPropDocsFromMD(tree, "Events", 2); var outputMD = getPropDocsFromMD(tree, 'Events', 2);
updatePropDocsFromMD(compData, inputMD, outputMD, errorMessages); updatePropDocsFromMD(compData, inputMD, outputMD, errorMessages);
if (classType === "service") { if (classType === 'service') {
var methodMD = getMethodDocsFromMD(tree); var methodMD = getMethodDocsFromMD(tree);
updateMethodDocsFromMD(compData, methodMD, errorMessages); updateMethodDocsFromMD(compData, methodMD, errorMessages);
} }
var templateName = path.resolve(templateFolder, classType + ".ejs"); var templateName = path.resolve(templateFolder, classType + '.ejs');
var templateSource = fs.readFileSync(templateName, "utf8"); var templateSource = fs.readFileSync(templateName, 'utf8');
var template = ejs.compile(templateSource); var template = ejs.compile(templateSource);
var mdText = template(compData); var mdText = template(compData);
mdText = mdText.replace(/^ +\|/mg, "|"); mdText = mdText.replace(/^ +\|/mg, '|');
var newSection_1 = remark().parse(mdText.trim()).children; var newSection_1 = remark().parse(mdText.trim()).children;
replaceSection(tree, "Class members", function (before, section, after) { replaceSection(tree, 'Class members', function (before, section, after) {
newSection_1.unshift(before); newSection_1.unshift(before);
newSection_1.push(after); newSection_1.push(after);
return newSection_1; return newSection_1;
@@ -96,48 +61,16 @@ function updateFile(tree, pathname, aggData, errorMessages) {
} }
return true; return true;
} }
/*
function initialCap(str: string) {
return str[0].toUpperCase() + str.substr(1);
}
function angNameToClassName(rawName: string) {
if (nameExceptions[rawName])
return nameExceptions[rawName];
var name = rawName.replace(/\]|\(|\)/g, '');
var fileNameSections = name.split('.');
var compNameSections = fileNameSections[0].split('-');
var outCompName = '';
for (var i = 0; i < compNameSections.length; i++) {
outCompName = outCompName + initialCap(compNameSections[i]);
}
var itemTypeIndicator = '';
if (fileNameSections.length > 1) {
itemTypeIndicator = initialCap(fileNameSections[1]);
}
var finalName = outCompName + itemTypeIndicator;
return finalName;
}
*/
function getPropDocsFromMD(tree, sectionHeading, docsColumn) { function getPropDocsFromMD(tree, sectionHeading, docsColumn) {
var result = {}; var result = {};
var nav = new mdNav_1.MDNav(tree); var nav = new mdNav_1.MDNav(tree);
var classMemHeading = nav var classMemHeading = nav
.heading(function (h) { .heading(function (h) {
return (h.children[0].type === "text") && (h.children[0].value === "Class members"); return (h.children[0].type === 'text') && (h.children[0].value === 'Class members');
}); });
var propsTable = classMemHeading var propsTable = classMemHeading
.heading(function (h) { .heading(function (h) {
return (h.children[0].type === "text") && (h.children[0].value === sectionHeading); return (h.children[0].type === 'text') && (h.children[0].value === sectionHeading);
}).table(); }).table();
var propTableRow = propsTable.childNav var propTableRow = propsTable.childNav
.tableRow(function () { return true; }, 1).childNav; .tableRow(function () { return true; }, 1).childNav;
@@ -163,11 +96,11 @@ function getMethodDocsFromMD(tree) {
var nav = new mdNav_1.MDNav(tree); var nav = new mdNav_1.MDNav(tree);
var classMemHeading = nav var classMemHeading = nav
.heading(function (h) { .heading(function (h) {
return (h.children[0].type === "text") && (h.children[0].value === "Class members"); return (h.children[0].type === 'text') && (h.children[0].value === 'Class members');
}); });
var methListItems = classMemHeading var methListItems = classMemHeading
.heading(function (h) { .heading(function (h) {
return (h.children[0].type === "text") && (h.children[0].value === "Methods"); return (h.children[0].type === 'text') && (h.children[0].value === 'Methods');
}).list().childNav; }).list().childNav;
var methItem = methListItems var methItem = methListItems
.listItem(); .listItem();
@@ -186,18 +119,14 @@ function getMethodDocsFromMD(tree) {
.text().value; .text().value;
var params = getMDMethodParams(methItem); var params = getMDMethodParams(methItem);
result[methName] = { result[methName] = {
"docText": methDoc.replace(/^\n/, ""), 'docText': methDoc.replace(/^\n/, ''),
"params": params 'params': params
}; };
} }
i++; i++;
methItem = methListItems methItem = methListItems
.listItem(function (l) { return true; }, i); .listItem(function (l) { return true; }, i);
} }
/*
let newRoot = unist.makeRoot([methList.item]);
console.log(remark().use(frontMatter, {type: 'yaml', fence: '---'}).data("settings", {paddedTable: false, gfm: false}).stringify(tree));
*/
return result; return result;
} }
function getMDMethodParams(methItem) { function getMDMethodParams(methItem) {
@@ -211,7 +140,7 @@ function getMDMethodParams(methItem) {
.emph().childNav; .emph().childNav;
var paramName; var paramName;
if (!paramNameNode.empty) { if (!paramNameNode.empty) {
paramName = paramNameNode.text().item.value.replace(/:/, ""); paramName = paramNameNode.text().item.value.replace(/:/, '');
} }
else { else {
paramName = paramListItem.childNav paramName = paramListItem.childNav
@@ -221,8 +150,8 @@ function getMDMethodParams(methItem) {
} }
var paramDoc = paramListItem.childNav var paramDoc = paramListItem.childNav
.paragraph().childNav .paragraph().childNav
.text(function (t) { return true; }, 1).value; //item.value; .text(function (t) { return true; }, 1).value; // item.value;
result[paramName] = paramDoc.replace(/^[ -]+/, ""); result[paramName] = paramDoc.replace(/^[ -]+/, '');
}); });
return result; return result;
} }

View File

@@ -1,27 +1,22 @@
import * as fs from "fs"; // tslint:disable: no-console
import * as path from "path";
import * as replaceSection from "mdast-util-heading-range"; import * as fs from 'fs';
import * as remark from "remark"; import * as path from 'path';
import * as replaceSection from 'mdast-util-heading-range';
import * as remark from 'remark';
import * as ejs from 'ejs';
import { MDNav } from '../mdNav';
import { ngNameToClassName } from '../ngHelpers';
import { ComponentInfo } from '../sourceInfoClasses';
import * as ejs from "ejs"; const templateFolder = path.resolve('tools', 'doc', 'templates');
import { MDNav } from "../mdNav";
import { ngNameToClassName } from "../ngHelpers";
import {
ComponentInfo
} from "../SourceInfoClasses"
let templateFolder = path.resolve("tools", "doc", "templates");
let nameExceptions; let nameExceptions;
export function processDocs(mdCache, aggData, _errorMessages) { export function processDocs(mdCache, aggData, _errorMessages) {
nameExceptions = aggData.config.typeNameExceptions; nameExceptions = aggData.config.typeNameExceptions;
let pathnames = Object.keys(mdCache); const pathnames = Object.keys(mdCache);
let internalErrors; let internalErrors;
pathnames.forEach(pathname => { pathnames.forEach(pathname => {
@@ -34,47 +29,45 @@ export function processDocs(mdCache, aggData, _errorMessages) {
}); });
} }
function showErrors(filename, errorMessages) { function showErrors(filename, errorMessages) {
console.log(filename); console.log(filename);
errorMessages.forEach(message => { errorMessages.forEach(message => {
console.log(" " + message); console.log(' ' + message);
}); });
console.log(""); console.log('');
} }
function updateFile(tree, pathname, aggData, errorMessages) { function updateFile(tree, pathname, aggData, errorMessages) {
let className = ngNameToClassName(path.basename(pathname, ".md"), nameExceptions); const className = ngNameToClassName(path.basename(pathname, '.md'), nameExceptions);
let classTypeMatch = className.match(/component|directive|service/i); const classTypeMatch = className.match(/component|directive|service/i);
let compData = aggData.classInfo[className]; const compData = aggData.classInfo[className];
if (classTypeMatch && compData) { if (classTypeMatch && compData) {
let classType = classTypeMatch[0].toLowerCase(); const classType = classTypeMatch[0].toLowerCase();
// Copy docs back from the .md file when the JSDocs are empty. // Copy docs back from the .md file when the JSDocs are empty.
let inputMD = getPropDocsFromMD(tree, "Properties", 3); const inputMD = getPropDocsFromMD(tree, 'Properties', 3);
let outputMD = getPropDocsFromMD(tree, "Events", 2); const outputMD = getPropDocsFromMD(tree, 'Events', 2);
updatePropDocsFromMD(compData, inputMD, outputMD, errorMessages); updatePropDocsFromMD(compData, inputMD, outputMD, errorMessages);
if (classType === "service") { if (classType === 'service') {
let methodMD = getMethodDocsFromMD(tree); const methodMD = getMethodDocsFromMD(tree);
updateMethodDocsFromMD(compData, methodMD, errorMessages); updateMethodDocsFromMD(compData, methodMD, errorMessages);
} }
let templateName = path.resolve(templateFolder, classType + ".ejs"); const templateName = path.resolve(templateFolder, classType + '.ejs');
let templateSource = fs.readFileSync(templateName, "utf8"); const templateSource = fs.readFileSync(templateName, 'utf8');
let template = ejs.compile(templateSource); const template = ejs.compile(templateSource);
let mdText = template(compData); let mdText = template(compData);
mdText = mdText.replace(/^ +\|/mg, "|"); mdText = mdText.replace(/^ +\|/mg, '|');
let newSection = remark().parse(mdText.trim()).children; const newSection = remark().parse(mdText.trim()).children;
replaceSection(tree, "Class members", (before, section, after) => { replaceSection(tree, 'Class members', (before, section, after) => {
newSection.unshift(before); newSection.unshift(before);
newSection.push(after); newSection.push(after);
return newSection; return newSection;
@@ -82,39 +75,39 @@ function updateFile(tree, pathname, aggData, errorMessages) {
compData.errors.forEach(err => { compData.errors.forEach(err => {
errorMessages.push(err); errorMessages.push(err);
}) });
} }
return true; return true;
} }
function getPropDocsFromMD(tree, sectionHeading, docsColumn) { function getPropDocsFromMD(tree, sectionHeading, docsColumn) {
let result = {} const result = {};
let nav = new MDNav(tree); const nav = new MDNav(tree);
let classMemHeading = nav const classMemHeading = nav
.heading(h => { .heading(h => {
return (h.children[0].type === "text") && (h.children[0].value === "Class members"); return (h.children[0].type === 'text') && (h.children[0].value === 'Class members');
}); });
let propsTable = classMemHeading const propsTable = classMemHeading
.heading(h => { .heading(h => {
return (h.children[0].type === "text") && (h.children[0].value === sectionHeading); return (h.children[0].type === 'text') && (h.children[0].value === sectionHeading);
}).table(); }).table();
let propTableRow = propsTable.childNav let propTableRow = propsTable.childNav
.tableRow(()=>true, 1).childNav; .tableRow(() => true, 1).childNav;
let i = 1; let i = 1;
while (!propTableRow.empty) { while (!propTableRow.empty) {
let propName = propTableRow const propName = propTableRow
.tableCell().childNav .tableCell().childNav
.text().item.value; .text().item.value;
let propDocText = propTableRow const propDocText = propTableRow
.tableCell(()=>true, docsColumn).childNav .tableCell(() => true, docsColumn).childNav
.text().item; .text().item;
if (propDocText) { if (propDocText) {
@@ -123,26 +116,25 @@ function getPropDocsFromMD(tree, sectionHeading, docsColumn) {
i++; i++;
propTableRow = propsTable.childNav propTableRow = propsTable.childNav
.tableRow(()=>true, i).childNav; .tableRow(() => true, i).childNav;
} }
return result; return result;
} }
function getMethodDocsFromMD(tree) { function getMethodDocsFromMD(tree) {
let result = {} const result = {};
let nav = new MDNav(tree); const nav = new MDNav(tree);
let classMemHeading = nav const classMemHeading = nav
.heading(h => { .heading(h => {
return (h.children[0].type === "text") && (h.children[0].value === "Class members"); return (h.children[0].type === 'text') && (h.children[0].value === 'Class members');
}); });
let methListItems = classMemHeading const methListItems = classMemHeading
.heading(h => { .heading(h => {
return (h.children[0].type === "text") && (h.children[0].value === "Methods"); return (h.children[0].type === 'text') && (h.children[0].value === 'Methods');
}).list().childNav; }).list().childNav;
let methItem = methListItems let methItem = methListItems
@@ -151,7 +143,7 @@ function getMethodDocsFromMD(tree) {
let i = 0; let i = 0;
while (!methItem.empty) { while (!methItem.empty) {
let methNameSection = methItem.childNav const methNameSection = methItem.childNav
.paragraph().childNav .paragraph().childNav
.strong().childNav; .strong().childNav;
@@ -161,46 +153,45 @@ function getMethodDocsFromMD(tree) {
if (!methNameSection.empty) { if (!methNameSection.empty) {
methName = methNameSection.text().item.value; methName = methNameSection.text().item.value;
let methDoc = methItem.childNav const methDoc = methItem.childNav
.paragraph().childNav .paragraph().childNav
.html() .html()
.text().value; .text().value;
let params = getMDMethodParams(methItem); const params = getMDMethodParams(methItem);
result[methName] = { result[methName] = {
"docText": methDoc.replace(/^\n/, ""), 'docText': methDoc.replace(/^\n/, ''),
"params": params 'params': params
}; };
} }
i++; i++;
methItem = methListItems methItem = methListItems
.listItem(l=>true, i); .listItem(l => true, i);
} }
return result; return result;
} }
function getMDMethodParams(methItem: MDNav) { function getMDMethodParams(methItem: MDNav) {
let result = {}; const result = {};
let paramList = methItem.childNav.list().childNav; const paramList = methItem.childNav.list().childNav;
let paramListItems = paramList const paramListItems = paramList
.listItems(); .listItems();
paramListItems.forEach(paramListItem => { paramListItems.forEach(paramListItem => {
let paramNameNode = paramListItem.childNav const paramNameNode = paramListItem.childNav
.paragraph().childNav .paragraph().childNav
.emph().childNav; .emph().childNav;
let paramName; let paramName;
if (!paramNameNode.empty) { if (!paramNameNode.empty) {
paramName = paramNameNode.text().item.value.replace(/:/, ""); paramName = paramNameNode.text().item.value.replace(/:/, '');
} else { } else {
paramName = paramListItem.childNav paramName = paramListItem.childNav
.paragraph().childNav .paragraph().childNav
@@ -208,17 +199,16 @@ function getMDMethodParams(methItem: MDNav) {
.text().item.value; .text().item.value;
} }
let paramDoc = paramListItem.childNav const paramDoc = paramListItem.childNav
.paragraph().childNav .paragraph().childNav
.text(t=>true, 1).value; //item.value; .text(t => true, 1).value; // item.value;
result[paramName] = paramDoc.replace(/^[ -]+/, ""); result[paramName] = paramDoc.replace(/^[ -]+/, '');
}); });
return result; return result;
} }
function updatePropDocsFromMD(comp: ComponentInfo, inputDocs, outputDocs, errorMessages) { function updatePropDocsFromMD(comp: ComponentInfo, inputDocs, outputDocs, errorMessages) {
comp.properties.forEach(prop => { comp.properties.forEach(prop => {
let propMDDoc: string; let propMDDoc: string;
@@ -237,10 +227,9 @@ function updatePropDocsFromMD(comp: ComponentInfo, inputDocs, outputDocs, errorM
}); });
} }
function updateMethodDocsFromMD(comp: ComponentInfo, methodDocs, errorMessages) { function updateMethodDocsFromMD(comp: ComponentInfo, methodDocs, errorMessages) {
comp.methods.forEach(meth => { comp.methods.forEach(meth => {
let currMethMD = methodDocs[meth.name] const currMethMD = methodDocs[meth.name];
// If JSDocs are empty but MD docs aren't then the Markdown is presumably more up-to-date. // If JSDocs are empty but MD docs aren't then the Markdown is presumably more up-to-date.
if (!meth.docText && currMethMD && currMethMD.docText) { if (!meth.docText && currMethMD && currMethMD.docText) {
@@ -249,8 +238,7 @@ function updateMethodDocsFromMD(comp: ComponentInfo, methodDocs, errorMessages)
} }
meth.params.forEach(param => { meth.params.forEach(param => {
if (!param.docText && currMethMD && currMethMD.params[param.name]) if (!param.docText && currMethMD && currMethMD.params[param.name]) {
{
param.docText = currMethMD.params[param.name]; param.docText = currMethMD.params[param.name];
errorMessages.push(`Warning: empty JSDocs for parameter "${param.name} (${meth.name})" may need sync with the .md file.`); errorMessages.push(`Warning: empty JSDocs for parameter "${param.name} (${meth.name})" may need sync with the .md file.`);
} }

View File

@@ -8,73 +8,73 @@ var frontMatter = require("remark-frontmatter");
var yaml = require("js-yaml"); var yaml = require("js-yaml");
var ejs = require("ejs"); var ejs = require("ejs");
var unist = require("../unistHelpers"); var unist = require("../unistHelpers");
var tutFolder = path.resolve("docs", "tutorials"); var tutFolder = path.resolve('docs', 'tutorials');
var templateFolder = path.resolve("tools", "doc", "templates"); var templateFolder = path.resolve('tools', 'doc', 'templates');
var userGuideFolder = path.resolve("docs", "user-guide"); var userGuideFolder = path.resolve('docs', 'user-guide');
function processDocs(tree, pathname, aggData, errorMessages) { function processDocs() {
aggPhase(aggData); aggPhase();
} }
exports.processDocs = processDocs; exports.processDocs = processDocs;
function aggPhase(aggData) { function aggPhase() {
var indexDocData = getIndexDocData(); var indexDocData = getIndexDocData();
var templateName = path.resolve(templateFolder, "tutIndex.ejs"); var templateName = path.resolve(templateFolder, 'tutIndex.ejs');
var templateSource = fs.readFileSync(templateName, "utf8"); var templateSource = fs.readFileSync(templateName, 'utf8');
var template = ejs.compile(templateSource); var template = ejs.compile(templateSource);
var mdText = template(indexDocData); var mdText = template(indexDocData);
mdText = mdText.replace(/^ +\|/mg, "|"); mdText = mdText.replace(/^ +\|/mg, '|');
var newSection = remark().use(frontMatter, ["yaml"]).data("settings", { paddedTable: false, gfm: false }).parse(mdText.trim()).children; var newSection = remark().use(frontMatter, ['yaml']).data('settings', { paddedTable: false, gfm: false }).parse(mdText.trim()).children;
var tutIndexFile = path.resolve(tutFolder, "README.md"); var tutIndexFile = path.resolve(tutFolder, 'README.md');
var tutIndexText = fs.readFileSync(tutIndexFile, "utf8"); var tutIndexText = fs.readFileSync(tutIndexFile, 'utf8');
var tutIndexMD = remark().use(frontMatter, ["yaml"]).data("settings", { paddedTable: false, gfm: false }).parse(tutIndexText); var tutIndexMD = remark().use(frontMatter, ['yaml']).data('settings', { paddedTable: false, gfm: false }).parse(tutIndexText);
replaceSection(tutIndexMD, "Tutorials", function (before, section, after) { replaceSection(tutIndexMD, 'Tutorials', function (before, section, after) {
newSection.unshift(before); newSection.unshift(before);
newSection.push(after); newSection.push(after);
return newSection; return newSection;
}); });
fs.writeFileSync(tutIndexFile, remark().use(frontMatter, { type: 'yaml', fence: '---' }).data("settings", { paddedTable: false, gfm: false }).stringify(tutIndexMD)); fs.writeFileSync(tutIndexFile, remark().use(frontMatter, { type: 'yaml', fence: '---' }).data('settings', { paddedTable: false, gfm: false }).stringify(tutIndexMD));
} }
function getIndexDocData() { function getIndexDocData() {
var indexFile = path.resolve(userGuideFolder, "summary.json"); var indexFile = path.resolve(userGuideFolder, 'summary.json');
var summaryArray = JSON.parse(fs.readFileSync(indexFile, "utf8")); var summaryArray = JSON.parse(fs.readFileSync(indexFile, 'utf8'));
var indexArray = []; var indexArray = [];
summaryArray.forEach(function (element) { summaryArray.forEach(function (element) {
if (element["title"] === "Tutorials") { if (element['title'] === 'Tutorials') {
indexArray = element["children"]; indexArray = element['children'];
} }
}); });
var result = { var result = {
tuts: [] tuts: []
}; };
indexArray.forEach(function (element) { indexArray.forEach(function (element) {
var tutData = { link: element["file"] }; var tutData = { link: element['file'] };
var tutFile = path.resolve(tutFolder, element["file"]); var tutFile = path.resolve(tutFolder, element['file']);
var tutFileText = fs.readFileSync(tutFile, "utf8"); var tutFileText = fs.readFileSync(tutFile, 'utf8');
var tutMD = remark().use(frontMatter, ["yaml"]).parse(tutFileText); var tutMD = remark().use(frontMatter, ['yaml']).parse(tutFileText);
var metadata = getDocMetadata(tutMD); var metadata = getDocMetadata(tutMD);
if (metadata["Level"]) { if (metadata['Level']) {
tutData["level"] = metadata["Level"]; tutData['level'] = metadata['Level'];
} }
else { else {
tutData["level"] = ""; tutData['level'] = '';
} }
var briefDesc = getFirstParagraph(tutMD); var briefDesc = getFirstParagraph(tutMD);
var briefDescText = remark() var briefDescText = remark()
.use(frontMatter, { type: 'yaml', fence: '---' }) .use(frontMatter, { type: 'yaml', fence: '---' })
.data("settings", { paddedTable: false, gfm: false }) .data('settings', { paddedTable: false, gfm: false })
.stringify(briefDesc); .stringify(briefDesc);
tutData["briefDesc"] = briefDescText; tutData['briefDesc'] = briefDescText;
var title = getFirstHeading(tutMD); var title = getFirstHeading(tutMD);
var titleText = remark() var titleText = remark()
.use(frontMatter, { type: 'yaml', fence: '---' }) .use(frontMatter, { type: 'yaml', fence: '---' })
.data("settings", { paddedTable: false, gfm: false }) .data('settings', { paddedTable: false, gfm: false })
.stringify(title.children[0]); .stringify(title.children[0]);
tutData["title"] = titleText; tutData['title'] = titleText;
result.tuts.push(tutData); result.tuts.push(tutData);
}); });
return result; return result;
} }
function getDocMetadata(tree) { function getDocMetadata(tree) {
if (tree.children[0].type == "yaml") { if (tree.children[0].type === 'yaml') {
return yaml.load(tree.children[0].value); return yaml.load(tree.children[0].value);
} }
else { else {

View File

@@ -1,98 +1,92 @@
import * as fs from "fs"; import * as fs from 'fs';
import * as path from "path"; import * as path from 'path';
import * as replaceSection from 'mdast-util-heading-range';
import * as replaceSection from "mdast-util-heading-range"; import * as remark from 'remark';
import * as remark from "remark"; import * as frontMatter from 'remark-frontmatter';
import * as frontMatter from "remark-frontmatter"; import * as yaml from 'js-yaml';
import * as yaml from "js-yaml"; import * as ejs from 'ejs';
import * as ejs from "ejs"; import * as unist from '../unistHelpers';
import * as unist from "../unistHelpers";
const tutFolder = path.resolve("docs", "tutorials");
const templateFolder = path.resolve("tools", "doc", "templates");
const userGuideFolder = path.resolve("docs", "user-guide");
const tutFolder = path.resolve('docs', 'tutorials');
const templateFolder = path.resolve('tools', 'doc', 'templates');
const userGuideFolder = path.resolve('docs', 'user-guide');
export function processDocs() { export function processDocs() {
aggPhase(); aggPhase();
} }
function aggPhase() { function aggPhase() {
let indexDocData = getIndexDocData(); const indexDocData = getIndexDocData();
let templateName = path.resolve(templateFolder, "tutIndex.ejs"); const templateName = path.resolve(templateFolder, 'tutIndex.ejs');
let templateSource = fs.readFileSync(templateName, "utf8"); const templateSource = fs.readFileSync(templateName, 'utf8');
let template = ejs.compile(templateSource); const template = ejs.compile(templateSource);
let mdText = template(indexDocData); let mdText = template(indexDocData);
mdText = mdText.replace(/^ +\|/mg, "|"); mdText = mdText.replace(/^ +\|/mg, '|');
let newSection = remark().use(frontMatter, ["yaml"]).data("settings", {paddedTable: false, gfm: false}).parse(mdText.trim()).children; const newSection = remark().use(frontMatter, ['yaml']).data('settings', {paddedTable: false, gfm: false}).parse(mdText.trim()).children;
let tutIndexFile = path.resolve(tutFolder, "README.md"); const tutIndexFile = path.resolve(tutFolder, 'README.md');
let tutIndexText = fs.readFileSync(tutIndexFile, "utf8"); const tutIndexText = fs.readFileSync(tutIndexFile, 'utf8');
let tutIndexMD = remark().use(frontMatter, ["yaml"]).data("settings", {paddedTable: false, gfm: false}).parse(tutIndexText); const tutIndexMD = remark().use(frontMatter, ['yaml']).data('settings', {paddedTable: false, gfm: false}).parse(tutIndexText);
replaceSection(tutIndexMD, "Tutorials", (before, section, after) => { replaceSection(tutIndexMD, 'Tutorials', (before, section, after) => {
newSection.unshift(before); newSection.unshift(before);
newSection.push(after); newSection.push(after);
return newSection; return newSection;
}); });
fs.writeFileSync(tutIndexFile, remark().use(frontMatter, {type: 'yaml', fence: '---'}).data("settings", {paddedTable: false, gfm: false}).stringify(tutIndexMD)); fs.writeFileSync(tutIndexFile, remark().use(frontMatter, {type: 'yaml', fence: '---'}).data('settings', {paddedTable: false, gfm: false}).stringify(tutIndexMD));
} }
function getIndexDocData() { function getIndexDocData() {
let indexFile = path.resolve(userGuideFolder, "summary.json"); const indexFile = path.resolve(userGuideFolder, 'summary.json');
let summaryArray = JSON.parse(fs.readFileSync(indexFile, "utf8")); const summaryArray = JSON.parse(fs.readFileSync(indexFile, 'utf8'));
let indexArray = []; let indexArray = [];
summaryArray.forEach(element => { summaryArray.forEach(element => {
if (element["title"] === "Tutorials") { if (element['title'] === 'Tutorials') {
indexArray = element["children"]; indexArray = element['children'];
} }
}); });
let result = { const result = {
tuts: [] tuts: []
}; };
indexArray.forEach(element => { indexArray.forEach(element => {
let tutData = { link: element["file"] }; const tutData = { link: element['file'] };
let tutFile = path.resolve(tutFolder, element["file"]); const tutFile = path.resolve(tutFolder, element['file']);
let tutFileText = fs.readFileSync(tutFile, "utf8"); const tutFileText = fs.readFileSync(tutFile, 'utf8');
let tutMD = remark().use(frontMatter, ["yaml"]).parse(tutFileText); const tutMD = remark().use(frontMatter, ['yaml']).parse(tutFileText);
let metadata = getDocMetadata(tutMD); const metadata = getDocMetadata(tutMD);
if (metadata["Level"]){ if (metadata['Level']) {
tutData["level"] = metadata["Level"]; tutData['level'] = metadata['Level'];
} else { } else {
tutData["level"] = ""; tutData['level'] = '';
} }
let briefDesc = getFirstParagraph(tutMD); const briefDesc = getFirstParagraph(tutMD);
let briefDescText = remark() const briefDescText = remark()
.use(frontMatter, {type: 'yaml', fence: '---'}) .use(frontMatter, {type: 'yaml', fence: '---'})
.data("settings", {paddedTable: false, gfm: false}) .data('settings', {paddedTable: false, gfm: false})
.stringify(briefDesc); .stringify(briefDesc);
tutData["briefDesc"] = briefDescText; tutData['briefDesc'] = briefDescText;
let title = getFirstHeading(tutMD); const title = getFirstHeading(tutMD);
let titleText = remark() const titleText = remark()
.use(frontMatter, {type: 'yaml', fence: '---'}) .use(frontMatter, {type: 'yaml', fence: '---'})
.data("settings", {paddedTable: false, gfm: false}) .data('settings', {paddedTable: false, gfm: false})
.stringify(title.children[0]); .stringify(title.children[0]);
tutData["title"] = titleText; tutData['title'] = titleText;
result.tuts.push(tutData); result.tuts.push(tutData);
}); });
@@ -100,20 +94,18 @@ function getIndexDocData() {
return result; return result;
} }
function getDocMetadata(tree) { function getDocMetadata(tree) {
if (tree.children[0].type == "yaml") { if (tree.children[0].type === 'yaml') {
return yaml.load(tree.children[0].value); return yaml.load(tree.children[0].value);
} else { } else {
return {}; return {};
} }
} }
function getFirstParagraph(tree) { function getFirstParagraph(tree) {
let s = 0; let s = 0;
for (;(s < tree.children.length) && !unist.isParagraph(tree.children[s]); s++) {} for (; (s < tree.children.length) && !unist.isParagraph(tree.children[s]); s++) {}
if (s < tree.children.length) { if (s < tree.children.length) {
return tree.children[s]; return tree.children[s];
@@ -126,7 +118,7 @@ function getFirstParagraph(tree) {
function getFirstHeading(tree) { function getFirstHeading(tree) {
let s = 0; let s = 0;
for (;(s < tree.children.length) && !unist.isHeading(tree.children[s]); s++) {} for (; (s < tree.children.length) && !unist.isHeading(tree.children[s]); s++) {}
if (s < tree.children.length) { if (s < tree.children.length) {
return tree.children[s]; return tree.children[s];

View File

@@ -1,12 +1,12 @@
"use strict"; "use strict";
exports.__esModule = true; Object.defineProperty(exports, "__esModule", { value: true });
var path = require("path"); var path = require("path");
var unist = require("../unistHelpers"); var unist = require("../unistHelpers");
var ngHelpers = require("../ngHelpers"); var ngHelpers = require("../ngHelpers");
var includedNodeTypes = [ var includedNodeTypes = [
"root", "paragraph", "inlineCode", "list", "listItem", 'root', 'paragraph', 'inlineCode', 'list', 'listItem',
"table", "tableRow", "tableCell", "emphasis", "strong", 'table', 'tableRow', 'tableCell', 'emphasis', 'strong',
"link", "text" 'link', 'text'
]; ];
var externalNameLinks; var externalNameLinks;
var linkOverrides; var linkOverrides;
@@ -28,8 +28,8 @@ function initPhase(aggData, mdCache) {
aggData.nameLookup = new SplitNameLookup(); aggData.nameLookup = new SplitNameLookup();
var docFilePaths = Object.keys(mdCache); var docFilePaths = Object.keys(mdCache);
docFilePaths.forEach(function (docFilePath) { docFilePaths.forEach(function (docFilePath) {
var relPath = docFilePath.substring(docFilePath.indexOf('docs') + 5).replace(/\\/g, "/"); var relPath = docFilePath.substring(docFilePath.indexOf('docs') + 5).replace(/\\/g, '/');
var compName = path.basename(relPath, ".md"); var compName = path.basename(relPath, '.md');
aggData.docFiles[compName] = relPath; aggData.docFiles[compName] = relPath;
}); });
var classNames = Object.keys(aggData.classInfo); var classNames = Object.keys(aggData.classInfo);
@@ -46,33 +46,33 @@ function updateFile(tree, pathname, aggData) {
if (!includedNodeTypes.includes(node.type)) { if (!includedNodeTypes.includes(node.type)) {
return; return;
} }
if (node.type === "link") { if (node.type === 'link') {
if (node.children[0] && ((node.children[0].type === "inlineCode") || if (node.children[0] && ((node.children[0].type === 'inlineCode') ||
(node.children[0].type === "text"))) { (node.children[0].type === 'text'))) {
var link = resolveTypeLink(aggData, pathname, node.children[0].value); var link = resolveTypeLink(aggData, pathname, node.children[0].value);
if (link) { if (link) {
convertNodeToTypeLink(node, node.children[0].value, link); convertNodeToTypeLink(node, node.children[0].value, link);
} }
} }
} }
else if ((node.children) && (node.type !== "heading")) { else if ((node.children) && (node.type !== 'heading')) {
node.children.forEach(function (child, index) { node.children.forEach(function (child, index) {
if ((child.type === "text") || (child.type === "inlineCode")) { var _a;
if ((child.type === 'text') || (child.type === 'inlineCode')) {
var newNodes = handleLinksInBodyText(aggData, pathname, child.value, child.type === 'inlineCode'); var newNodes = handleLinksInBodyText(aggData, pathname, child.value, child.type === 'inlineCode');
(_a = node.children).splice.apply(_a, [index, 1].concat(newNodes)); (_a = node.children).splice.apply(_a, [index, 1].concat(newNodes));
} }
else { else {
traverseMDTree(child); traverseMDTree(child);
} }
var _a;
}); });
} }
} }
} }
var SplitNameNode = (function () { var SplitNameNode = /** @class */ (function () {
function SplitNameNode(key, value) { function SplitNameNode(key, value) {
if (key === void 0) { key = ""; } if (key === void 0) { key = ''; }
if (value === void 0) { value = ""; } if (value === void 0) { value = ''; }
this.key = key; this.key = key;
this.value = value; this.value = value;
this.children = {}; this.children = {};
@@ -82,21 +82,21 @@ var SplitNameNode = (function () {
}; };
return SplitNameNode; return SplitNameNode;
}()); }());
var SplitNameMatchElement = (function () { var SplitNameMatchElement = /** @class */ (function () {
function SplitNameMatchElement(node, textPos) { function SplitNameMatchElement(node, textPos) {
this.node = node; this.node = node;
this.textPos = textPos; this.textPos = textPos;
} }
return SplitNameMatchElement; return SplitNameMatchElement;
}()); }());
var SplitNameMatchResult = (function () { var SplitNameMatchResult = /** @class */ (function () {
function SplitNameMatchResult(value, startPos) { function SplitNameMatchResult(value, startPos) {
this.value = value; this.value = value;
this.startPos = startPos; this.startPos = startPos;
} }
return SplitNameMatchResult; return SplitNameMatchResult;
}()); }());
var SplitNameMatcher = (function () { var SplitNameMatcher = /** @class */ (function () {
function SplitNameMatcher(root) { function SplitNameMatcher(root) {
this.root = root; this.root = root;
this.reset(); this.reset();
@@ -142,17 +142,17 @@ var SplitNameMatcher = (function () {
}; };
return SplitNameMatcher; return SplitNameMatcher;
}()); }());
var SplitNameLookup = (function () { var SplitNameLookup = /** @class */ (function () {
function SplitNameLookup() { function SplitNameLookup() {
this.root = new SplitNameNode(); this.root = new SplitNameNode();
} }
SplitNameLookup.prototype.addName = function (name) { SplitNameLookup.prototype.addName = function (name) {
var spacedName = name.replace(/([A-Z])/g, " $1"); var spacedName = name.replace(/([A-Z])/g, ' $1');
var segments = spacedName.trim().toLowerCase().split(" "); var segments = spacedName.trim().toLowerCase().split(' ');
var currNode = this.root; var currNode = this.root;
segments.forEach(function (segment, index) { segments.forEach(function (segment, index) {
var value = ""; var value = '';
if (index == (segments.length - 1)) { if (index === (segments.length - 1)) {
value = name; value = name;
} }
var childNode = currNode.children[segment]; var childNode = currNode.children[segment];
@@ -165,10 +165,10 @@ var SplitNameLookup = (function () {
}; };
return SplitNameLookup; return SplitNameLookup;
}()); }());
var WordScanner = (function () { var WordScanner = /** @class */ (function () {
function WordScanner(text) { function WordScanner(text) {
this.text = text; this.text = text;
this.separators = " \n\r\t.;:<>[]&|"; this.separators = ' \n\r\t.;:<>[]&|';
this.index = 0; this.index = 0;
this.nextSeparator = 0; this.nextSeparator = 0;
this.next(); this.next();
@@ -208,9 +208,9 @@ function handleLinksInBodyText(aggData, docFilePath, text, wrapInlineCode) {
var matcher = new SplitNameMatcher(aggData.nameLookup.root); var matcher = new SplitNameMatcher(aggData.nameLookup.root);
for (var scanner = new WordScanner(text); !scanner.finished(); scanner.next()) { for (var scanner = new WordScanner(text); !scanner.finished(); scanner.next()) {
var word = scanner.current var word = scanner.current
.replace(/'s$/, "") .replace(/'s$/, '')
.replace(/^[;:,\."']+/g, "") .replace(/^[;:,\."']+/g, '')
.replace(/[;:,\."']+$/g, ""); .replace(/[;:,\."']+$/g, '');
var link = resolveTypeLink(aggData, docFilePath, word); var link = resolveTypeLink(aggData, docFilePath, word);
var matchStart = void 0; var matchStart = void 0;
if (!link) { if (!link) {
@@ -261,13 +261,9 @@ function handleLinksInBodyText(aggData, docFilePath, text, wrapInlineCode) {
function resolveTypeLink(aggData, docFilePath, text) { function resolveTypeLink(aggData, docFilePath, text) {
var possTypeName = cleanTypeName(text); var possTypeName = cleanTypeName(text);
if (possTypeName === 'constructor') { if (possTypeName === 'constructor') {
return ""; return '';
} }
/*
let ref: Reflection = aggData.projData.findReflectionByName(possTypeName);
*/
var classInfo = aggData.classInfo[possTypeName]; var classInfo = aggData.classInfo[possTypeName];
//if (ref && isLinkable(ref.kind)) {
if (linkOverrides[possTypeName.toLowerCase()]) { if (linkOverrides[possTypeName.toLowerCase()]) {
return ''; return '';
} }
@@ -277,16 +273,14 @@ function resolveTypeLink(aggData, docFilePath, text) {
else if (classInfo) { else if (classInfo) {
var kebabName = ngHelpers.kebabifyClassName(possTypeName); var kebabName = ngHelpers.kebabifyClassName(possTypeName);
var possDocFile = aggData.docFiles[kebabName]; var possDocFile = aggData.docFiles[kebabName];
//let url = "../../" + classInfo.sourcePath;
var url = fixRelSrcUrl(docFilePath, classInfo.sourcePath); var url = fixRelSrcUrl(docFilePath, classInfo.sourcePath);
if (possDocFile) { if (possDocFile) {
//url = "../" + possDocFile;
url = fixRelDocUrl(docFilePath, possDocFile); url = fixRelDocUrl(docFilePath, possDocFile);
} }
return url; return url;
} }
else { else {
return ""; return '';
} }
} }
function fixRelSrcUrl(docPath, srcPath) { function fixRelSrcUrl(docPath, srcPath) {
@@ -313,13 +307,13 @@ function cleanTypeName(text) {
return matches[1]; return matches[1];
} }
else { else {
return text.replace(/\[\]$/, ""); return text.replace(/\[\]$/, '');
} }
} }
function convertNodeToTypeLink(node, text, url, title) { function convertNodeToTypeLink(node, text, url, title) {
if (title === void 0) { title = null; } if (title === void 0) { title = null; }
var linkDisplayText = unist.makeInlineCode(text); var linkDisplayText = unist.makeInlineCode(text);
node.type = "link"; node.type = 'link';
node.title = title; node.title = title;
node.url = url; node.url = url;
node.children = [linkDisplayText]; node.children = [linkDisplayText];

View File

@@ -1,13 +1,11 @@
import * as path from "path"; import * as path from 'path';
import * as unist from '../unistHelpers';
import * as unist from "../unistHelpers"; import * as ngHelpers from '../ngHelpers';
import * as ngHelpers from "../ngHelpers";
const includedNodeTypes = [ const includedNodeTypes = [
"root", "paragraph", "inlineCode", "list", "listItem", 'root', 'paragraph', 'inlineCode', 'list', 'listItem',
"table", "tableRow", "tableCell", "emphasis", "strong", 'table', 'tableRow', 'tableCell', 'emphasis', 'strong',
"link", "text" 'link', 'text'
]; ];
let externalNameLinks; let externalNameLinks;
@@ -16,7 +14,7 @@ let linkOverrides;
export function processDocs(mdCache, aggData) { export function processDocs(mdCache, aggData) {
initPhase(aggData, mdCache); initPhase(aggData, mdCache);
var pathnames = Object.keys(mdCache); const pathnames = Object.keys(mdCache);
pathnames.forEach(pathname => { pathnames.forEach(pathname => {
updateFile(mdCache[pathname].mdOutTree, pathname, aggData); updateFile(mdCache[pathname].mdOutTree, pathname, aggData);
@@ -34,15 +32,15 @@ function initPhase(aggData, mdCache) {
aggData.docFiles = {}; aggData.docFiles = {};
aggData.nameLookup = new SplitNameLookup(); aggData.nameLookup = new SplitNameLookup();
let docFilePaths = Object.keys(mdCache); const docFilePaths = Object.keys(mdCache);
docFilePaths.forEach(docFilePath => { docFilePaths.forEach(docFilePath => {
let relPath = docFilePath.substring(docFilePath.indexOf('docs') + 5).replace(/\\/g, "/"); const relPath = docFilePath.substring(docFilePath.indexOf('docs') + 5).replace(/\\/g, '/');
let compName = path.basename(relPath, ".md"); const compName = path.basename(relPath, '.md');
aggData.docFiles[compName] = relPath; aggData.docFiles[compName] = relPath;
}); });
let classNames = Object.keys(aggData.classInfo); const classNames = Object.keys(aggData.classInfo);
classNames.forEach(currClassName => { classNames.forEach(currClassName => {
if (currClassName.match(/(Component|Directive|Interface|Model|Pipe|Service|Widget)$/)) { if (currClassName.match(/(Component|Directive|Interface|Model|Pipe|Service|Widget)$/)) {
@@ -55,27 +53,26 @@ function updateFile(tree, pathname, aggData) {
traverseMDTree(tree); traverseMDTree(tree);
return true; return true;
function traverseMDTree(node) { function traverseMDTree(node) {
if (!includedNodeTypes.includes(node.type)) { if (!includedNodeTypes.includes(node.type)) {
return; return;
} }
if (node.type === "link") { if (node.type === 'link') {
if (node.children[0] && ( if (node.children[0] && (
(node.children[0].type === "inlineCode") || (node.children[0].type === 'inlineCode') ||
(node.children[0].type === "text") (node.children[0].type === 'text')
)) { )) {
let link = resolveTypeLink(aggData, pathname, node.children[0].value); const link = resolveTypeLink(aggData, pathname, node.children[0].value);
if (link) { if (link) {
convertNodeToTypeLink(node, node.children[0].value, link); convertNodeToTypeLink(node, node.children[0].value, link);
} }
} }
} else if ((node.children) && (node.type !== "heading")) { } else if ((node.children) && (node.type !== 'heading')) {
node.children.forEach((child, index) => { node.children.forEach((child, index) => {
if ((child.type === "text") || (child.type === "inlineCode")) { if ((child.type === 'text') || (child.type === 'inlineCode')) {
let newNodes = handleLinksInBodyText(aggData, pathname, child.value, child.type === 'inlineCode'); const newNodes = handleLinksInBodyText(aggData, pathname, child.value, child.type === 'inlineCode');
node.children.splice(index, 1, ...newNodes); node.children.splice(index, 1, ...newNodes);
} else { } else {
traverseMDTree(child); traverseMDTree(child);
@@ -85,11 +82,10 @@ function updateFile(tree, pathname, aggData) {
} }
} }
class SplitNameNode { class SplitNameNode {
children: {}; children: {};
constructor(public key: string = "", public value: string = "") { constructor(public key: string = '', public value: string = '') {
this.children = {}; this.children = {};
} }
@@ -98,17 +94,14 @@ class SplitNameNode {
} }
} }
class SplitNameMatchElement { class SplitNameMatchElement {
constructor(public node: SplitNameNode, public textPos: number) {} constructor(public node: SplitNameNode, public textPos: number) {}
} }
class SplitNameMatchResult { class SplitNameMatchResult {
constructor(public value: string, public startPos: number) {} constructor(public value: string, public startPos: number) {}
} }
class SplitNameMatcher { class SplitNameMatcher {
matches: SplitNameMatchElement[]; matches: SplitNameMatchElement[];
@@ -118,13 +111,13 @@ class SplitNameMatcher {
/* Returns all names that match when this word is added. */ /* Returns all names that match when this word is added. */
nextWord(word: string, textPos: number): SplitNameMatchResult[] { nextWord(word: string, textPos: number): SplitNameMatchResult[] {
let result = []; const result = [];
this.matches.push(new SplitNameMatchElement(this.root, textPos)); this.matches.push(new SplitNameMatchElement(this.root, textPos));
for (let i = this.matches.length - 1; i >= 0; i--) { for (let i = this.matches.length - 1; i >= 0; i--) {
if (this.matches[i].node.children) { if (this.matches[i].node.children) {
let child = this.matches[i].node.children[word]; const child = this.matches[i].node.children[word];
if (child) { if (child) {
if (child.value) { if (child.value) {
@@ -158,7 +151,6 @@ class SplitNameMatcher {
} }
} }
class SplitNameLookup { class SplitNameLookup {
root: SplitNameNode; root: SplitNameNode;
@@ -167,15 +159,15 @@ class SplitNameLookup {
} }
addName(name: string) { addName(name: string) {
let spacedName = name.replace(/([A-Z])/g, " $1"); const spacedName = name.replace(/([A-Z])/g, ' $1');
let segments = spacedName.trim().toLowerCase().split(" "); const segments = spacedName.trim().toLowerCase().split(' ');
let currNode = this.root; let currNode = this.root;
segments.forEach((segment, index) => { segments.forEach((segment, index) => {
let value = ""; let value = '';
if (index == (segments.length - 1)) { if (index === (segments.length - 1)) {
value = name; value = name;
} }
@@ -198,7 +190,7 @@ class WordScanner {
current: string; current: string;
constructor(public text: string) { constructor(public text: string) {
this.separators = " \n\r\t.;:<>[]&|"; this.separators = ' \n\r\t.;:<>[]&|';
this.index = 0; this.index = 0;
this.nextSeparator = 0; this.nextSeparator = 0;
this.next(); this.next();
@@ -238,32 +230,32 @@ class WordScanner {
} }
function handleLinksInBodyText(aggData, docFilePath: string, text: string, wrapInlineCode: boolean = false): Node[] { function handleLinksInBodyText(aggData, docFilePath: string, text: string, wrapInlineCode: boolean = false): Node[] {
let result = []; const result = [];
let currTextStart = 0; let currTextStart = 0;
let matcher = new SplitNameMatcher(aggData.nameLookup.root); const matcher = new SplitNameMatcher(aggData.nameLookup.root);
for (let scanner = new WordScanner(text); !scanner.finished(); scanner.next()) { for (const scanner = new WordScanner(text); !scanner.finished(); scanner.next()) {
let word = scanner.current const word = scanner.current
.replace(/'s$/, "") .replace(/'s$/, '')
.replace(/^[;:,\."']+/g, "") .replace(/^[;:,\."']+/g, '')
.replace(/[;:,\."']+$/g, ""); .replace(/[;:,\."']+$/g, '');
let link = resolveTypeLink(aggData, docFilePath, word); let link = resolveTypeLink(aggData, docFilePath, word);
let matchStart; let matchStart;
if (!link) { if (!link) {
let match = matcher.nextWord(word.toLowerCase(), scanner.index); const match = matcher.nextWord(word.toLowerCase(), scanner.index);
if (match && match[0]) { if (match && match[0]) {
link = resolveTypeLink(aggData, docFilePath, match[0].value); link = resolveTypeLink(aggData, docFilePath, match[0].value);
matchStart = match[0].startPos; matchStart = match[0].startPos;
} }
} else { } else {
matchStart = scanner.index matchStart = scanner.index;
} }
if (link) { if (link) {
let linkText = text.substring(matchStart, scanner.nextSeparator); const linkText = text.substring(matchStart, scanner.nextSeparator);
let linkTitle; let linkTitle;
if (wrapInlineCode) { if (wrapInlineCode) {
@@ -272,8 +264,8 @@ function handleLinksInBodyText(aggData, docFilePath: string, text: string, wrapI
linkTitle = unist.makeText(linkText); linkTitle = unist.makeText(linkText);
} }
let linkNode = unist.makeLink(linkTitle, link); const linkNode = unist.makeLink(linkTitle, link);
let prevText = text.substring(currTextStart, matchStart); const prevText = text.substring(currTextStart, matchStart);
if (prevText) { if (prevText) {
if (wrapInlineCode) { if (wrapInlineCode) {
@@ -289,7 +281,7 @@ function handleLinksInBodyText(aggData, docFilePath: string, text: string, wrapI
} }
} }
let remainingText = text.substring(currTextStart, text.length); const remainingText = text.substring(currTextStart, text.length);
if (remainingText) { if (remainingText) {
if (wrapInlineCode) { if (wrapInlineCode) {
@@ -302,23 +294,22 @@ function handleLinksInBodyText(aggData, docFilePath: string, text: string, wrapI
return result; return result;
} }
function resolveTypeLink(aggData, docFilePath, text): string { function resolveTypeLink(aggData, docFilePath, text): string {
let possTypeName = cleanTypeName(text); const possTypeName = cleanTypeName(text);
if (possTypeName === 'constructor') { if (possTypeName === 'constructor') {
return ""; return '';
} }
let classInfo = aggData.classInfo[possTypeName]; const classInfo = aggData.classInfo[possTypeName];
if (linkOverrides[possTypeName.toLowerCase()]) { if (linkOverrides[possTypeName.toLowerCase()]) {
return ''; return '';
} else if (externalNameLinks[possTypeName]) { } else if (externalNameLinks[possTypeName]) {
return externalNameLinks[possTypeName]; return externalNameLinks[possTypeName];
} else if (classInfo) { } else if (classInfo) {
let kebabName = ngHelpers.kebabifyClassName(possTypeName); const kebabName = ngHelpers.kebabifyClassName(possTypeName);
let possDocFile = aggData.docFiles[kebabName]; const possDocFile = aggData.docFiles[kebabName];
let url = fixRelSrcUrl(docFilePath, classInfo.sourcePath); let url = fixRelSrcUrl(docFilePath, classInfo.sourcePath);
@@ -328,13 +319,13 @@ function resolveTypeLink(aggData, docFilePath, text): string {
return url; return url;
} else { } else {
return ""; return '';
} }
} }
function fixRelSrcUrl(docPath: string, srcPath: string) { function fixRelSrcUrl(docPath: string, srcPath: string) {
let relDocPath = docPath.substring(docPath.indexOf('docs')); const relDocPath = docPath.substring(docPath.indexOf('docs'));
let docPathSegments = relDocPath.split(/[\\\/]/); const docPathSegments = relDocPath.split(/[\\\/]/);
let dotPathPart = ''; let dotPathPart = '';
for (let i = 0; i < (docPathSegments.length - 1); i++) { for (let i = 0; i < (docPathSegments.length - 1); i++) {
@@ -345,8 +336,8 @@ function fixRelSrcUrl(docPath: string, srcPath: string) {
} }
function fixRelDocUrl(docPathFrom: string, docPathTo: string) { function fixRelDocUrl(docPathFrom: string, docPathTo: string) {
let relDocPathFrom = docPathFrom.substring(docPathFrom.indexOf('docs')); const relDocPathFrom = docPathFrom.substring(docPathFrom.indexOf('docs'));
let docPathSegments = relDocPathFrom.split(/[\\\/]/); const docPathSegments = relDocPathFrom.split(/[\\\/]/);
let dotPathPart = ''; let dotPathPart = '';
for (let i = 0; i < (docPathSegments.length - 2); i++) { for (let i = 0; i < (docPathSegments.length - 2); i++) {
@@ -357,18 +348,18 @@ function fixRelDocUrl(docPathFrom: string, docPathTo: string) {
} }
function cleanTypeName(text) { function cleanTypeName(text) {
let matches = text.match(/[a-zA-Z0-9_]+<([a-zA-Z0-9_]+)(\[\])?>/); const matches = text.match(/[a-zA-Z0-9_]+<([a-zA-Z0-9_]+)(\[\])?>/);
if (matches) { if (matches) {
return matches[1]; return matches[1];
} else { } else {
return text.replace(/\[\]$/, ""); return text.replace(/\[\]$/, '');
} }
} }
function convertNodeToTypeLink(node, text, url, title = null) { function convertNodeToTypeLink(node, text, url, title = null) {
let linkDisplayText = unist.makeInlineCode(text); const linkDisplayText = unist.makeInlineCode(text);
node.type = "link"; node.type = 'link';
node.title = title; node.title = title;
node.url = url; node.url = url;
node.children = [linkDisplayText]; node.children = [linkDisplayText];

View File

@@ -1,19 +1,24 @@
{ {
"compilerOptions": { "compilerOptions": {
"outDir": ".", "outDir": ".",
"baseUrl": ".", "baseUrl": ".",
"moduleResolution": "node", "moduleResolution": "node",
"noUnusedLocals": true, "noUnusedLocals": true,
"target": "es5", "target": "es5",
"types": ["node", "@paperist/types-remark"], "types": ["node", "@paperist/types-remark"],
"lib": [ "typeRoots": ["node_modules/@types"],
"es2015" "lib": ["es2018", "dom"]
] },
}, "files": [
"files": [ "remarkGraphQl.ts",
"remarkGraphQl.ts", "mqDefs.ts",
"mqDefs.ts", "tools/fileChecker.ts",
"tools/gqIndex.ts", "tools/gqIndex.ts",
"tools/linkFixer.ts" "tools/linkFixer.ts",
] "tools/sourceLinker.ts",
} "tools/tsInfo.ts",
"tools/tutorialIndex.ts",
"tools/typeLinker.ts"
// "reviewChecker.ts"
]
}