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-->
- [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-->

View File

@@ -1,5 +1,5 @@
<div id="userinfo_container" [class.adf-userinfo-name-right]="showOnRight()" (keyup)="onKeyPress($event)"
class="adf-userinfo-container" *ngIf="isLoggedIn()">
<div id="userinfo_container" [class.adf-userinfo-name-right]="showOnRight" (keyup)="onKeyPress($event)"
class="adf-userinfo-container" *ngIf="isLoggedIn">
<ng-container *ngIf="showName">
<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();
}
loadEcmUserInfo(): void {
private loadEcmUserInfo(): void {
this.ecmUser$ = this.ecmUserService.getCurrentUserInfo();
}
loadBpmUserInfo() {
private loadBpmUserInfo() {
this.bpmUser$ = this.bpmUserService.getCurrentUserInfo();
}
loadIdentityUserInfo() {
private loadIdentityUserInfo() {
this.identityUser$ = of(this.identityUserService.getCurrentUserInfo());
}
stopClosing(event) {
stopClosing(event: Event) {
event.stopPropagation();
}
@@ -128,7 +128,7 @@ export class UserInfoComponent implements OnInit {
return this.bpmUserService.getCurrentUserProfileImage();
}
showOnRight(): boolean {
get showOnRight(): boolean {
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": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@phenomnomnominal/tsquery/-/tsquery-3.0.0.tgz",
@@ -1493,9 +1499,9 @@
"dev": true
},
"@types/node": {
"version": "6.0.90",
"resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.90.tgz",
"integrity": "sha512-tXoGRVdi7wZX7P1VWoV9Wfk0uYDOAHdEYXAttuWgSrN76Q32wQlSrMX0Rgyv3RTEaQY2ZLQrzYHVM2e8rfo8sA==",
"version": "12.7.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.3.tgz",
"integrity": "sha512-3SiLAIBkDWDg6vFo0+5YJyHPWU9uwu40Qe+v+0MH8wRKYBimHvvAOyk3EzMrD/TrIlLYfXrqDqrg913PynrMJQ==",
"dev": true
},
"@types/q": {
@@ -6520,28 +6526,28 @@
"dependencies": {
"abbrev": {
"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==",
"dev": true,
"optional": true
},
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"resolved": false,
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
"resolved": false,
"integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
"dev": true,
"optional": true
},
"are-we-there-yet": {
"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==",
"dev": true,
"optional": true,
@@ -6552,14 +6558,14 @@
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"resolved": false,
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"resolved": false,
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"optional": true,
@@ -6570,42 +6576,42 @@
},
"chownr": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz",
"resolved": false,
"integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==",
"dev": true,
"optional": true
},
"code-point-at": {
"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=",
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"resolved": false,
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true,
"optional": true
},
"console-control-strings": {
"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=",
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"resolved": false,
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
"dev": true,
"optional": true
},
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"resolved": false,
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"dev": true,
"optional": true,
@@ -6615,28 +6621,28 @@
},
"deep-extend": {
"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==",
"dev": true,
"optional": true
},
"delegates": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
"resolved": false,
"integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=",
"dev": true,
"optional": true
},
"detect-libc": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
"resolved": false,
"integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=",
"dev": true,
"optional": true
},
"fs-minipass": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz",
"resolved": false,
"integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==",
"dev": true,
"optional": true,
@@ -6646,14 +6652,14 @@
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"resolved": false,
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true,
"optional": true
},
"gauge": {
"version": "2.7.4",
"resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
"resolved": false,
"integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
"dev": true,
"optional": true,
@@ -6670,7 +6676,7 @@
},
"glob": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
"resolved": false,
"integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
"dev": true,
"optional": true,
@@ -6685,14 +6691,14 @@
},
"has-unicode": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
"resolved": false,
"integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=",
"dev": true,
"optional": true
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"resolved": false,
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"dev": true,
"optional": true,
@@ -6702,7 +6708,7 @@
},
"ignore-walk": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz",
"resolved": false,
"integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==",
"dev": true,
"optional": true,
@@ -6712,7 +6718,7 @@
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"resolved": false,
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"dev": true,
"optional": true,
@@ -6723,21 +6729,21 @@
},
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"resolved": false,
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
"resolved": false,
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
"dev": true,
"optional": true
},
"is-fullwidth-code-point": {
"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=",
"dev": true,
"optional": true,
@@ -6747,14 +6753,14 @@
},
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"resolved": false,
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
"dev": true,
"optional": true
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"resolved": false,
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"optional": true,
@@ -6764,14 +6770,14 @@
},
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"resolved": false,
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true,
"optional": true
},
"minipass": {
"version": "2.3.5",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz",
"resolved": false,
"integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==",
"dev": true,
"optional": true,
@@ -6782,7 +6788,7 @@
},
"minizlib": {
"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==",
"dev": true,
"optional": true,
@@ -6792,7 +6798,7 @@
},
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"resolved": false,
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true,
"optional": true,
@@ -6802,14 +6808,14 @@
},
"ms": {
"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==",
"dev": true,
"optional": true
},
"needle": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/needle/-/needle-2.3.0.tgz",
"resolved": false,
"integrity": "sha512-QBZu7aAFR0522EyaXZM0FZ9GLpq6lvQ3uq8gteiDUp7wKdy0lSd2hPlgFwVuW1CBkfEs9PfDQsQzZghLs/psdg==",
"dev": true,
"optional": true,
@@ -6821,7 +6827,7 @@
},
"node-pre-gyp": {
"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==",
"dev": true,
"optional": true,
@@ -6840,7 +6846,7 @@
},
"nopt": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz",
"resolved": false,
"integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=",
"dev": true,
"optional": true,
@@ -6851,14 +6857,14 @@
},
"npm-bundled": {
"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==",
"dev": true,
"optional": true
},
"npm-packlist": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.1.tgz",
"resolved": false,
"integrity": "sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw==",
"dev": true,
"optional": true,
@@ -6869,7 +6875,7 @@
},
"npmlog": {
"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==",
"dev": true,
"optional": true,
@@ -6882,21 +6888,21 @@
},
"number-is-nan": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
"resolved": false,
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"resolved": false,
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
"dev": true,
"optional": true
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"resolved": false,
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true,
"optional": true,
@@ -6906,21 +6912,21 @@
},
"os-homedir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
"resolved": false,
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
"dev": true,
"optional": true
},
"os-tmpdir": {
"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=",
"dev": true,
"optional": true
},
"osenv": {
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz",
"resolved": false,
"integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
"dev": true,
"optional": true,
@@ -6931,21 +6937,21 @@
},
"path-is-absolute": {
"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=",
"dev": true,
"optional": true
},
"process-nextick-args": {
"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==",
"dev": true,
"optional": true
},
"rc": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
"resolved": false,
"integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
"dev": true,
"optional": true,
@@ -6958,7 +6964,7 @@
"dependencies": {
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"resolved": false,
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"dev": true,
"optional": true
@@ -6967,7 +6973,7 @@
},
"readable-stream": {
"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==",
"dev": true,
"optional": true,
@@ -6983,7 +6989,7 @@
},
"rimraf": {
"version": "2.6.3",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
"resolved": false,
"integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
"dev": true,
"optional": true,
@@ -6993,49 +6999,49 @@
},
"safe-buffer": {
"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==",
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"resolved": false,
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true,
"optional": true
},
"sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
"resolved": false,
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
"dev": true,
"optional": true
},
"semver": {
"version": "5.7.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
"resolved": false,
"integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
"dev": true,
"optional": true
},
"set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"resolved": false,
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
"dev": true,
"optional": true
},
"signal-exit": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
"resolved": false,
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
"dev": true,
"optional": true
},
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"resolved": false,
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"dev": true,
"optional": true,
@@ -7047,7 +7053,7 @@
},
"string_decoder": {
"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==",
"dev": true,
"optional": true,
@@ -7057,7 +7063,7 @@
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"resolved": false,
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"optional": true,
@@ -7067,14 +7073,14 @@
},
"strip-json-comments": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
"resolved": false,
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
"dev": true,
"optional": true
},
"tar": {
"version": "4.4.8",
"resolved": "https://registry.npmjs.org/tar/-/tar-4.4.8.tgz",
"resolved": false,
"integrity": "sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==",
"dev": true,
"optional": true,
@@ -7090,14 +7096,14 @@
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"resolved": false,
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
"dev": true,
"optional": true
},
"wide-align": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
"resolved": false,
"integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
"dev": true,
"optional": true,
@@ -7107,14 +7113,14 @@
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"resolved": false,
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true,
"optional": true
},
"yallist": {
"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==",
"dev": true,
"optional": true
@@ -10687,6 +10693,12 @@
"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": {
"version": "1.1.1",
"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",
"00": "echo -------------------------------------------- DOC -----------------------------------------------",
"00s": "",
"build-doc-tools": "tsc -p ./tools/doc/tsconfig.json",
"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",
"license-checker": "license-checker --production --failOn 'GPL' > licenses.txt",
@@ -126,10 +127,11 @@
"@angular/compiler-cli": "^7.2.15",
"@nrwl/nx": "7.1.1",
"@nrwl/schematics": "7.1.1",
"@paperist/types-remark": "^0.1.3",
"@types/hammerjs": "2.0.35",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/node": "6.0.90",
"@types/node": "^12.7.3",
"@types/selenium-webdriver": "^3.0.8",
"ajv-cli": "^3.0.0",
"bundlesize": "^0.17.2",
@@ -167,6 +169,7 @@
"lite-server": "^2.4.0",
"lodash.wrap": "^4.1.1",
"markdownlint-cli": "^0.16.0",
"mdast": "^3.0.0",
"mdast-util-compact": "^1.0.1",
"mdast-util-heading-range": "^2.1.0",
"mdast-util-toc": "^2.0.1",

View File

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

View File

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

View File

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

View File

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

View File

@@ -10,15 +10,15 @@ var MQ = require("./mqDefs");
var docFilePath = path.resolve('..', '..', 'docs', 'core', 'about.component.md');
var docSrc = fs.readFileSync(docFilePath, 'utf8');
var tree = remark()
.use(frontMatter, ["yaml"])
.use(frontMatter, ['yaml'])
.parse(docSrc);
tree = removePosInfo(tree);
//console.log(JSON.stringify(tree));
var schema = graphql_1.buildSchema(MQ.schema);
var root = {
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";
graphql_1.graphql(schema, query, root).then(function (response) {
// tslint:disable-next-line: no-console
console.log(JSON.stringify(response));
});

View File

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

View File

@@ -1,4 +1,5 @@
"use strict";
// tslint:disable: no-console
Object.defineProperty(exports, "__esModule", { value: true });
var path = require("path");
var fs = require("fs");
@@ -8,27 +9,20 @@ var remark = require("remark");
var frontMatter = require("remark-frontmatter");
var yaml = require("js-yaml");
var moment = require("moment");
var Rx_1 = require("rxjs/Rx");
var rxjs_1 = require("rxjs");
var libsearch = require("./libsearch");
var stoplist_1 = require("./stoplist");
var adf20StartDate = "2017-11-20";
var adf20StartDate = '2017-11-20';
var commitWeight = 0.1;
var scoreTimeBase = 60;
var libFolder = "lib";
var stoplistFilePath = path.resolve("tools", "doc", "commitStoplist.json");
var libFolder = 'lib';
var stoplistFilePath = path.resolve('tools', 'doc', 'commitStoplist.json');
var angFilePattern = /(component)|(directive)|(model)|(pipe)|(service)|(widget)/;
var srcData = {};
var stoplist = new stoplist_1.Stoplist(stoplistFilePath);
var docsFolderPath = path.resolve("docs");
var libFolders = ["core", "content-services", "extensions", "insights", "process-services", "process-services-cloud"];
var docsFolderPath = path.resolve('docs');
var libFolders = ['core', 'content-services', 'extensions', 'insights', 'process-services', 'process-services-cloud'];
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 client = new graphql_request_1.GraphQLClient('https://api.github.com/graphql', {
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 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'");
docNames.subscribe(function (x) {
var key = path.basename(x, ".md");
if (!srcData[key])
var key = path.basename(x, '.md');
if (!srcData[key]) {
return;
}
var vars = {
"path": "lib/" + srcData[key].path
'path': 'lib/' + srcData[key].path
};
client.request(query, vars).then(function (data) {
var nodes = data["repository"].ref.target.history.nodes;
var lastReviewDate = getDocReviewDate(x); //(key + ".md");
var nodes = data['repository'].ref.target.history.nodes;
var lastReviewDate = getDocReviewDate(x); // (key + ".md");
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);
console.log("'" + key + "','" + dateString + "','" + numUsefulCommits + "','" + score + "'");
});
@@ -63,12 +58,13 @@ function priorityScore(reviewDate, numCommits) {
function getDocReviewDate(docFileName) {
var mdFilePath = path.resolve(docsFolderPath, docFileName);
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);
if (tree.children[0].type == "yaml") {
if (tree.children[0].type === 'yaml') {
var metadata = yaml.load(tree.children[0].value);
if (metadata["Last reviewed"])
lastReviewDate = moment(metadata["Last reviewed"]);
if (metadata['Last reviewed']) {
lastReviewDate = moment(metadata['Last reviewed']);
}
}
return lastReviewDate;
}
@@ -76,7 +72,7 @@ function extractCommitInfo(commitNodes, cutOffDate, stoplist) {
var numUsefulCommits = 0;
commitNodes.forEach(function (element) {
if (!stoplist.isRejected(element.message)) {
var abbr = element.message.substr(0, 15);
// const abbr = element.message.substr(0, 15);
var commitDate = moment(element.pushedDate);
if (commitDate.isAfter(cutOffDate)) {
numUsefulCommits++;
@@ -90,31 +86,18 @@ function getDocFilePaths(folderPath) {
libFolders.forEach(function (element) {
var libPath = path.resolve(folderPath, element);
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;
function addItemsRecursively(folderPath, resultList) {
var items = fs.readdirSync(folderPath);
function addItemsRecursively(elementPath, resultList) {
var items = fs.readdirSync(elementPath);
items.forEach(function (item) {
var fullItemPath = path.resolve(folderPath, item);
var fullItemPath = path.resolve(elementPath, item);
var itemInfo = fs.statSync(fullItemPath);
if (itemInfo.isDirectory()) {
addItemsRecursively(fullItemPath, resultList);
}
else if ((path.extname(fullItemPath) === ".md") &&
(item !== "README.md") &&
else if ((path.extname(fullItemPath) === '.md') &&
(item !== 'README.md') &&
(item.match(angFilePattern))) {
resultList.push(fullItemPath);
}

View File

@@ -1,35 +1,35 @@
import * as path from "path";
import * as fs from "fs";
import * as process from "process"
// tslint:disable: no-console
import { GraphQLClient } from "graphql-request";
import * as remark from "remark";
import * as frontMatter from "remark-frontmatter";
import * as yaml from "js-yaml";
import * as moment from "moment";
import { Observable } from 'rxjs/Rx';
import * as path from 'path';
import * as fs from 'fs';
import * as process from 'process';
import * as libsearch from "./libsearch";
import { Stoplist } from "./stoplist";
import { last } from "rxjs/operator/last";
import { GraphQLClient } from 'graphql-request';
import * as remark from 'remark';
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 scoreTimeBase = 60;
const libFolder = "lib";
const stoplistFilePath = path.resolve("tools", "doc", "commitStoplist.json");
const libFolder = 'lib';
const stoplistFilePath = path.resolve('tools', 'doc', 'commitStoplist.json');
const angFilePattern = /(component)|(directive)|(model)|(pipe)|(service)|(widget)/;
let srcData = {};
let stoplist = new Stoplist(stoplistFilePath);
const srcData = {};
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));
@@ -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'");
docNames.subscribe(x => {
let key = path.basename(x, ".md");
const key = path.basename(x, '.md');
if (!srcData[key])
if (!srcData[key]) {
return;
}
let vars = {
"path": "lib/" + srcData[key].path
const vars = {
'path': 'lib/' + srcData[key].path
};
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);
let dateString = lastReviewDate.format("YYYY-MM-DD");
let score = priorityScore(lastReviewDate, numUsefulCommits).toPrecision(3);
const numUsefulCommits = extractCommitInfo(nodes, lastReviewDate, stoplist);
const dateString = lastReviewDate.format('YYYY-MM-DD');
const score = priorityScore(lastReviewDate, numUsefulCommits).toPrecision(3);
console.log(`'${key}','${dateString}','${numUsefulCommits}','${score}'`);
});
});
function priorityScore(reviewDate, numCommits) {
let daysSinceReview = moment().diff(reviewDate, 'days');
let commitScore = 2 + numCommits * commitWeight;
const daysSinceReview = moment().diff(reviewDate, 'days');
const commitScore = 2 + numCommits * commitWeight;
return Math.pow(commitScore, daysSinceReview / scoreTimeBase);
}
function getDocReviewDate(docFileName) {
let mdFilePath = path.resolve(docsFolderPath, docFileName);
const mdFilePath = path.resolve(docsFolderPath, docFileName);
let mdText = fs.readFileSync(mdFilePath);
let tree = remark().use(frontMatter, ["yaml"]).parse(mdText);
const mdText = fs.readFileSync(mdFilePath);
const tree = remark().use(frontMatter, ['yaml']).parse(mdText);
let lastReviewDate = moment(adf20StartDate);
if (tree.children[0].type == "yaml") {
let metadata = yaml.load(tree.children[0].value);
if (tree.children[0].type === 'yaml') {
const metadata = yaml.load(tree.children[0].value);
if (metadata["Last reviewed"])
lastReviewDate = moment(metadata["Last reviewed"]);
if (metadata['Last reviewed']) {
lastReviewDate = moment(metadata['Last reviewed']);
}
}
return lastReviewDate;
}
function extractCommitInfo(commitNodes, cutOffDate, stoplist) {
let numUsefulCommits = 0;
commitNodes.forEach(element => {
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)) {
numUsefulCommits++;
@@ -132,30 +131,28 @@ function extractCommitInfo(commitNodes, cutOffDate, stoplist) {
return numUsefulCommits;
}
function getDocFilePaths(folderPath) {
let result = [];
const result = [];
libFolders.forEach(element => {
let libPath = path.resolve(folderPath, element);
const libPath = path.resolve(folderPath, element);
addItemsRecursively(libPath, result);
});
return result;
function addItemsRecursively(folderPath: string, resultList: string[]) {
let items = fs.readdirSync(folderPath);
function addItemsRecursively(elementPath: string, resultList: string[]) {
const items = fs.readdirSync(elementPath);
items.forEach(item => {
let fullItemPath = path.resolve(folderPath, item);
let itemInfo = fs.statSync(fullItemPath);
const fullItemPath = path.resolve(elementPath, item);
const itemInfo = fs.statSync(fullItemPath);
if (itemInfo.isDirectory()) {
addItemsRecursively(fullItemPath, resultList);
} else if (
(path.extname(fullItemPath) === ".md") &&
(item !== "README.md") &&
(path.extname(fullItemPath) === '.md') &&
(item !== 'README.md') &&
(item.match(angFilePattern))
) {
resultList.push(fullItemPath);

View File

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

View File

@@ -1,7 +1,8 @@
let undocMethodNames = {
"ngOnChanges": 1
};
const skipMethodNames = [
'ngOnChanges',
'ngOnDestroy',
'ngOnInit'
];
export class PropInfo {
name: string;
@@ -15,26 +16,25 @@ export class PropInfo {
errorMessages: string[];
constructor(sourceData) {
this.errorMessages = [];
this.name = sourceData.name;
this.docText = sourceData.summary || "";
this.docText = this.docText.replace(/[\n\r]+/g, " ").trim();
this.docText = sourceData.summary || '';
this.docText = this.docText.replace(/[\n\r]+/g, ' ').trim();
let tempDefaultVal = sourceData.syntax["return"].defaultValue;
this.defaultValue = tempDefaultVal ? tempDefaultVal.toString() : "";
this.defaultValue = this.defaultValue.replace(/\|/, "\\|");
this.type = sourceData.syntax["return"].type || "";
this.type = this.type.toString().replace(/\|/, "\\|");
const tempDefaultVal = sourceData.syntax['return'].defaultValue;
this.defaultValue = tempDefaultVal ? tempDefaultVal.toString() : '';
this.defaultValue = this.defaultValue.replace(/\|/, '\\|');
this.type = sourceData.syntax['return'].type || '';
this.type = this.type.toString().replace(/\|/, '\\|');
if (sourceData.tags) {
let depTag = sourceData.tags.find(tag => tag.name === "deprecated");
const depTag = sourceData.tags.find(tag => tag.name === 'deprecated');
if (depTag) {
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,15 +43,15 @@ export class PropInfo {
if (sourceData.decorators) {
sourceData.decorators.forEach(dec => {
//console.log(dec);
if (dec.name === "Input") {
if (dec.name === 'Input') {
this.isInput = true;
if (dec.arguments) {
let bindingName = dec.arguments["bindingPropertyName"];
const bindingName = dec.arguments['bindingPropertyName'];
if (bindingName && (bindingName !== ""))
this.name = bindingName.replace(/['"]/g, "");
if (bindingName && (bindingName !== '')) {
this.name = bindingName.replace(/['"]/g, '');
}
}
if (!this.docText && !this.isDeprecated) {
@@ -59,7 +59,7 @@ export class PropInfo {
}
}
if (dec.name === "Output") {
if (dec.name === 'Output') {
this.isOutput = true;
if (!this.docText && !this.isDeprecated) {
@@ -73,8 +73,7 @@ export class PropInfo {
get errors() {
return this.errorMessages;
}
};
}
export class ParamInfo {
name: string;
@@ -84,17 +83,16 @@ export class ParamInfo {
combined: string;
isOptional: boolean;
constructor(sourceData) {
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.docText = sourceData.description.replace(/[\n\r]+/g, " ").trim();
this.docText = sourceData.description.replace(/[\n\r]+/g, ' ').trim();
this.isOptional = false;
if (sourceData.flags) {
let flag = sourceData.flags.find(flag => flag.name === "isOptional");
const flag = sourceData.flags.find((sourceFlag: any) => sourceFlag.name === 'isOptional');
if (flag) {
this.isOptional = true;
@@ -103,17 +101,18 @@ export class ParamInfo {
this.combined = this.name;
if (this.isOptional)
this.combined += "?";
if (this.isOptional) {
this.combined += '?';
}
this.combined += `: \`${this.type}\``;
if (this.defaultValue !== "")
if (this.defaultValue !== '') {
this.combined += ` = \`${this.defaultValue}\``;
}
}
}
export class MethodSigInfo {
name: string;
docText: string;
@@ -123,28 +122,26 @@ export class MethodSigInfo {
signature: string;
params: ParamInfo[];
isDeprecated: boolean;
errorMessages: string[];
constructor(sourceData) {
this.errorMessages = [];
this.name = sourceData.name;
this.docText = sourceData.summary || "";
this.docText = this.docText.replace(/[\n\r]+/g, " ").trim();
this.docText = sourceData.summary || '';
this.docText = this.docText.replace(/[\n\r]+/g, ' ').trim();
if (!this.docText) {
this.errorMessages.push(`Warning: method "${sourceData.name}" has no doc text.`);
}
this.returnType = sourceData.syntax["return"].type || "";
this.returnType = this.returnType.toString().replace(/\s/g, "");
this.returnsSomething = this.returnType && (this.returnType !== "void");
this.returnDocText = sourceData.syntax["return"].summary || "";
this.returnType = sourceData.syntax['return'].type || '';
this.returnType = this.returnType.toString().replace(/\s/g, '');
this.returnsSomething = this.returnType && (this.returnType !== 'void');
this.returnDocText = sourceData.syntax['return'].summary || '';
if (this.returnDocText.toLowerCase() === "nothing") {
if (this.returnDocText.toLowerCase() === 'nothing') {
this.returnsSomething = false;
}
@@ -155,16 +152,16 @@ export class MethodSigInfo {
this.isDeprecated = false;
if (sourceData.tags) {
let depTag = sourceData.tags.find(tag => tag.name === "deprecated");
const depTag = sourceData.tags.find(tag => tag.name === 'deprecated');
if (depTag) {
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 = [];
let paramStrings = [];
const paramStrings = [];
if (sourceData.syntax.parameters) {
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.`);
}
let param = new ParamInfo(rawParam);
const param = new ParamInfo(rawParam);
this.params.push(param);
paramStrings.push(param.combined);
});
}
this.signature = "(" + paramStrings.join(", ") + ")";
this.signature = '(' + paramStrings.join(', ') + ')';
}
get errors() {
@@ -186,7 +183,6 @@ export class MethodSigInfo {
}
}
export class ComponentInfo {
name: string;
itemType: string;
@@ -198,7 +194,6 @@ export class ComponentInfo {
sourcePath: string;
sourceLine: number;
constructor(sourceData) {
this.name = sourceData.items[0].name;
this.itemType = sourceData.items[0].type;
@@ -218,10 +213,10 @@ export class ComponentInfo {
this.methods = [];
sourceData.items.forEach(item => {
switch(item.type) {
case "property":
case "accessor":
var prop = new PropInfo(item);
switch (item.type) {
case 'property':
case 'accessor':
const prop = new PropInfo(item);
this.properties.push(prop);
if (prop.isInput) {
@@ -233,11 +228,11 @@ export class ComponentInfo {
}
break;
case "method":
case 'method':
if (item.flags && (item.flags.length > 0) &&
!item.flags.find(flag => flag.name === "isPrivate") &&
!item.flags.find(flag => flag.name === "isProtected") &&
!undocMethodNames[item.name]
!item.flags.find(flag => flag.name === 'isPrivate') &&
!item.flags.find(flag => flag.name === 'isProtected') &&
!skipMethodNames.includes(item.name)
) {
this.methods.push(new MethodSigInfo(item));
this.hasMethods = true;
@@ -250,14 +245,13 @@ export class ComponentInfo {
});
}
get errors() {
let combinedErrors = [];
const combinedErrors = [];
this.methods.forEach(method => {
method.errors.forEach(err => {
combinedErrors.push(err);
})
});
});
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. */
export class Stoplist {
regexes: RegExp[];
constructor(slFilePath: string) {
let listExpressions = JSON.parse(fs.readFileSync(slFilePath, 'utf8'));
const listExpressions = JSON.parse(fs.readFileSync(slFilePath, 'utf8'));
this.regexes = [];
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]));
}
} else {
@@ -19,7 +19,7 @@ export class Stoplist {
// Check if an item is covered by the stoplist and reject it if so.
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)) {
return true;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,38 +1,38 @@
// tslint:disable: no-console
import * as path from 'path';
import * as fs from 'fs';
import { selectAll } from 'unist-util-select';
import { MDAST } from 'mdast';
const suffixesNotToCheck = /\.ts/;
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 => {
let tree = mdCache[pathname].mdOutTree;
const tree = mdCache[pathname].mdOutTree;
fixUrls(tree, pathname, linkSet, 'link');
fixUrls(tree, pathname, imageSet, 'image');
});
}
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 => {
let origFullUrlPath = path.resolve(path.dirname(docFilePath), linkElem.url);
let hashPos = origFullUrlPath.indexOf('#');
const hashPos = origFullUrlPath.indexOf('#');
let anchor = '';
if (hashPos !== -1) {
@@ -45,8 +45,8 @@ function fixUrls(tree: MDAST.Root, docFilePath: string, linkSet: LinkSet, select
(origFullUrlPath !== '') &&
!fs.existsSync(origFullUrlPath)
) {
let newUrl = linkSet.update(origFullUrlPath) || origFullUrlPath;
linkElem.url = path.relative(path.dirname(docFilePath), newUrl).replace(/\\/g,'/') + anchor;
const newUrl = linkSet.update(origFullUrlPath) || origFullUrlPath;
linkElem.url = path.relative(path.dirname(docFilePath), newUrl).replace(/\\/g, '/') + anchor;
errors.push(`Bad link: ${origFullUrlPath}\nReplacing with ${linkElem.url}`);
} /*else {
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[]) {
console.group(groupName);
@@ -75,7 +74,6 @@ function getImagePaths(imageFolderPath: string): string[] {
.map(imageFileName => path.resolve(imageFolderPath, imageFileName));
}
class LinkSet {
links: Map<string, string[]>;
@@ -83,10 +81,10 @@ class LinkSet {
this.links = new Map();
urls.forEach(url => {
let fileName = path.basename(url);
const fileName = path.basename(url);
if (this.links.has(fileName)) {
let item = this.links.get(fileName);
const item = this.links.get(fileName);
item.push(url);
} else {
this.links.set(fileName, [url]);
@@ -95,12 +93,12 @@ class LinkSet {
}
update(oldUrl: string): string {
let oldFileName = path.basename(oldUrl);
const oldFileName = path.basename(oldUrl);
if (!this.links.has(oldFileName)) {
return '';
} else {
let candidates = this.links.get(oldFileName);
const candidates = this.links.get(oldFileName);
if (candidates.length === 1) {
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";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
var path = require("path");
var unist_util_select_1 = require("unist-util-select");
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 relDocPath = pathname.substring(pathname.indexOf('docs'));
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];
titleHeading.children[0] = {
type: 'link',
@@ -27,9 +27,9 @@ function processDocs(mdCache, aggData) {
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];
linkElem.url = srcUrl,
linkElem.url = srcUrl, // `../../${sourcePath}`;
linkElem.title = "Defined in " + path.basename(sourcePath);
}
});

View File

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

View File

@@ -1,22 +1,16 @@
"use strict";
// tslint:disable: no-console
Object.defineProperty(exports, "__esModule", { value: true });
var fs = require("fs");
var path = require("path");
var replaceSection = require("mdast-util-heading-range");
var remark = require("remark");
// import * as stringify from "remark-stringify";
// import * as frontMatter from "remark-frontmatter";
var ejs = require("ejs");
var mdNav_1 = require("../mdNav");
var ngHelpers_1 = require("../ngHelpers");
var libFolders = ["core", "content-services", "process-services", "insights", "process-services-cloud"];
var templateFolder = path.resolve("tools", "doc", "templates");
var excludePatterns = [
"**/*.spec.ts"
];
var templateFolder = path.resolve('tools', 'doc', 'templates');
var nameExceptions;
function processDocs(mdCache, aggData, _errorMessages) {
//initPhase(aggData);
nameExceptions = aggData.config.typeNameExceptions;
var pathnames = Object.keys(mdCache);
var internalErrors;
@@ -32,60 +26,31 @@ exports.processDocs = processDocs;
function showErrors(filename, errorMessages) {
console.log(filename);
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) {
/*
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 className = ngHelpers_1.ngNameToClassName(path.basename(pathname, '.md'), nameExceptions);
var classTypeMatch = className.match(/component|directive|service/i);
var compData = aggData.classInfo[className];
if (classTypeMatch && compData) {
var classType = classTypeMatch[0].toLowerCase();
// Copy docs back from the .md file when the JSDocs are empty.
var inputMD = getPropDocsFromMD(tree, "Properties", 3);
var outputMD = getPropDocsFromMD(tree, "Events", 2);
var inputMD = getPropDocsFromMD(tree, 'Properties', 3);
var outputMD = getPropDocsFromMD(tree, 'Events', 2);
updatePropDocsFromMD(compData, inputMD, outputMD, errorMessages);
if (classType === "service") {
if (classType === 'service') {
var methodMD = getMethodDocsFromMD(tree);
updateMethodDocsFromMD(compData, methodMD, errorMessages);
}
var templateName = path.resolve(templateFolder, classType + ".ejs");
var templateSource = fs.readFileSync(templateName, "utf8");
var templateName = path.resolve(templateFolder, classType + '.ejs');
var templateSource = fs.readFileSync(templateName, 'utf8');
var template = ejs.compile(templateSource);
var mdText = template(compData);
mdText = mdText.replace(/^ +\|/mg, "|");
mdText = mdText.replace(/^ +\|/mg, '|');
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.push(after);
return newSection_1;
@@ -96,48 +61,16 @@ function updateFile(tree, pathname, aggData, errorMessages) {
}
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) {
var result = {};
var nav = new mdNav_1.MDNav(tree);
var classMemHeading = nav
.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
.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();
var propTableRow = propsTable.childNav
.tableRow(function () { return true; }, 1).childNav;
@@ -163,11 +96,11 @@ function getMethodDocsFromMD(tree) {
var nav = new mdNav_1.MDNav(tree);
var classMemHeading = nav
.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
.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;
var methItem = methListItems
.listItem();
@@ -186,18 +119,14 @@ function getMethodDocsFromMD(tree) {
.text().value;
var params = getMDMethodParams(methItem);
result[methName] = {
"docText": methDoc.replace(/^\n/, ""),
"params": params
'docText': methDoc.replace(/^\n/, ''),
'params': params
};
}
i++;
methItem = methListItems
.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;
}
function getMDMethodParams(methItem) {
@@ -211,7 +140,7 @@ function getMDMethodParams(methItem) {
.emph().childNav;
var paramName;
if (!paramNameNode.empty) {
paramName = paramNameNode.text().item.value.replace(/:/, "");
paramName = paramNameNode.text().item.value.replace(/:/, '');
}
else {
paramName = paramListItem.childNav
@@ -221,8 +150,8 @@ function getMDMethodParams(methItem) {
}
var paramDoc = paramListItem.childNav
.paragraph().childNav
.text(function (t) { return true; }, 1).value; //item.value;
result[paramName] = paramDoc.replace(/^[ -]+/, "");
.text(function (t) { return true; }, 1).value; // item.value;
result[paramName] = paramDoc.replace(/^[ -]+/, '');
});
return result;
}

View File

@@ -1,27 +1,22 @@
import * as fs from "fs";
import * as path from "path";
// tslint:disable: no-console
import * as replaceSection from "mdast-util-heading-range";
import * as remark from "remark";
import * as fs from 'fs';
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";
import { MDNav } from "../mdNav";
import { ngNameToClassName } from "../ngHelpers";
import {
ComponentInfo
} from "../SourceInfoClasses"
let templateFolder = path.resolve("tools", "doc", "templates");
const templateFolder = path.resolve('tools', 'doc', 'templates');
let nameExceptions;
export function processDocs(mdCache, aggData, _errorMessages) {
nameExceptions = aggData.config.typeNameExceptions;
let pathnames = Object.keys(mdCache);
const pathnames = Object.keys(mdCache);
let internalErrors;
pathnames.forEach(pathname => {
@@ -34,47 +29,45 @@ export function processDocs(mdCache, aggData, _errorMessages) {
});
}
function showErrors(filename, errorMessages) {
console.log(filename);
errorMessages.forEach(message => {
console.log(" " + message);
console.log(' ' + message);
});
console.log("");
console.log('');
}
function updateFile(tree, pathname, aggData, errorMessages) {
let className = ngNameToClassName(path.basename(pathname, ".md"), nameExceptions);
let classTypeMatch = className.match(/component|directive|service/i);
let compData = aggData.classInfo[className];
const className = ngNameToClassName(path.basename(pathname, '.md'), nameExceptions);
const classTypeMatch = className.match(/component|directive|service/i);
const compData = aggData.classInfo[className];
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.
let inputMD = getPropDocsFromMD(tree, "Properties", 3);
let outputMD = getPropDocsFromMD(tree, "Events", 2);
const inputMD = getPropDocsFromMD(tree, 'Properties', 3);
const outputMD = getPropDocsFromMD(tree, 'Events', 2);
updatePropDocsFromMD(compData, inputMD, outputMD, errorMessages);
if (classType === "service") {
let methodMD = getMethodDocsFromMD(tree);
if (classType === 'service') {
const methodMD = getMethodDocsFromMD(tree);
updateMethodDocsFromMD(compData, methodMD, errorMessages);
}
let templateName = path.resolve(templateFolder, classType + ".ejs");
let templateSource = fs.readFileSync(templateName, "utf8");
let template = ejs.compile(templateSource);
const templateName = path.resolve(templateFolder, classType + '.ejs');
const templateSource = fs.readFileSync(templateName, 'utf8');
const template = ejs.compile(templateSource);
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.push(after);
return newSection;
@@ -82,39 +75,39 @@ function updateFile(tree, pathname, aggData, errorMessages) {
compData.errors.forEach(err => {
errorMessages.push(err);
})
});
}
return true;
}
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 => {
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 => {
return (h.children[0].type === "text") && (h.children[0].value === sectionHeading);
return (h.children[0].type === 'text') && (h.children[0].value === sectionHeading);
}).table();
let propTableRow = propsTable.childNav
.tableRow(()=>true, 1).childNav;
.tableRow(() => true, 1).childNav;
let i = 1;
while (!propTableRow.empty) {
let propName = propTableRow
const propName = propTableRow
.tableCell().childNav
.text().item.value;
let propDocText = propTableRow
.tableCell(()=>true, docsColumn).childNav
const propDocText = propTableRow
.tableCell(() => true, docsColumn).childNav
.text().item;
if (propDocText) {
@@ -123,26 +116,25 @@ function getPropDocsFromMD(tree, sectionHeading, docsColumn) {
i++;
propTableRow = propsTable.childNav
.tableRow(()=>true, i).childNav;
.tableRow(() => true, i).childNav;
}
return result;
}
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 => {
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 => {
return (h.children[0].type === "text") && (h.children[0].value === "Methods");
return (h.children[0].type === 'text') && (h.children[0].value === 'Methods');
}).list().childNav;
let methItem = methListItems
@@ -151,7 +143,7 @@ function getMethodDocsFromMD(tree) {
let i = 0;
while (!methItem.empty) {
let methNameSection = methItem.childNav
const methNameSection = methItem.childNav
.paragraph().childNav
.strong().childNav;
@@ -161,46 +153,45 @@ function getMethodDocsFromMD(tree) {
if (!methNameSection.empty) {
methName = methNameSection.text().item.value;
let methDoc = methItem.childNav
const methDoc = methItem.childNav
.paragraph().childNav
.html()
.text().value;
let params = getMDMethodParams(methItem);
const params = getMDMethodParams(methItem);
result[methName] = {
"docText": methDoc.replace(/^\n/, ""),
"params": params
'docText': methDoc.replace(/^\n/, ''),
'params': params
};
}
i++;
methItem = methListItems
.listItem(l=>true, i);
.listItem(l => true, i);
}
return result;
}
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();
paramListItems.forEach(paramListItem => {
let paramNameNode = paramListItem.childNav
const paramNameNode = paramListItem.childNav
.paragraph().childNav
.emph().childNav;
let paramName;
if (!paramNameNode.empty) {
paramName = paramNameNode.text().item.value.replace(/:/, "");
paramName = paramNameNode.text().item.value.replace(/:/, '');
} else {
paramName = paramListItem.childNav
.paragraph().childNav
@@ -208,17 +199,16 @@ function getMDMethodParams(methItem: MDNav) {
.text().item.value;
}
let paramDoc = paramListItem.childNav
const paramDoc = paramListItem.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;
}
function updatePropDocsFromMD(comp: ComponentInfo, inputDocs, outputDocs, errorMessages) {
comp.properties.forEach(prop => {
let propMDDoc: string;
@@ -237,10 +227,9 @@ function updatePropDocsFromMD(comp: ComponentInfo, inputDocs, outputDocs, errorM
});
}
function updateMethodDocsFromMD(comp: ComponentInfo, methodDocs, errorMessages) {
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 (!meth.docText && currMethMD && currMethMD.docText) {
@@ -249,8 +238,7 @@ function updateMethodDocsFromMD(comp: ComponentInfo, methodDocs, errorMessages)
}
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];
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 ejs = require("ejs");
var unist = require("../unistHelpers");
var tutFolder = path.resolve("docs", "tutorials");
var templateFolder = path.resolve("tools", "doc", "templates");
var userGuideFolder = path.resolve("docs", "user-guide");
function processDocs(tree, pathname, aggData, errorMessages) {
aggPhase(aggData);
var tutFolder = path.resolve('docs', 'tutorials');
var templateFolder = path.resolve('tools', 'doc', 'templates');
var userGuideFolder = path.resolve('docs', 'user-guide');
function processDocs() {
aggPhase();
}
exports.processDocs = processDocs;
function aggPhase(aggData) {
function aggPhase() {
var indexDocData = getIndexDocData();
var templateName = path.resolve(templateFolder, "tutIndex.ejs");
var templateSource = fs.readFileSync(templateName, "utf8");
var templateName = path.resolve(templateFolder, 'tutIndex.ejs');
var templateSource = fs.readFileSync(templateName, 'utf8');
var template = ejs.compile(templateSource);
var mdText = template(indexDocData);
mdText = mdText.replace(/^ +\|/mg, "|");
var newSection = remark().use(frontMatter, ["yaml"]).data("settings", { paddedTable: false, gfm: false }).parse(mdText.trim()).children;
var tutIndexFile = path.resolve(tutFolder, "README.md");
var tutIndexText = fs.readFileSync(tutIndexFile, "utf8");
var tutIndexMD = remark().use(frontMatter, ["yaml"]).data("settings", { paddedTable: false, gfm: false }).parse(tutIndexText);
replaceSection(tutIndexMD, "Tutorials", function (before, section, after) {
mdText = mdText.replace(/^ +\|/mg, '|');
var newSection = remark().use(frontMatter, ['yaml']).data('settings', { paddedTable: false, gfm: false }).parse(mdText.trim()).children;
var tutIndexFile = path.resolve(tutFolder, 'README.md');
var tutIndexText = fs.readFileSync(tutIndexFile, 'utf8');
var tutIndexMD = remark().use(frontMatter, ['yaml']).data('settings', { paddedTable: false, gfm: false }).parse(tutIndexText);
replaceSection(tutIndexMD, 'Tutorials', function (before, section, after) {
newSection.unshift(before);
newSection.push(after);
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() {
var indexFile = path.resolve(userGuideFolder, "summary.json");
var summaryArray = JSON.parse(fs.readFileSync(indexFile, "utf8"));
var indexFile = path.resolve(userGuideFolder, 'summary.json');
var summaryArray = JSON.parse(fs.readFileSync(indexFile, 'utf8'));
var indexArray = [];
summaryArray.forEach(function (element) {
if (element["title"] === "Tutorials") {
indexArray = element["children"];
if (element['title'] === 'Tutorials') {
indexArray = element['children'];
}
});
var result = {
tuts: []
};
indexArray.forEach(function (element) {
var tutData = { link: element["file"] };
var tutFile = path.resolve(tutFolder, element["file"]);
var tutFileText = fs.readFileSync(tutFile, "utf8");
var tutMD = remark().use(frontMatter, ["yaml"]).parse(tutFileText);
var tutData = { link: element['file'] };
var tutFile = path.resolve(tutFolder, element['file']);
var tutFileText = fs.readFileSync(tutFile, 'utf8');
var tutMD = remark().use(frontMatter, ['yaml']).parse(tutFileText);
var metadata = getDocMetadata(tutMD);
if (metadata["Level"]) {
tutData["level"] = metadata["Level"];
if (metadata['Level']) {
tutData['level'] = metadata['Level'];
}
else {
tutData["level"] = "";
tutData['level'] = '';
}
var briefDesc = getFirstParagraph(tutMD);
var briefDescText = remark()
.use(frontMatter, { type: 'yaml', fence: '---' })
.data("settings", { paddedTable: false, gfm: false })
.data('settings', { paddedTable: false, gfm: false })
.stringify(briefDesc);
tutData["briefDesc"] = briefDescText;
tutData['briefDesc'] = briefDescText;
var title = getFirstHeading(tutMD);
var titleText = remark()
.use(frontMatter, { type: 'yaml', fence: '---' })
.data("settings", { paddedTable: false, gfm: false })
.data('settings', { paddedTable: false, gfm: false })
.stringify(title.children[0]);
tutData["title"] = titleText;
tutData['title'] = titleText;
result.tuts.push(tutData);
});
return result;
}
function getDocMetadata(tree) {
if (tree.children[0].type == "yaml") {
if (tree.children[0].type === 'yaml') {
return yaml.load(tree.children[0].value);
}
else {

View File

@@ -1,98 +1,92 @@
import * as fs from "fs";
import * as path from "path";
import * as replaceSection from "mdast-util-heading-range";
import * as remark from "remark";
import * as frontMatter from "remark-frontmatter";
import * as yaml from "js-yaml";
import * as ejs from "ejs";
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");
import * as fs from 'fs';
import * as path from 'path';
import * as replaceSection from 'mdast-util-heading-range';
import * as remark from 'remark';
import * as frontMatter from 'remark-frontmatter';
import * as yaml from 'js-yaml';
import * as ejs from 'ejs';
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');
export function processDocs() {
aggPhase();
}
function aggPhase() {
let indexDocData = getIndexDocData();
const indexDocData = getIndexDocData();
let templateName = path.resolve(templateFolder, "tutIndex.ejs");
let templateSource = fs.readFileSync(templateName, "utf8");
let template = ejs.compile(templateSource);
const templateName = path.resolve(templateFolder, 'tutIndex.ejs');
const templateSource = fs.readFileSync(templateName, 'utf8');
const template = ejs.compile(templateSource);
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");
let tutIndexText = fs.readFileSync(tutIndexFile, "utf8");
let tutIndexMD = remark().use(frontMatter, ["yaml"]).data("settings", {paddedTable: false, gfm: false}).parse(tutIndexText);
const tutIndexFile = path.resolve(tutFolder, 'README.md');
const tutIndexText = fs.readFileSync(tutIndexFile, 'utf8');
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.push(after);
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() {
let indexFile = path.resolve(userGuideFolder, "summary.json");
let summaryArray = JSON.parse(fs.readFileSync(indexFile, "utf8"));
const indexFile = path.resolve(userGuideFolder, 'summary.json');
const summaryArray = JSON.parse(fs.readFileSync(indexFile, 'utf8'));
let indexArray = [];
summaryArray.forEach(element => {
if (element["title"] === "Tutorials") {
indexArray = element["children"];
if (element['title'] === 'Tutorials') {
indexArray = element['children'];
}
});
let result = {
const result = {
tuts: []
};
indexArray.forEach(element => {
let tutData = { link: element["file"] };
const tutData = { link: element['file'] };
let tutFile = path.resolve(tutFolder, element["file"]);
let tutFileText = fs.readFileSync(tutFile, "utf8");
let tutMD = remark().use(frontMatter, ["yaml"]).parse(tutFileText);
const tutFile = path.resolve(tutFolder, element['file']);
const tutFileText = fs.readFileSync(tutFile, 'utf8');
const tutMD = remark().use(frontMatter, ['yaml']).parse(tutFileText);
let metadata = getDocMetadata(tutMD);
const metadata = getDocMetadata(tutMD);
if (metadata["Level"]){
tutData["level"] = metadata["Level"];
if (metadata['Level']) {
tutData['level'] = metadata['Level'];
} else {
tutData["level"] = "";
tutData['level'] = '';
}
let briefDesc = getFirstParagraph(tutMD);
const briefDesc = getFirstParagraph(tutMD);
let briefDescText = remark()
const briefDescText = remark()
.use(frontMatter, {type: 'yaml', fence: '---'})
.data("settings", {paddedTable: false, gfm: false})
.data('settings', {paddedTable: false, gfm: false})
.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: '---'})
.data("settings", {paddedTable: false, gfm: false})
.data('settings', {paddedTable: false, gfm: false})
.stringify(title.children[0]);
tutData["title"] = titleText;
tutData['title'] = titleText;
result.tuts.push(tutData);
});
@@ -100,20 +94,18 @@ function getIndexDocData() {
return result;
}
function getDocMetadata(tree) {
if (tree.children[0].type == "yaml") {
if (tree.children[0].type === 'yaml') {
return yaml.load(tree.children[0].value);
} else {
return {};
}
}
function getFirstParagraph(tree) {
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) {
return tree.children[s];
@@ -126,7 +118,7 @@ function getFirstParagraph(tree) {
function getFirstHeading(tree) {
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) {
return tree.children[s];

View File

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

View File

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

View File

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