[ACS-10189] Remove old api docs generators from ADF (#11224)

* [ACS-10189] remove tools dir

* [ACS-10189] cleanup the root package.json

* [ACS-10189] delete lib/tsconfig.doc.json
This commit is contained in:
Mykyta Maliarchuk
2025-10-07 13:22:11 +02:00
committed by GitHub
parent 33ca9313be
commit 56092ff2c1
51 changed files with 1 additions and 9750 deletions

View File

@@ -10,7 +10,6 @@ node_modules
scripts
src
lib
tools
/angular.json
/desktop.ini
/cspell.json

View File

@@ -1,58 +0,0 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"skipLibCheck": false,
"noLib": false,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"noImplicitAny": false,
"noImplicitReturns": false,
"noImplicitUseStrict": false,
"noFallthroughCasesInSwitch": true,
"removeComments": true,
"declaration": true,
"outDir": "./dist",
"baseUrl" : "./",
"types": ["jasmine"],
"allowSyntheticDefaultImports": true,
"paths": {
"@alfresco/adf-process-services-cloud": ["./process-services-cloud/"],
"@alfresco/adf-process-services": ["./process-services/"],
"@alfresco/adf-content-services": ["./content-services/"],
"@alfresco/adf-extensions": ["./extensions/"],
"@alfresco/adf-core": ["./core/"],
"@alfresco/adf-insights": ["./analytics"]
},
"lib": [
"es2016",
"dom"
],
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true
},
"exclude": [
"testing",
"*/node_modules",
"*/demo",
"config",
"*/coverage",
"node_modules",
"*/dist",
"dist"
],
"angularCompilerOptions": {
"strictMetadataEmit": false,
"skipTemplateCodegen": true,
"preserveWhitespaces": false
},
"typedocOptions": {
"json": "docs/docs.json",
"exclude": ["**/*.spec.ts", "node_modules"],
"ignoreCompilerErrors": true
}
}

306
package-lock.json generated
View File

@@ -62,7 +62,6 @@
"@nx/js": "20.8.0",
"@nx/node": "20.8.0",
"@nx/workspace": "20.8.0",
"@paperist/types-remark": "0.1.3",
"@playwright/test": "1.46.1",
"@schematics/angular": "19.2.7",
"@types/ejs": "^3.1.5",
@@ -103,7 +102,6 @@
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-preset-angular": "14.4.2",
"js-yaml": "^4.0.0",
"jsdom": "^25.0.1",
"karma": "6.4.4",
"karma-chrome-launcher": "~3.2.0",
@@ -14272,17 +14270,6 @@
"node": ">=6"
}
},
"node_modules/@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,
"license": "MIT",
"peerDependencies": {
"remark-parse": "^4.0.0",
"unist-util-visit": "^1.1.3"
}
},
"node_modules/@paralleldrive/cuid2": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/@paralleldrive/cuid2/-/cuid2-2.2.2.tgz",
@@ -19039,42 +19026,6 @@
"node": ">=10"
}
},
"node_modules/character-entities": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz",
"integrity": "sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/character-entities-legacy": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz",
"integrity": "sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/character-reference-invalid": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz",
"integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/chardet": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/chardet/-/chardet-2.1.0.tgz",
@@ -19352,18 +19303,6 @@
"node": ">= 0.12.0"
}
},
"node_modules/collapse-white-space": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.6.tgz",
"integrity": "sha512-jEovNnrhMuqyCcjfEJA56v0Xq8SkIoPKDyaHahwo3POf4qcSXqMYuwNcOTzp74vTsR9Tn08z4MxWqAhcekogkQ==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/collect-v8-coverage": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz",
@@ -24451,34 +24390,6 @@
"node": ">= 0.10"
}
},
"node_modules/is-alphabetical": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz",
"integrity": "sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/is-alphanumerical": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz",
"integrity": "sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"is-alphabetical": "^1.0.0",
"is-decimal": "^1.0.0"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/is-array-buffer": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz",
@@ -24647,18 +24558,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/is-decimal": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.4.tgz",
"integrity": "sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/is-docker": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz",
@@ -24753,18 +24652,6 @@
"node": ">=0.10.0"
}
},
"node_modules/is-hexadecimal": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz",
"integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/is-inside-container": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz",
@@ -25068,18 +24955,6 @@
"integrity": "sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==",
"license": "MIT"
},
"node_modules/is-whitespace-character": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.4.tgz",
"integrity": "sha512-SDweEzfIZM0SJV0EUga669UTKlmL0Pq8Lno0QDQsPnvECB3IM2aP0gdx5TrU0A01MAPfViaZiI2V1QMZLaKK5w==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/is-windows": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
@@ -25090,18 +24965,6 @@
"node": ">=0.10.0"
}
},
"node_modules/is-word-character": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.4.tgz",
"integrity": "sha512-5SMO8RVennx3nZrqtKwCGyyetPE9VDba5ugvKLaD4KopPG5kR4mQ7tNt/r7feL5yt5h3lpuBbIUmCOG2eSzXHA==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/is-wsl": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz",
@@ -28456,18 +28319,6 @@
"tmpl": "1.0.5"
}
},
"node_modules/markdown-escapes": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.4.tgz",
"integrity": "sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/material-icons": {
"version": "1.13.14",
"resolved": "https://registry.npmjs.org/material-icons/-/material-icons-1.13.14.tgz",
@@ -30795,22 +30646,6 @@
"node": ">=8"
}
},
"node_modules/parse-entities": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz",
"integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"character-entities": "^1.0.0",
"character-entities-legacy": "^1.0.0",
"character-reference-invalid": "^1.0.0",
"is-alphanumerical": "^1.0.0",
"is-decimal": "^1.0.0",
"is-hexadecimal": "^1.0.0"
}
},
"node_modules/parse-imports": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/parse-imports/-/parse-imports-2.2.1.tgz",
@@ -32674,31 +32509,6 @@
}
}
},
"node_modules/remark-parse": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-4.0.0.tgz",
"integrity": "sha512-XZgICP2gJ1MHU7+vQaRM+VA9HEL3X253uwUM/BGgx3iv6TH2B3bF3B8q00DKcyP9YrJV+/7WOWEWBFF/u8cIsw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"collapse-white-space": "^1.0.2",
"is-alphabetical": "^1.0.0",
"is-decimal": "^1.0.0",
"is-whitespace-character": "^1.0.0",
"is-word-character": "^1.0.0",
"markdown-escapes": "^1.0.0",
"parse-entities": "^1.0.2",
"repeat-string": "^1.5.4",
"state-toggle": "^1.0.0",
"trim": "0.0.1",
"trim-trailing-lines": "^1.0.0",
"unherit": "^1.0.4",
"unist-util-remove-position": "^1.0.0",
"vfile-location": "^2.0.0",
"xtend": "^4.0.1"
}
},
"node_modules/repeat-string": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
@@ -34650,18 +34460,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/state-toggle": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.3.tgz",
"integrity": "sha512-d/5Z4/2iiCnHw6Xzghyhb+GcmF89bxwgXG60wjIiZaxnymbyOmI8Hk4VqHXiVVp6u2ysaskFfXg3ekCj4WNftQ==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
@@ -36245,26 +36043,6 @@
"node": ">=0.6"
}
},
"node_modules/trim": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz",
"integrity": "sha512-YzQV+TZg4AxpKxaTHK3c3D+kRDCGVEE7LemdlQZoQXn0iennk10RsIoY6ikzAqJTc9Xjl9C1/waHom/J86ziAQ==",
"deprecated": "Use String.prototype.trim() instead",
"dev": true,
"peer": true
},
"node_modules/trim-trailing-lines": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.4.tgz",
"integrity": "sha512-rjUWSqnfTNrjbB9NQWfPMH/xRK1deHeGsHoVfpxJ++XeYXE0d6B1En37AHfw3jtfTU7dzMzZL2jjpe8Qb5gLIQ==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/ts-api-utils": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz",
@@ -36962,22 +36740,6 @@
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
"license": "MIT"
},
"node_modules/unherit": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.3.tgz",
"integrity": "sha512-Ft16BJcnapDKp0+J/rqFC3Rrk6Y/Ng4nzsC028k2jdDII/rdZ7Wd3pPT/6+vIIxRagwRc9K0IUX0Ra4fKvw+WQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"inherits": "^2.0.0",
"xtend": "^4.0.0"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/unicode-canonical-property-names-ecmascript": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz",
@@ -37069,51 +36831,6 @@
"node": "^18.17.0 || >=20.5.0"
}
},
"node_modules/unist-util-is": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-3.0.0.tgz",
"integrity": "sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A==",
"dev": true,
"license": "MIT",
"peer": true
},
"node_modules/unist-util-remove-position": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.4.tgz",
"integrity": "sha512-tLqd653ArxJIPnKII6LMZwH+mb5q+n/GtXQZo6S6csPRs5zB0u79Yw8ouR3wTw8wxvdJFhpP6Y7jorWdCgLO0A==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"unist-util-visit": "^1.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/unist-util-visit": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz",
"integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"unist-util-visit-parents": "^2.0.0"
}
},
"node_modules/unist-util-visit-parents": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz",
"integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"unist-util-is": "^3.0.0"
}
},
"node_modules/universalify": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
@@ -37316,18 +37033,6 @@
"node": ">= 0.8"
}
},
"node_modules/vfile-location": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.6.tgz",
"integrity": "sha512-sSFdyCP3G6Ka0CEmN83A2YCMKIieHx0EDaj5IDP4g1pa5ZJ4FJDvpO0WODLxo4LUX4oe52gmSCK7Jw4SBghqxA==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/vite": {
"version": "6.3.6",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.3.6.tgz",
@@ -38359,17 +38064,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=0.4"
}
},
"node_modules/y18n": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",

View File

@@ -5,8 +5,6 @@
"author": "Hyland Software, Inc. and its affiliates",
"scripts": {
"prepare": "husky install",
"build-doc-tools": "tsc -p ./tools/doc/tsconfig.json",
"docbuild": "(cd ./tools/doc; npm i) && node tools/doc/node_modules/typedoc/bin/typedoc --tsconfig lib/tsconfig.doc.json && node tools/doc/buildYamlSourceInfo.js docs/docs.json && node ./tools/doc/docProcessor.js",
"bundle:js-api": "nx run js-api:bundle",
"bundle:cli": "nx run cli:bundle",
"test:affected": "nx affected:test",
@@ -89,7 +87,6 @@
"@nx/js": "20.8.0",
"@nx/node": "20.8.0",
"@nx/workspace": "20.8.0",
"@paperist/types-remark": "0.1.3",
"@playwright/test": "1.46.1",
"@schematics/angular": "19.2.7",
"@types/ejs": "^3.1.5",
@@ -130,7 +127,6 @@
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-preset-angular": "14.4.2",
"js-yaml": "^4.0.0",
"jsdom": "^25.0.1",
"karma": "6.4.4",
"karma-chrome-launcher": "~3.2.0",

View File

@@ -1,51 +0,0 @@
const fs = require('fs');
const path = require('path');
const ejs = require('ejs');
const templateFolder = path.resolve('tools', 'doc', 'yamlTemplates');
const outputFolder = path.resolve('docs', 'sourceinfo');
if (process.argv.length < 3) {
console.log('Error: Source filename required');
process.exit();
}
console.log(`Processing ${process.argv[2]}`);
if (!fs.existsSync(outputFolder)) {
fs.mkdirSync(outputFolder);
}
const docData = JSON.parse(fs.readFileSync(path.resolve(process.argv[2]), 'utf8'));
const tempFilename = path.resolve(templateFolder, 'template.ejs');
const tempSource = fs.readFileSync(tempFilename, 'utf8');
const template = ejs.compile(tempSource, {
filename: tempFilename,
cache: true
});
searchItemsRecursively(docData);
function searchItemsRecursively(item) {
if (interestedIn(item.kind)) {
processItem(item);
} else if (item.children) {
item.children.forEach((child) => {
searchItemsRecursively(child);
});
}
}
function interestedIn(itemKind) {
return itemKind === 128 || itemKind === 256 || itemKind === 4194304;
}
function processItem(item) {
const docText = template(item);
if (item.name === 'Widget') {
console.log('item ' + JSON.stringify(item.name));
}
fs.writeFileSync(path.resolve(outputFolder, item.name + '.yml'), docText);
}

View File

@@ -1,217 +0,0 @@
const fs = require('fs');
const path = require('path');
const program = require('commander');
const lodash = require('lodash');
const jsyaml = require('js-yaml');
const remark = require('remark');
const frontMatter = require('remark-frontmatter');
const mdCompact = require('mdast-util-compact');
const minimatch = require('minimatch');
const si = require('./sourceInfoClasses');
// "Aggregate" data collected over the whole file set.
const aggData = {};
const toolsFolderName = 'tools';
const configFileName = 'doctool.config.json';
const defaultFolder = path.resolve('docs');
const sourceInfoFolder = path.resolve('docs', 'sourceinfo');
function filterFiles(filePath) {
let isAllowed = true;
this.excludedFileList = aggData['config'].exclude;
if (this.excludedFileList) {
isAllowed =
this.excludedFileList.filter((pattern) => {
return minimatch(filePath, pattern.toString(), {
nocase: true
});
}).length === 0;
}
return isAllowed;
}
const toolModules = loadToolModules();
let toolList;
function updatePhase(mdCache, aggData) {
toolList.forEach((toolName) => {
console.log(`Tool: ${toolName}`);
toolModules[toolName].processDocs(mdCache, aggData);
});
const filenames = Object.keys(mdCache);
for (let i = 0; i < filenames.length; i++) {
const pathname = filenames[i];
const tree = mdCache[pathname].mdOutTree;
const original = mdCache[pathname].mdInTree;
if (program.json) {
let filename = path.basename(pathname);
console.log(`\nFile "${filename}" before processing:`);
console.log(JSON.stringify(original));
console.log(`\nFile "${filename}" after processing:`);
console.log(JSON.stringify(tree));
}
if (!lodash.isEqual(tree, original)) {
if (program.verbose) {
console.log(`Modified: ${pathname}`);
}
fs.writeFileSync(
filenames[i],
remark()
.use(frontMatter, {
type: 'yaml',
fence: '---'
})
.data('settings', { paddedTable: false, gfm: false })
.stringify(tree)
);
}
}
}
function minimiseTree(tree) {
let minPropsTree = JSON.parse(JSON.stringify(tree, (key, value) => (key === 'position' ? undefined : value)));
mdCompact(minPropsTree);
return minPropsTree;
}
function loadToolModules() {
const mods = {};
const toolsFolderPath = path.resolve(__dirname, toolsFolderName);
const modFiles = fs.readdirSync(toolsFolderPath);
for (let i = 0; i < modFiles.length; i++) {
const modPath = path.resolve(toolsFolderPath, modFiles[i]);
if (path.extname(modPath) === '.js') {
const toolName = path.basename(modPath, '.js');
mods[toolName] = require(modPath);
}
}
return mods;
}
function loadConfig() {
const configFilePath = path.resolve(__dirname, configFileName);
return JSON.parse(fs.readFileSync(configFilePath));
}
function getAllDocFilePaths(docFolder, files) {
const items = fs.readdirSync(docFolder);
for (let i = 0; i < items.length; i++) {
const itemPath = path.resolve(docFolder, items[i]);
const itemInfo = fs.statSync(itemPath);
if (itemInfo.isFile()) {
files.push(itemPath);
} else if (itemInfo.isDirectory()) {
getAllDocFilePaths(itemPath, files);
}
}
}
function initMdCache(filenames) {
const mdCache = {};
for (let i = 0; i < filenames.length; i++) {
const pathname = filenames[i];
mdCache[pathname] = {};
const src = fs.readFileSync(pathname);
const tree = remark().use(frontMatter, ['yaml']).parse(src);
mdCache[pathname].mdInTree = minimiseTree(tree);
mdCache[pathname].mdOutTree = minimiseTree(tree);
}
return mdCache;
}
function initClassInfo(aggData) {
const yamlFilenames = fs.readdirSync(path.resolve(sourceInfoFolder));
aggData.classInfo = {};
yamlFilenames.forEach((yamlFilename) => {
const classYamlText = fs.readFileSync(path.resolve(sourceInfoFolder, yamlFilename), 'utf8');
const classYaml = jsyaml.safeLoad(classYamlText);
if (program.verbose) {
console.log(classYaml.items[0].name);
}
aggData.classInfo[classYaml.items[0].name] = new si.ComponentInfo(classYaml);
});
}
program
.usage('[options] <source>')
.option('-p, --profile [profileName]', 'Select named config profile', 'default')
.option('-j, --json', 'Output JSON data for Markdown syntax tree')
.option('-v, --verbose', 'Log doc files as they are processed')
.option('-t, --timing', 'Output time taken for run')
.parse(process.argv);
let startTime;
if (program.timing) {
startTime = process.hrtime();
}
let sourcePath;
if (program.args.length === 0) {
sourcePath = defaultFolder;
} else {
sourcePath = path.resolve(program.args[0]);
}
const sourceInfo = fs.statSync(sourcePath);
const config = loadConfig();
aggData['config'] = config;
if (config.profiles[program.profile]) {
toolList = config.profiles[program.profile];
var toolListText = toolList.join(', ');
console.log(`Using '${program.profile}' profile: ${toolListText}`);
} else {
console.log(`Aborting: unknown profile '${program.profile}`);
return 0;
}
let files = [];
if (sourceInfo.isDirectory()) {
getAllDocFilePaths(sourcePath, files);
aggData['rootFolder'] = path.dirname(sourcePath);
} else if (sourceInfo.isFile()) {
files = [sourcePath];
}
files = files.filter((filename) => filename !== undefined && path.extname(filename) === '.md' && filename !== 'README.md' && filterFiles(filename));
const mdCache = initMdCache(files);
console.log('Loading source data...');
initClassInfo(aggData);
console.log('Updating Markdown files...');
updatePhase(mdCache, aggData);
if (program.timing) {
const endTime = process.hrtime(startTime);
console.log(`Run complete in ${endTime[0]} sec`);
}

View File

@@ -1,237 +0,0 @@
{
"profiles": {
"default": [
"gqIndex",
"versionIndex",
"tutorialIndex",
"tsInfo",
"sourceLinker",
"typeLinker",
"toc"
],
"index": [
"gqIndex",
"versionIndex",
"tutorialIndex"
],
"enhance": [
"tsInfo",
"sourceLinker",
"typeLinker",
"toc"
],
"check": [
"fileChecker"
],
"dev": [
"linkFixer"
]
},
"statusIcons": {
"Deprecated": "docassets/images/DeprecatedIcon.png",
"Experimental": "docassets/images/ExperimentalIcon.png",
"Internal": "docassets/images/InternalIcon.png"
},
"externalNameLinks": {
"Blob": "https://developer.mozilla.org/en-US/docs/Web/API/Blob",
"Promise": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises",
"EventEmitter": "https://angular.io/api/core/EventEmitter",
"HTMLInputElement": "https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement",
"HTMLTextAreaElement": "https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement",
"MatDialog": "https://material.angular.io/components/dialog/overview",
"MatIconRegistry": "https://material.angular.io/components/icon/api",
"MatSnackBarRef": "https://material.angular.io/components/snack-bar/overview",
"TemplateRef": "https://angular.io/api/core/TemplateRef",
"Observable": "http://reactivex.io/documentation/observable.html",
"Subject": "http://reactivex.io/documentation/subject.html",
"AppsDefinitionApi": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api-legacy/activiti-rest-api/src/api/AppsDefinitionApi.ts",
"AppDefinitionRepresentation": "https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/AppDefinitionRepresentation.md",
"ClassesApi": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/api/classes.api.ts",
"ContentApi": "https://github.com/Alfresco/alfres/co-js-api/blob/develop/src/api/content-rest-api/api/content.api.ts",
"CustomModelApi": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api-legacy/content-rest-api/docs/CustomModelApi.md",
"DeletedNodeEntry": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/DeletedNodeEntry.md",
"DeletedNodesPaging": "https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/DeletedNodesPaging.md",
"DownloadBodyCreate": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/DownloadBodyCreate.md",
"DownloadEntry": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/DownloadEntry.md",
"FavoritesApi": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/api/favorites.api.ts",
"GroupMemberPaging": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/GroupMemberPaging.md",
"GroupsApi": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/api/groups.api.ts",
"MinimalNode": "https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md",
"Node": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/Node.md",
"NodeEntry": "https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md",
"NodePaging": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/NodePaging.md",
"NodesApi": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/api/nodes.api.ts",
"PathElement": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/PathElement.md",
"PermissionElement": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/PermissionElement.md",
"PersonBodyCreate": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/model/personBodyCreate.ts",
"PeopleApi": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/api/people.api.ts",
"ProcessDefinitionRepresentation": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/activiti-rest-api/docs/ProcessDefinitionRepresentation.md",
"ProcessInstanceFilterRepresentation": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/activiti-rest-api/docs/ProcessInstanceFilterRepresentation.md",
"ProcessInstanceQueryRepresentation": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/activiti-rest-api/docs/ProcessInstanceQueryRepresentation.md",
"RatingEntry": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/RatingEntry.md",
"RelatedContentRepresentation": "https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/RelatedContentRepresentation.md",
"RenditionEntry": "https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/RenditionEntry.md",
"RenditionPaging": "https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/RenditionPaging.md",
"RenditionsApi": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/api/renditions.api.ts",
"RequestPagination": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/search-rest-api/docs/RequestPagination.md",
"RestVariable": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/activiti-rest-api/docs/RestVariable.md",
"ResultListDataRepresentationUserProcessInstanceFilterRepresentation": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/activiti-rest-api/docs/ResultListDataRepresentation%C2%ABUserProcessInstanceFilterRepresentation%C2%BB.md",
"SearchApi": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api-legacy/legacy.ts",
"SharedLinkEntry": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/SharedLinkEntry.md",
"SharedLinkPaging": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/SharedLinkPaging.md",
"SharedLinksApi": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/api/sharedlinks.api.ts",
"SiteEntry": "https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md",
"SiteMemberPaging":"https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/SiteMemberPaging.md",
"SitePaging": "https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SitePaging.md",
"SitesApi": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/api/sites.api.ts",
"TagEntry": "https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/TagEntry.md",
"TagPaging": "https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/TagPaging.md",
"TaskApi": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api-legacy/activiti-rest-api/docs/TaskApi.md",
"TaskUpdateRepresentation": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/activiti-rest-api/docs/TaskUpdateRepresentation.md",
"UserInfo": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/UserInfo.md",
"UserProcessInstanceFilterRepresentation": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/activiti-rest-api/docs/UserProcessInstanceFilterRepresentation.md",
"UserRepresentation": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/activiti-rest-api/docs/UserRepresentation.md",
"VersionsApi": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/api/versions.api.ts",
"VersionEntry": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/VersionEntry.md",
"MenuPositionX": "https://github.com/angular/components/blob/master/src/material/menu/menu-positions.ts",
"MenuPositionY": "https://github.com/angular/components/blob/master/src/material/menu/menu-positions.ts",
"ThemePalette": "https://github.com/angular/components/blob/master/src/material/core/common-behaviors/color.ts",
"ResultSetPaging": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/search-rest-api/docs/ResultSetPaging.md",
"SiteMembershipBodyCreate": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/SiteMembershipBodyCreate.md",
"SystemPropertiesRepresentation": "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/activiti-rest-api/docs/SystemPropertiesRepresentation.md",
"SiteMembershipBodyUpdate" : "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/SiteMembershipBodyUpdate.md",
"SiteMembershipRequestWithPersonPaging" : "https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/SiteMembershipRequestWithPersonPaging.md",
"SiteGroupEntry" :"https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/SiteGroupEntry.md",
"SiteMemberEntry" :"https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/SiteMemberEntry.md"
},
"linkOverrides": [
"activiti", "auth", "authentication", "comment", "company", "core", "download",
"favorite", "file", "group", "pagination", "path", "person", "preference",
"rating", "rendition", "search", "site", "storage", "tag", "version"
],
"typeNameExceptions": {
"activiti-alfresco.service": "ActivitiContentService",
"auth-guard-bpm.service": "AuthGuardBpm",
"auth-guard-ecm.service": "AuthGuardEcm",
"auth-guard": "AuthGuard",
"card-item-types.service": "CardItemTypeService",
"card-view-item.interface": "CardViewItem",
"confirm.dialog": "ConfirmDialogComponent",
"content-node-share.directive": "NodeSharedDirective",
"content.widget": "ContentWidgetComponent",
"create-task-attachment.component": "AttachmentComponent",
"datatable-adapter.interface": "DataTableAdapter",
"datatable.component": "DataTableComponent",
"document-library.model": "NodePaging",
"dynamic.component": "DynamicExtensionComponent",
"form-field-validator.interface": "FormFieldValidator",
"group-initial.pipe": "InitialGroupNamePipe",
"header.component": "HeaderLayoutComponent",
"inherited-button.directive": "InheritPermissionDirective",
"library.dialog": "LibraryDialogComponent",
"permissions-style.model": "PermissionStyleModel",
"process-list.component": "ProcessInstanceListComponent",
"product-version.model": "BpmProductVersionModel",
"search-widget.interface": "SearchWidget",
"sites-dropdown.component": "DropdownSitesComponent",
"start-process.component": "StartProcessInstanceComponent",
"tasklist.service": "TaskListService",
"text-highlight.pipe": "HighlightPipe",
"text-mask.component": "InputMaskDirective",
"unclaim-task.directive": "UnClaimTaskDirective",
"user-initial.pipe": "InitialUsernamePipe"
},
"undocStoplist": [
"Definition",
"Property",
"model",
"component-register.service",
"context-menu-holder",
"data-column-list",
"card-view-[a-z]+item",
"card-view-item-dispatcher",
"content-column",
"content-action-list",
"empty-folder-content",
"empty-list",
"extension-loader.service",
"loading-template",
"no-content-template",
"card-view-content-proxy",
"login-footer\\.directive",
"login-header\\.directive",
"no-task-detail-template",
"diagram",
"raphael",
"context-menu",
"alfresco-settings",
"\\.widget",
"[vV]iewer",
"translate-loader",
"search\\.service",
"mediaPlayer",
"unknown-format",
"cell",
"error.component",
"no-permission",
"form-custom",
"widget-visibility",
"card-item-types",
"dynamic-component",
"settings",
"file-uploading",
"version-upload",
"search-trigger",
"node-actions",
"content-node-selector.service",
"analytics",
"process-upload",
"properties-loader",
"property-descriptors",
"attach-file",
"attach-folder",
"task-upload",
"aspect-whitelist",
"basic-properties",
"content-metadata",
"empty-search-result",
"property-group",
"people-search-",
"people-selector",
"sidenav-layout-",
"layout-container",
"search-",
"empty-custom-content",
"custom-empty-content",
"view-util",
"clipboard",
"external-alfresco",
"content-node-share",
"tree-view",
"dialog",
"[Cc]olumn",
"app-details-cloud",
"dynamic-tab"
],
"exclude": [
"**/vulnerability/**",
"**/release-notes/**",
"**/tutorials/**",
"**/user-guide/**"
],
"fileCheckerFilter": [
"README",
"compatibility",
"release-notes",
"roadmap",
"tutorials",
"user-guide",
"versionIndex"
],
"ignoreLinkWords" : [
"Type",
"model",
"Node",
"User"
]
}

View File

@@ -1,31 +0,0 @@
const fs = require('fs');
const path = require('path');
const angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(dialog)|(directive)|(model)|(pipe)|(service)|(widget))\.ts/;
const searchFolderOmitRegex = /(config)|(mock)|(i18n)|(assets)|(styles)/;
// Search source folders for .ts files to discover all components, directives, etc.
function searchLibraryRecursive(srcData, folderPath) {
const items = fs.readdirSync(folderPath);
for (let i = 0; i < items.length; i++) {
const itemPath = path.resolve(folderPath, items[i]);
const info = fs.statSync(itemPath);
if (info.isFile() && items[i].match(angFilenameRegex)) {
const nameNoSuffix = path.basename(items[i], '.ts');
let displayPath = itemPath.replace(/\\/g, '/');
displayPath = displayPath.substring(displayPath.indexOf('lib') + 4);
// Type == "component", "directive", etc.
const itemType = nameNoSuffix.split('.')[1];
srcData[nameNoSuffix] = { path: displayPath, type: itemType };
} else if (info.isDirectory() && !items[i].match(searchFolderOmitRegex)) {
searchLibraryRecursive(srcData, itemPath);
}
}
}
module.exports = searchLibraryRecursive;

View File

@@ -1,329 +0,0 @@
'use strict';
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, '__esModule', { value: true });
exports.MDNav = void 0;
var MDNav = /** @class */ (function () {
function MDNav(root, pos) {
if (pos === void 0) {
pos = 0;
}
this.root = root;
this.pos = pos;
}
MDNav.prototype.find = function (test, index) {
if (test === void 0) {
test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
if (!this.root || !this.root.children) {
return new MDNav(null);
}
var currIndex = 0;
for (var i = this.pos; i < this.root.children.length; i++) {
var child = this.root.children[i];
if (test(child)) {
if (currIndex === index) {
return new MDNav(this.root, i);
} else {
currIndex++;
}
}
}
return new MDNav(this.root, this.root.children.length);
};
MDNav.prototype.findAll = function (test, index) {
if (test === void 0) {
test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
if (!this.root || !this.root.children) {
return [];
}
var result = [];
var currIndex = 0;
for (var i = this.pos; i < this.root.children.length; i++) {
var child = this.root.children[i];
if (test(child)) {
if (currIndex === index) {
result.push(new MDNav(this.root, i));
} else {
currIndex++;
}
}
}
return result;
};
MDNav.prototype.emph = 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 === '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);
}, 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);
}, 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);
}, 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);
}, 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);
}, 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);
}, 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);
}, 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);
}, 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);
}, 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);
}, 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);
}, 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);
}, 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);
}, 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);
}, index);
};
Object.defineProperty(MDNav.prototype, 'item', {
get: function () {
if (!this.root || !this.root.children) {
return undefined;
} else {
return this.root.children[this.pos];
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDNav.prototype, 'empty', {
get: function () {
return !this.root || !this.root.children || this.pos >= this.root.children.length;
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDNav.prototype, 'childNav', {
get: function () {
return new MDNav(this.item);
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDNav.prototype, 'value', {
get: function () {
if (this.item && this.item['value']) {
return this.item.value;
} else {
return '';
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDNav.prototype, 'textValue', {
get: function () {
if (this.item) {
if (this.item['value']) {
return this.item.value;
} else if (this.item.children && this.item.children.length > 0 && this.item.children[0].type === 'text') {
return this.item.children[0].value;
} else {
return '';
}
} else {
return '';
}
},
enumerable: false,
configurable: true
});
return MDNav;
})();
exports.MDNav = MDNav;

View File

@@ -1,171 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export class MDNav {
constructor(public root: any, public pos: number = 0) {}
find(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
if (!this.root || !this.root.children) {
return new MDNav(null);
}
let currIndex = 0;
for (let i = this.pos; i < this.root.children.length; i++) {
const child = this.root.children[i];
if (test(child)) {
if (currIndex === index) {
return new MDNav(this.root, i);
} else {
currIndex++;
}
}
}
return new MDNav(this.root, this.root.children.length);
}
findAll(test: (element: any) => boolean = () => true, index: number = 0): MDNav[] {
if (!this.root || !this.root.children) {
return [];
}
const result = [];
let currIndex = 0;
for (let i = this.pos; i < this.root.children.length; i++) {
const child = this.root.children[i];
if (test(child)) {
if (currIndex === index) {
result.push(new MDNav(this.root, i));
} else {
currIndex++;
}
}
}
return result;
}
emph(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => h.type === 'emphasis' && test(h), index);
}
heading(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => h.type === 'heading' && test(h), index);
}
headings(test: (element: any) => boolean = () => true, index: number = 0): MDNav[] {
return this.findAll((h) => h.type === 'heading' && test(h), index);
}
html(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => h.type === 'html' && test(h), index);
}
link(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => h.type === 'link' && test(h), index);
}
links(test: (element: any) => boolean = () => true, index: number = 0): MDNav[] {
return this.findAll((h) => h.type === 'link' && test(h), index);
}
list(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => h.type === 'list' && test(h), index);
}
listItem(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => h.type === 'listItem' && test(h), index);
}
listItems(test: (element: any) => boolean = () => true, index: number = 0): MDNav[] {
return this.findAll((h) => h.type === 'listItem' && test(h), index);
}
paragraph(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => h.type === 'paragraph' && test(h), index);
}
strong(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => h.type === 'strong' && test(h), index);
}
table(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => h.type === 'table' && test(h), index);
}
tableRow(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => h.type === 'tableRow' && test(h), index);
}
tableCell(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => h.type === 'tableCell' && test(h), index);
}
text(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => h.type === 'text' && test(h), index);
}
get item(): any {
if (!this.root || !this.root.children) {
return undefined;
} else {
return this.root.children[this.pos];
}
}
get empty(): boolean {
return !this.root ||
!this.root.children ||
(this.pos >= this.root.children.length);
}
get childNav(): MDNav {
return new MDNav(this.item);
}
get value(): any {
if (this.item && this.item['value']) {
return this.item.value;
} else {
return '';
}
}
get textValue(): string {
if (this.item) {
if (this.item['value']) {
return this.item.value;
} else if (
this.item.children &&
(this.item.children.length > 0) &&
(this.item.children[0].type === 'text')
) {
return this.item.children[0].value;
} else {
return '';
}
} else {
return '';
}
}
}

View File

@@ -1,281 +0,0 @@
'use strict';
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var __extends =
(this && this.__extends) ||
(function () {
var extendStatics = function (d, b) {
extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== 'function' && b !== null) throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null');
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
Object.defineProperty(exports, '__esModule', { value: true });
exports.Docset =
exports.Text =
exports.Link =
exports.Paragraph =
exports.Heading =
exports.Root =
exports.Parent =
exports.Node =
exports.schema =
void 0;
var mdast_util_to_string_1 = require('mdast-util-to-string');
var jsyaml = require('js-yaml');
exports.schema =
'\n type Query {\n documents(idFilter: String = ""): [Root]\n }\n\n type Root {\n id: ID\n type: String\n folder(depth: Int = 1): String\n metadata(key: String): String\n heading(depth: Int = 0): Heading\n headings(depth: Int = 0): [Heading]\n paragraph: Paragraph\n paragraphs: [Paragraph]\n link: Link\n links: [Link]\n text: Text\n texts: [Text]\n children: [Node]\n }\n\n type Heading {\n depth: Int\n plaintext: String\n paragraph: Paragraph\n paragraphs: [Paragraph]\n link: Link\n links: [Link]\n children: [Node]\n }\n\n type Paragraph {\n plaintext: String\n }\n\n type Link {\n plaintext: String\n title: String\n url: String\n paragraph: Paragraph\n paragraphs: [Paragraph]\n text: Text\n texts: [Text]\n }\n\n type Text {\n value: String\n }\n\n type Node {\n type: String\n children: [Node]\n }\n';
var Node = /** @class */ (function () {
function Node(orig) {
this.orig = orig;
}
Node.prototype.type = function () {
return this.orig.type;
};
Node.prototype.depth = function () {
return this.orig['depth'] || null;
};
Node.prototype.lang = function () {
return this.orig['lang'] || null;
};
Node.prototype.ordered = function () {
return this.orig['ordered'] || null;
};
Node.prototype.start = function () {
return this.orig['start'] || null;
};
Node.prototype.loose = function () {
return this.orig['loose'] || null;
};
Node.prototype.align = function () {
return this.orig['align'] || null;
};
Node.prototype.title = function () {
return this.orig['title'] || null;
};
Node.prototype.url = function () {
return this.orig['title'] || null;
};
Node.prototype.children = function () {
if (this.orig['children']) {
return this.orig['children'].map(function (x) {
return new Node(x);
});
} else {
return null;
}
};
return Node;
})();
exports.Node = Node;
var Parent = /** @class */ (function () {
function Parent(orig) {
this.orig = orig;
}
Parent.prototype.plaintext = function () {
return (0, mdast_util_to_string_1.toString)(this.orig);
};
Parent.prototype.paragraph = function () {
return new Paragraph(
this.orig.children.find(function (ch) {
return ch.type === 'paragraph';
})
);
};
Parent.prototype.paragraphs = function () {
return this.orig.children
.filter(function (ch) {
return ch.type === 'paragraph';
})
.map(function (ch) {
return new Paragraph(ch);
});
};
Parent.prototype.link = function () {
return new Link(
this.orig.children.find(function (ch) {
return ch.type === 'link';
})
);
};
Parent.prototype.links = function () {
return this.orig.children
.filter(function (ch) {
return ch.type === 'link';
})
.map(function (ch) {
return new Link(ch);
});
};
Parent.prototype.text = function () {
return new Text(
this.orig.children.find(function (ch) {
return ch.type === 'text';
})
);
};
Parent.prototype.texts = function () {
return this.orig.children
.filter(function (ch) {
return ch.type === 'text';
})
.map(function (ch) {
return new Text(ch);
});
};
return Parent;
})();
exports.Parent = Parent;
var Root = /** @class */ (function (_super) {
__extends(Root, _super);
function Root() {
return (_super !== null && _super.apply(this, arguments)) || this;
}
Root.prototype.type = function () {
return 'root';
};
Root.prototype.folder = function (args) {
var depth = args['depth'];
var relPath = this.id.substring(this.id.indexOf('docs'));
var pathSegments = relPath.split(/[\\\/]/);
return pathSegments[depth];
};
Root.prototype.metadata = function (args) {
if (!this._meta) {
var yamlElement = this.orig.children.find(function (ch) {
return ch.type === 'yaml';
});
if (yamlElement) {
this._meta = jsyaml.safeLoad(yamlElement.value);
} else {
this._meta = {};
}
}
if (this._meta[args['key']]) {
return this._meta[args['key']];
} else {
return '';
}
};
Root.prototype.heading = function (args) {
var depth = args['depth'];
return new Heading(
this.orig.children.find(function (ch) {
return ch.type === 'heading' && (depth === 0 || depth === ch.depth);
})
);
};
Root.prototype.headings = function (args) {
var depth = args['depth'];
return this.orig.children
.filter(function (ch) {
return ch.type === 'heading' && (depth === 0 || depth === ch.depth);
})
.map(function (ch) {
return new Heading(ch);
});
};
return Root;
})(Parent);
exports.Root = Root;
var Heading = /** @class */ (function (_super) {
__extends(Heading, _super);
function Heading() {
return (_super !== null && _super.apply(this, arguments)) || this;
}
Heading.prototype.depth = function () {
return this.orig.depth;
};
return Heading;
})(Parent);
exports.Heading = Heading;
var Paragraph = /** @class */ (function (_super) {
__extends(Paragraph, _super);
function Paragraph() {
return (_super !== null && _super.apply(this, arguments)) || this;
}
return Paragraph;
})(Parent);
exports.Paragraph = Paragraph;
var Link = /** @class */ (function (_super) {
__extends(Link, _super);
function Link() {
return (_super !== null && _super.apply(this, arguments)) || this;
}
Link.prototype.title = function () {
return this.orig.title;
};
Link.prototype.url = function () {
return this.orig.url;
};
return Link;
})(Parent);
exports.Link = Link;
var Text = /** @class */ (function () {
function Text(orig) {
this.orig = orig;
}
Text.prototype.value = function () {
return this.orig.value;
};
return Text;
})();
exports.Text = Text;
var libNamesRegex = /content-services|core|extensions|insights|process-services|process-services-cloud/;
var Docset = /** @class */ (function () {
function Docset(mdCache) {
var _this = this;
this.docs = [];
var pathnames = Object.keys(mdCache);
pathnames.forEach(function (pathname) {
if (!pathname.match(/README/) && pathname.match(libNamesRegex)) {
var doc = new Root(mdCache[pathname].mdInTree);
doc.id = pathname.replace(/\\/g, '/');
_this.docs.push(doc);
}
});
}
Docset.prototype.documents = function (args) {
if (args['idFilter'] === '') {
return this.docs;
} else {
return this.docs.filter(function (doc) {
return doc.id.indexOf(args['idFilter'] + '/') !== -1;
});
}
};
Docset.prototype.size = function () {
return this.docs.length;
};
return Docset;
})();
exports.Docset = Docset;

View File

@@ -1,265 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MDAST } from 'mdast';
import { UNIST } from 'unist';
import { toString } from 'mdast-util-to-string';
import * as jsyaml from 'js-yaml';
export const schema = `
type Query {
documents(idFilter: String = ""): [Root]
}
type Root {
id: ID
type: String
folder(depth: Int = 1): String
metadata(key: String): String
heading(depth: Int = 0): Heading
headings(depth: Int = 0): [Heading]
paragraph: Paragraph
paragraphs: [Paragraph]
link: Link
links: [Link]
text: Text
texts: [Text]
children: [Node]
}
type Heading {
depth: Int
plaintext: String
paragraph: Paragraph
paragraphs: [Paragraph]
link: Link
links: [Link]
children: [Node]
}
type Paragraph {
plaintext: String
}
type Link {
plaintext: String
title: String
url: String
paragraph: Paragraph
paragraphs: [Paragraph]
text: Text
texts: [Text]
}
type Text {
value: String
}
type Node {
type: String
children: [Node]
}
`;
export class Node {
constructor(private orig: UNIST.Node) {}
type(): string {
return this.orig.type;
}
depth(): number {
return this.orig['depth'] || null;
}
lang(): string {
return this.orig['lang'] || null;
}
ordered(): boolean {
return this.orig['ordered'] || null;
}
start(): number {
return this.orig['start'] || null;
}
loose(): boolean {
return this.orig['loose'] || null;
}
align(): MDAST.AlignType {
return this.orig['align'] || null;
}
title(): string {
return this.orig['title'] || null;
}
url(): string {
return this.orig['title'] || null;
}
children(): Node[] {
if (this.orig['children']) {
return this.orig['children'].map((x) => new Node(x));
} else {
return null;
}
}
}
export class Parent {
constructor(protected orig: UNIST.Parent) {}
plaintext(): string {
return toString(this.orig);
}
paragraph(): Paragraph {
return new Paragraph(<MDAST.Paragraph>this.orig.children.find((ch: UNIST.Node) => ch.type === 'paragraph'));
}
paragraphs(): Paragraph[] {
return this.orig.children.filter((ch: UNIST.Node) => ch.type === 'paragraph').map((ch) => new Paragraph(<MDAST.Paragraph>ch));
}
link(): Link {
return new Link(<MDAST.Link>this.orig.children.find((ch: UNIST.Node) => ch.type === 'link'));
}
links(): Link[] {
return this.orig.children.filter((ch: UNIST.Node) => ch.type === 'link').map((ch) => new Link(<MDAST.Link>ch));
}
text(): Text {
return new Text(<MDAST.TextNode>this.orig.children.find((ch: UNIST.Node) => ch.type === 'text'));
}
texts(): Text[] {
return this.orig.children.filter((ch: UNIST.Node) => ch.type === 'text').map((ch) => new Text(<MDAST.TextNode>ch));
}
}
export class Root extends Parent {
_meta: {};
id: string;
type(): string {
return 'root';
}
folder(args): string {
const depth = args['depth'];
const relPath = this.id.substring(this.id.indexOf('docs'));
const pathSegments = relPath.split(/[\\\/]/);
return pathSegments[depth];
}
metadata(args): string {
if (!this._meta) {
const yamlElement: any = this.orig.children.find((ch: UNIST.Node) => ch.type === 'yaml');
if (yamlElement) {
this._meta = jsyaml.safeLoad(yamlElement.value);
} else {
this._meta = {};
}
}
if (this._meta[args['key']]) {
return this._meta[args['key']];
} else {
return '';
}
}
heading(args): Heading {
const depth = args['depth'];
return new Heading(
<MDAST.Heading>this.orig.children.find((ch: UNIST.Node) => ch.type === 'heading' && (depth === 0 || depth === (<MDAST.Heading>ch).depth))
);
}
headings(args): Heading[] {
const depth = args['depth'];
return this.orig.children
.filter((ch: UNIST.Node) => ch.type === 'heading' && (depth === 0 || depth === (<MDAST.Heading>ch).depth))
.map((ch) => new Heading(<MDAST.Heading>ch));
}
}
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 {
return (<MDAST.Link>this.orig).title;
}
url(): string {
return (<MDAST.Link>this.orig).url;
}
}
export class Text {
constructor(protected orig: MDAST.TextNode) {}
value(): String {
return this.orig.value;
}
}
const libNamesRegex = /content-services|core|extensions|insights|process-services|process-services-cloud/;
export class Docset {
public docs: Root[];
constructor(mdCache) {
this.docs = [];
const pathnames = Object.keys(mdCache);
pathnames.forEach((pathname) => {
if (!pathname.match(/README/) && pathname.match(libNamesRegex)) {
const doc = new Root(mdCache[pathname].mdInTree);
doc.id = pathname.replace(/\\/g, '/');
this.docs.push(doc);
}
});
}
documents(args): Root[] {
if (args['idFilter'] === '') {
return this.docs;
} else {
return this.docs.filter((doc) => doc.id.indexOf(args['idFilter'] + '/') !== -1);
}
}
size(): number {
return this.docs.length;
}
}

View File

@@ -1,55 +0,0 @@
module.exports = {
ngNameToDisplayName: ngNameToDisplayName,
ngNameToClassName: ngNameToClassName,
dekebabifyName: dekebabifyName,
kebabifyClassName: kebabifyClassName,
classTypes: ['component', 'dialog', 'directive', 'model', 'pipe', 'service', 'widget']
};
function ngNameToDisplayName(ngName) {
const mainSections = ngName.split('.');
mainSections[0] = dekebabifyName(mainSections[0]);
return mainSections.join(' ');
}
function initialCap(str) {
return str[0].toUpperCase() + str.substr(1);
}
function ngNameToClassName(rawName, nameExceptions) {
if (nameExceptions[rawName]) return nameExceptions[rawName];
const name = rawName.replace(/\]|\(|\)/g, '');
const fileNameSections = name.split('.');
const compNameSections = fileNameSections[0].split('-');
let outCompName = '';
for (let i = 0; i < compNameSections.length; i++) {
outCompName = outCompName + initialCap(compNameSections[i]);
}
let itemTypeIndicator = '';
if (fileNameSections.length > 1) {
itemTypeIndicator = initialCap(fileNameSections[1]);
}
return outCompName + itemTypeIndicator;
}
function dekebabifyName(name) {
let result = name.replace(/-/g, ' ');
result = result.substr(0, 1).toUpperCase() + result.substr(1);
return result;
}
function kebabifyClassName(name) {
let result = name.replace(/(Component|Directive|Interface|Model|Pipe|Service|Widget)$/, (match) => {
return '.' + match.toLowerCase();
});
result = result.replace(/([A-Z])/g, '-$1');
return result.substr(1).toLowerCase();
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,32 +0,0 @@
{
"name": "adf-doc-tools",
"description": "ADF doc tools",
"version": "4.2.0",
"author": "Hyland Software, Inc. and its affiliates",
"scripts": {},
"dependencies": {
"@alfresco/js-api": ">=6.2.0-982",
"fast-levenshtein": "^3.0.0",
"graphql": "^15.4.0",
"js-yaml": "3.14.1",
"mdast": "2.1.0",
"mdast-util-compact": "1.0.3",
"mdast-util-heading-range": "2.1.3",
"mdast-util-toc": "2.1.0",
"mdast-zone": "3.0.4",
"remark": "^9.0.0",
"remark-frontmatter": "^1.2.0",
"rxjs": "7.8.2",
"typedoc": "^0.25.7",
"typescript": "3.9.8",
"unist-util-select": "2.0.0"
},
"devDependencies": {
"@paperist/types-remark": "0.1.3",
"@types/node": "^14.14.26"
},
"license": "Apache-2.0",
"engines": {
"node": ">=6.0.0"
}
}

View File

@@ -1,229 +0,0 @@
'use strict';
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, '__esModule', { value: true });
exports.ComponentInfo = exports.MethodSigInfo = exports.ParamInfo = exports.PropInfo = void 0;
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(/\|/, '\\|').replace('unknown', '');
if (sourceData.tags) {
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.isInput = false;
this.isOutput = false;
if (sourceData.decorators) {
sourceData.decorators.forEach(function (dec) {
if (dec.name === 'Input') {
_this.isInput = true;
if (dec.arguments) {
var bindingName = dec.arguments['bindingPropertyName'];
if (bindingName && bindingName !== '') {
_this.name = bindingName.replace(/['"]/g, '');
}
}
if (!_this.docText && !_this.isDeprecated) {
_this.errorMessages.push('Error: Input "'.concat(sourceData.name, '" has no doc text.'));
}
}
if (dec.name === 'Output') {
_this.isOutput = true;
if (!_this.docText && !_this.isDeprecated) {
_this.errorMessages.push('Error: Output "'.concat(sourceData.name, '" has no doc text.'));
}
}
});
}
}
Object.defineProperty(PropInfo.prototype, 'errors', {
get: function () {
return this.errorMessages;
},
enumerable: false,
configurable: true
});
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.defaultValue = sourceData.defaultValue;
this.docText = sourceData.description.replace(/[\n\r]+/g, ' ').trim();
this.isOptional = false;
if (sourceData.flags) {
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 += '?';
}
this.combined += ': `'.concat(this.type, '`');
if (this.defaultValue !== '') {
this.combined += ' = `'.concat(this.defaultValue, '`');
}
}
return ParamInfo;
})();
exports.ParamInfo = ParamInfo;
var MethodSigInfo = /** @class */ (function () {
function MethodSigInfo(sourceData) {
var _this = this;
this.errorMessages = [];
this.name = sourceData.name;
this.docText = sourceData.summary || '';
this.docText = this.docText.replace(/[\n\r]+/g, ' ').trim();
if (!this.docText && this.name.indexOf('service') > 0) {
this.errorMessages.push('Warning: method "'.concat(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.returnsSomething = false;
}
if (this.returnsSomething && !this.returnDocText && this.name.indexOf('service') > 0) {
this.errorMessages.push('Warning: Return value of method "'.concat(sourceData.name, '" has no doc text.'));
}
this.isDeprecated = false;
if (sourceData.tags) {
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.params = [];
var paramStrings = [];
if (sourceData.syntax.parameters) {
sourceData.syntax.parameters.forEach(function (rawParam) {
if (rawParam.name && !rawParam.description && !rawParam.name.startWith('on')) {
_this.errorMessages.push(
'Warning: parameter "'.concat(rawParam.name, '" of method "').concat(sourceData.name, '" has no doc text.')
);
}
var param = new ParamInfo(rawParam);
_this.params.push(param);
paramStrings.push(param.combined);
});
}
this.signature = '(' + paramStrings.join(', ') + ')';
}
Object.defineProperty(MethodSigInfo.prototype, 'errors', {
get: function () {
return this.errorMessages;
},
enumerable: false,
configurable: true
});
return MethodSigInfo;
})();
exports.MethodSigInfo = MethodSigInfo;
var ComponentInfo = /** @class */ (function () {
function ComponentInfo(sourceData) {
var _this = this;
this.name = sourceData.items[0].name;
this.itemType = sourceData.items[0].type;
this.hasInputs = false;
this.hasOutputs = false;
this.hasMethods = false;
this.sourcePath = sourceData.items[0].source.path;
this.sourceLine = sourceData.items[0].source.line;
if (this.itemType === 'type alias') {
return;
}
this.properties = [];
this.methods = [];
sourceData.items.forEach(function (item) {
switch (item.type) {
case 'property':
case 'accessor':
var prop = new PropInfo(item);
_this.properties.push(prop);
if (prop.isInput) {
_this.hasInputs = true;
}
if (prop.isOutput) {
_this.hasOutputs = true;
}
break;
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';
}) &&
!skipMethodNames.includes(item.name)
) {
_this.methods.push(new MethodSigInfo(item));
_this.hasMethods = true;
}
break;
default:
break;
}
});
}
Object.defineProperty(ComponentInfo.prototype, 'errors', {
get: function () {
var combinedErrors = [];
this.methods.forEach(function (method) {
method.errors.forEach(function (err) {
combinedErrors.push(err);
});
});
this.properties.forEach(function (prop) {
prop.errors.forEach(function (err) {
combinedErrors.push(err);
});
});
return combinedErrors;
},
enumerable: false,
configurable: true
});
return ComponentInfo;
})();
exports.ComponentInfo = ComponentInfo;

View File

@@ -1,282 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const skipMethodNames = [
'ngOnChanges',
'ngOnDestroy',
'ngOnInit'
];
export class PropInfo {
name: string;
type: string;
typeLink: string;
defaultValue: string;
docText: string;
isInput: boolean;
isOutput: boolean;
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();
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(/\|/, '\\|').replace('unknown', '');
if (sourceData.tags) {
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.isInput = false;
this.isOutput = false;
if (sourceData.decorators) {
sourceData.decorators.forEach(dec => {
if (dec.name === 'Input') {
this.isInput = true;
if (dec.arguments) {
const bindingName = dec.arguments['bindingPropertyName'];
if (bindingName && (bindingName !== '')) {
this.name = bindingName.replace(/['"]/g, '');
}
}
if (!this.docText && !this.isDeprecated) {
this.errorMessages.push(`Error: Input "${sourceData.name}" has no doc text.`);
}
}
if (dec.name === 'Output') {
this.isOutput = true;
if (!this.docText && !this.isDeprecated) {
this.errorMessages.push(`Error: Output "${sourceData.name}" has no doc text.`);
}
}
});
}
}
get errors() {
return this.errorMessages;
}
}
export class ParamInfo {
name: string;
type: string;
defaultValue: string;
docText: string;
combined: string;
isOptional: boolean;
constructor(sourceData) {
this.name = sourceData.id;
this.type = sourceData.type.toString().replace(/\s/g, '');
this.defaultValue = sourceData.defaultValue;
this.docText = sourceData.description.replace(/[\n\r]+/g, ' ').trim();
this.isOptional = false;
if (sourceData.flags) {
const flag = sourceData.flags.find((sourceFlag: any) => sourceFlag.name === 'isOptional');
if (flag) {
this.isOptional = true;
}
}
this.combined = this.name;
if (this.isOptional) {
this.combined += '?';
}
this.combined += `: \`${this.type}\``;
if (this.defaultValue !== '') {
this.combined += ` = \`${this.defaultValue}\``;
}
}
}
export class MethodSigInfo {
name: string;
docText: string;
returnType: string;
returnDocText: string;
returnsSomething: boolean;
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();
if (!this.docText && this.name.indexOf('service') > 0) {
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.returnsSomething = false;
}
if (this.returnsSomething && !this.returnDocText && this.name.indexOf('service') > 0) {
this.errorMessages.push(`Warning: Return value of method "${sourceData.name}" has no doc text.`);
}
this.isDeprecated = false;
if (sourceData.tags) {
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.params = [];
const paramStrings = [];
if (sourceData.syntax.parameters) {
sourceData.syntax.parameters.forEach(rawParam => {
if (rawParam.name && !rawParam.description && !rawParam.name.startWith('on')) {
this.errorMessages.push(`Warning: parameter "${rawParam.name}" of method "${sourceData.name}" has no doc text.`);
}
const param = new ParamInfo(rawParam);
this.params.push(param);
paramStrings.push(param.combined);
});
}
this.signature = '(' + paramStrings.join(', ') + ')';
}
get errors() {
return this.errorMessages;
}
}
export class ComponentInfo {
name: string;
itemType: string;
properties: PropInfo[];
methods: MethodSigInfo[];
hasInputs: boolean;
hasOutputs: boolean;
hasMethods: boolean;
sourcePath: string;
sourceLine: number;
constructor(sourceData) {
this.name = sourceData.items[0].name;
this.itemType = sourceData.items[0].type;
this.hasInputs = false;
this.hasOutputs = false;
this.hasMethods = false;
this.sourcePath = sourceData.items[0].source.path;
this.sourceLine = sourceData.items[0].source.line;
if (this.itemType === 'type alias') {
return;
}
this.properties = [];
this.methods = [];
sourceData.items.forEach(item => {
switch (item.type) {
case 'property':
case 'accessor':
const prop = new PropInfo(item);
this.properties.push(prop);
if (prop.isInput) {
this.hasInputs = true;
}
if (prop.isOutput) {
this.hasOutputs = true;
}
break;
case 'method':
if (item.flags && (item.flags.length > 0) &&
!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;
}
break;
default:
break;
}
});
}
get errors() {
const combinedErrors = [];
this.methods.forEach(method => {
method.errors.forEach(err => {
combinedErrors.push(err);
});
});
this.properties.forEach(prop => {
prop.errors.forEach(err => {
combinedErrors.push(err);
});
});
return combinedErrors;
}
}

View File

@@ -1,23 +0,0 @@
<% if (hasInputs) { %>
### Properties
| Name | Type | Default value | Description |
| --- | --- | --- | --- |
<% properties.forEach(function(prop) { -%>
<% if (prop.isInput) { -%>
| <%= prop.name %> | <% if (prop.type) { %>`<%- prop.type %>`<% } %> | <%- prop.defaultValue %> | <%- prop.docText %> |
<% } -%>
<% }) -%>
<% } %>
<% if (hasOutputs) { %>
### Events
| Name | Type | Description |
| --- | --- | --- |
<% properties.forEach(function(prop) { -%>
<% if (prop.isOutput) { -%>
| <%= prop.name %> | `<%- prop.type %>` | <%- prop.docText %> |
<% } -%>
<% }) -%>
<% } %>

View File

@@ -1,23 +0,0 @@
<% if (hasInputs) { %>
### Properties
| Name | Type | Default value | Description |
| --- | --- | --- | --- |
<% properties.forEach(function(prop) { -%>
<% if (prop.isInput) { -%>
| <%= prop.name %> | `<%- prop.type %>` | <%- prop.defaultValue %> | <%- prop.docText %> |
<% } -%>
<% }) -%>
<% } %>
<% if (hasOutputs) { %>
### Events
| Name | Type | Description |
| --- | --- | --- |
<% properties.forEach(function(prop) { -%>
<% if (prop.isOutput) { -%>
| <%= prop.name %> | `<%- prop.type %>` | <%- prop.docText %> |
<% } -%>
<% }) -%>
<% } %>

View File

@@ -1,40 +0,0 @@
<%
function relDocPath(fullPath) {
return fullPath.substring(fullPath.indexOf('docs') + 5).replace('\\', '/')
}
function relSrcPath(document) {
if(document && document.heading && document.heading.link && document.heading.link.url){
return '../' + document.heading.link.url.substring(document.heading.link.url.indexOf('lib')).replace('\\', '/')
}
}
function renderSection(sectionName) {
var sectionDocs = documents.filter(doc => doc.classType === sectionName.toLowerCase());
if (sectionDocs.length > 0) { -%>
### <%= sectionName %>
| Name | Description | Source link |
| --- | --- | --|
<% }
sectionDocs.forEach(document => { -%>
| [<%= document['title'] %>](<%= relDocPath(document['id']) %>) -%>
<% if (document['status'] && document['status'] !== 'Active') { -%>
![<%= document['status'] %>](docassets/images/<%= document['status'] %>Icon.png) <% } -%>
| <%= document['paragraph']['plaintext'] %> | [Source](<%= relSrcPath(document) %>) |
<% });
}
-%>
<%
renderSection('Components');
renderSection('Directives');
renderSection('Dialogs');
renderSection('Interfaces');
renderSection('Models');
renderSection('Pipes');
renderSection('Services');
renderSection('Widgets');
-%>

View File

@@ -1,28 +0,0 @@
---
Title: License info, ADF <%= projVersion %>
---
# License information for ADF <%= projVersion %>
This page lists all third party libraries that ADF <%= projVersion %> depends on.
## Libraries
| Name | Version | License |
| --- | --- | --- |
<% for (var packageName in packages) {
var lastAtSignPos = packageName.lastIndexOf('@');
var name = packageName.substring(0, lastAtSignPos);
var version = packageName.substring(lastAtSignPos + 1);
var pack = packages[packageName];
var licenses = pack['licenseExp'] || 'N/A';
var repo = pack['repository'];
var linkedName = name;
if (repo) {
linkedName = `[${name}](${repo})`
}
-%>
| <%= linkedName %> | <%= version %> | <%= licenses %> |
<% } %>

View File

@@ -1,15 +0,0 @@
<% if (hasMethods) { %>
### Methods
<% methods.forEach(function(meth) { -%>
- **<%= meth.name %>**<%- meth.signature %><% if (meth.returnsSomething) { %>: `<%- meth.returnType %>`<% } %><br/>
<%= meth.docText %>
<% meth.params.forEach(function(param) { -%>
- *<%= param.name%>:* `<%- param.type %>` - <% if (param.isOptional) { %>(Optional) <% } %><%= param.docText %>
<% }) -%>
<% if (meth.returnsSomething) { -%>
- **Returns** `<%- meth.returnType %>` - <%= meth.returnDocText %>
<% } -%>
<% }) -%>
<% } %>

View File

@@ -1,3 +0,0 @@
<% headings.forEach(function(heading) { -%>
<%= " ".repeat(heading.level); %>- [<%= heading.title %>](<%= heading.anchor %>)
<% }); %>

View File

@@ -1,5 +0,0 @@
| Name | Level | Abstract |
| --- | --- | --- |
<% tuts.forEach(function(tut) { -%>
| [**<%= tut.title %>**](<%= tut.link %>) | <%= tut.level %> | <%= tut.briefDesc %> |
<% }) %>

View File

@@ -1,3 +0,0 @@
<% items.forEach(function(item) { -%>
- [<%= item.title %>](<%= item.link %>)
<% }) %>

View File

@@ -1,125 +0,0 @@
'use strict';
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, '__esModule', { value: true });
exports.processDocs = processDocs;
var path = require('path');
var fs = require('fs');
var unist_util_select_1 = require('unist-util-select');
var lev = require('fast-levenshtein');
var ngHelpers = require('../ngHelpers');
var imageFolderPath = path.resolve('docs', 'docassets', 'images');
// Using this value for the edit distance between Markdown image URLs
// and filenames is enough to trap errors like missing out the 'images'
// folder in the path. Keeping it low avoids crazy suggestions.
var maxImagePathLevDistance = 7;
function processDocs(mdCache, aggData) {
var pathnames = Object.keys(mdCache);
var classlessDocs = [];
var linkRefs = {};
var imageRefs = {};
var brokenImageRefs = {};
var filters = makeFilepathFilters(aggData.config['fileCheckerFilter']);
pathnames.forEach(function (pathname) {
var fileBaseName = path.basename(pathname, '.md');
var tree = mdCache[pathname].mdOutTree;
var className = ngHelpers.ngNameToClassName(fileBaseName, aggData.config.typeNameExceptions);
var classInfo = aggData.classInfo[className];
if (!classInfo) {
if (!filterFilepath(filters, pathname)) {
classlessDocs.push(pathname);
}
} else {
var linkElems = (0, unist_util_select_1.selectAll)('link', tree);
linkElems.forEach(function (linkElem) {
var normUrl = normaliseLinkPath(pathname, linkElem.url);
multiSetAdd(linkRefs, normUrl, pathname);
});
}
var imageElems = (0, unist_util_select_1.selectAll)('image', tree);
imageElems.forEach(function (imageElem) {
var normUrl = normaliseLinkPath(pathname, imageElem.url);
multiSetAdd(imageRefs, normUrl, pathname);
if (!fs.existsSync(normUrl)) {
brokenImageRefs[normUrl] = pathname;
}
});
});
classlessDocs.forEach(function (docPath) {
var relDocPath = docPath.substring(docPath.indexOf('docs'));
console.group('Warning: no source class found for "'.concat(relDocPath, '"'));
if (linkRefs[docPath]) {
linkRefs[docPath].forEach(function (linkRef) {
var relLinkPath = linkRef.substring(linkRef.indexOf('docs'));
console.log('Linked from: "'.concat(relLinkPath, '"'));
});
}
console.groupEnd();
});
console.log();
var imagePaths = getImagePaths(imageFolderPath);
imagePaths.forEach(function (imagePath) {
if (!imageRefs[imagePath]) {
var relImagePath = imagePath.substring(imagePath.indexOf('docs'));
console.log('Warning: no links to image file "'.concat(relImagePath, '"'));
}
});
console.log();
var brokenImUrls = Object.keys(brokenImageRefs);
brokenImUrls.forEach(function (url) {
var relUrl = url.substring(url.indexOf('docs'));
var relDocPath = brokenImageRefs[url].substring(brokenImageRefs[url].indexOf('docs'));
console.group('Broken image link "'.concat(relUrl, '" found in "').concat(relDocPath));
imagePaths.forEach(function (imPath) {
if (lev.get(imPath, url) <= maxImagePathLevDistance) {
var relImPath = imPath.substring(imPath.indexOf('docs'));
console.log('Should it be "'.concat(relImPath, '"?'));
}
});
console.groupEnd();
});
}
function normaliseLinkPath(homeFilePath, linkUrl) {
var homeFolder = path.dirname(homeFilePath);
return path.resolve(homeFolder, linkUrl);
}
function getImagePaths(imageFolder) {
var files = fs.readdirSync(imageFolder);
return files.map(function (f) {
return path.resolve(imageFolder, f);
});
}
function makeFilepathFilters(patterns) {
return patterns.map(function (r) {
return new RegExp(r);
});
}
function filterFilepath(filters, filepath) {
for (var i = 0; i < filters.length; i++) {
if (filters[i].test(filepath)) {
return true;
}
}
return false;
}
function multiSetAdd(container, key, value) {
if (container[key]) {
container[key].push(value);
} else {
container[key] = [value];
}
}

View File

@@ -1,147 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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');
// Using this value for the edit distance between Markdown image URLs
// and filenames is enough to trap errors like missing out the 'images'
// folder in the path. Keeping it low avoids crazy suggestions.
const maxImagePathLevDistance = 7;
export function processDocs(mdCache, aggData) {
const pathnames = Object.keys(mdCache);
const classlessDocs = [];
const linkRefs = {};
const imageRefs = {};
const brokenImageRefs = {};
const filters = makeFilepathFilters(aggData.config['fileCheckerFilter']);
pathnames.forEach(pathname => {
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 {
const linkElems = selectAll('link', tree);
linkElems.forEach(linkElem => {
const normUrl = normaliseLinkPath(pathname, linkElem.url);
multiSetAdd(linkRefs, normUrl, pathname);
});
}
const imageElems = selectAll('image', tree);
imageElems.forEach(imageElem => {
const normUrl = normaliseLinkPath(pathname, imageElem.url);
multiSetAdd(imageRefs, normUrl, pathname);
if (!fs.existsSync(normUrl)) {
brokenImageRefs[normUrl] = pathname;
}
});
});
classlessDocs.forEach(docPath => {
const relDocPath = docPath.substring(docPath.indexOf('docs'));
console.group(`Warning: no source class found for "${relDocPath}"`);
if (linkRefs[docPath]) {
linkRefs[docPath].forEach(linkRef => {
const relLinkPath = linkRef.substring(linkRef.indexOf('docs'));
console.log(`Linked from: "${relLinkPath}"`);
});
}
console.groupEnd();
});
console.log();
const imagePaths = getImagePaths(imageFolderPath);
imagePaths.forEach(imagePath => {
if (!imageRefs[imagePath]) {
const relImagePath = imagePath.substring(imagePath.indexOf('docs'));
console.log(`Warning: no links to image file "${relImagePath}"`);
}
});
console.log();
const brokenImUrls = Object.keys(brokenImageRefs);
brokenImUrls.forEach(url => {
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) {
const relImPath = imPath.substring(imPath.indexOf('docs'));
console.log(`Should it be "${relImPath}"?`);
}
});
console.groupEnd();
});
}
function normaliseLinkPath(homeFilePath, linkUrl) {
const homeFolder = path.dirname(homeFilePath);
return path.resolve(homeFolder, linkUrl);
}
function getImagePaths(imageFolder) {
const files = fs.readdirSync(imageFolder);
return files.map(f => path.resolve(imageFolder, f));
}
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 false;
}
function multiSetAdd(container: {}, key: string, value: string) {
if (container[key]) {
container[key].push(value);
} else {
container[key] = [ value ];
}
}

View File

@@ -1,60 +0,0 @@
'use strict';
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, '__esModule', { value: true });
exports.processDocs = processDocs;
var fs = require('fs');
var path = require('path');
var ejs = require('ejs');
var remark = require('remark');
var frontMatter = require('remark-frontmatter');
var replaceZone = require('mdast-zone');
var graphql_1 = require('graphql');
var MQ = require('../mqDefs');
var libNamesList = ['content-services', 'core', 'extensions', 'insights', 'process-services', 'process-services-cloud'];
var query =
'\n query libIndex($libName: String) {\n documents(idFilter: $libName) {\n title: metadata(key: "Title")\n status: metadata(key: "Status")\n id\n classType: folder(depth: 2)\n heading {\n link {\n url\n }\n }\n paragraph {\n plaintext\n }\n }\n }\n';
function processDocs(mdCache, aggData) {
var docset = new MQ.Docset(mdCache);
var templateFilePath = path.resolve(__dirname, '..', 'templates', 'gqIndex.ejs');
var templateSource = fs.readFileSync(templateFilePath, 'utf8');
var template = ejs.compile(templateSource);
var indexFilePath = path.resolve(aggData['rootFolder'], 'docs', 'README.md');
var indexFileText = fs.readFileSync(indexFilePath, 'utf8');
var indexMD = remark().use(frontMatter, ['yaml']).parse(indexFileText);
var schema = (0, graphql_1.buildSchema)(MQ.schema);
libNamesList.forEach(function (libName) {
(0, graphql_1.graphql)(schema, query, docset, null, { libName: libName }).then(function (response) {
if (!response['data']) {
console.log(JSON.stringify(response));
} else {
// 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);
newSection_1.push(end);
return newSection_1;
});
var outText = remark()
.use(frontMatter, { type: 'yaml', fence: '---' })
.data('settings', { paddedTable: false, gfm: false })
.stringify(indexMD);
fs.writeFileSync(indexFilePath, outText);
}
});
});
}

View File

@@ -1,91 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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';
const libNamesList = [
'content-services', 'core', 'extensions',
'insights', 'process-services', 'process-services-cloud'
];
const query = `
query libIndex($libName: String) {
documents(idFilter: $libName) {
title: metadata(key: "Title")
status: metadata(key: "Status")
id
classType: folder(depth: 2)
heading {
link {
url
}
}
paragraph {
plaintext
}
}
}
`;
export function processDocs(mdCache, aggData) {
const docset: MQ.Docset = new MQ.Docset(mdCache);
const templateFilePath = path.resolve(__dirname, '..', 'templates', 'gqIndex.ejs');
const templateSource = fs.readFileSync(templateFilePath, 'utf8');
const template = ejs.compile(templateSource);
const indexFilePath = path.resolve(aggData['rootFolder'], 'docs', 'README.md');
const indexFileText = fs.readFileSync(indexFilePath, 'utf8');
const indexMD = remark()
.use(frontMatter, ['yaml'])
.parse(indexFileText);
const schema = buildSchema(MQ.schema);
libNamesList.forEach(libName => {
graphql(schema, query, docset, null, {'libName': libName})
.then((response) => {
if (!response['data']) {
console.log(JSON.stringify(response));
} else {
// console.log(template(response['data']));
const newSection = remark().parse(template(response['data'])).children;
replaceZone(indexMD, libName, (start, _oldZone, end) => {
newSection.unshift(start);
newSection.push(end);
return newSection;
});
const outText = remark()
.use(frontMatter, {type: 'yaml', fence: '---'})
.data('settings', {paddedTable: false, gfm: false})
.stringify(indexMD);
fs.writeFileSync(indexFilePath, outText);
}
});
});
}

View File

@@ -1,406 +0,0 @@
var fs = require("fs");
var path = require("path");
var remark = require("remark");
var frontMatter = require("remark-frontmatter");
var zone = require("mdast-zone");
var yaml = require("js-yaml");
var unist = require("../unistHelpers");
var ngHelpers = require("../ngHelpers");
var searchLibraryRecursive = require("../libsearch");
var mdNav = require("../mdNav");
module.exports = {
"processDocs": processDocs
};
var docsFolderPath = path.resolve("docs");
var rootFolder = "lib";
var indexMdFilePath = path.resolve(docsFolderPath, "README.md");
var guideFolderName = "user-guide";
var guideSummaryFileName = path.resolve(docsFolderPath, guideFolderName, "summary.json");
var adfLibNames = [
"core", "content-services", "insights",
"process-services", "process-services-cloud", "extensions"
];
var statusIcons;
function processDocs(mdCache, aggData) {
initPhase(aggData);
readPhase(mdCache, aggData);
aggPhase(aggData);
}
function initPhase(aggData) {
statusIcons = aggData.config["statusIcons"] || {};
aggData.stoplist = makeStoplist(aggData.config);
aggData.srcData = {};
aggData.mdFileDesc = [];
aggData.mdFileStatus = [];
aggData.mdFilePath = [];
searchLibraryRecursive(aggData.srcData, path.resolve(rootFolder));
}
function readPhase(mdCache, aggData) {
var pathnames = Object.keys(mdCache);
pathnames.forEach(pathname => {
getFileData(mdCache[pathname].mdInTree, pathname, aggData);
});
}
function getFileData(tree, pathname, aggData) {
var itemName = path.basename(pathname, ".md");
// Look for the first paragraph in the file by skipping other items.
// Should usually be at position 1 in the tree.
var s;
var briefDesc;
if (tree.children[0].type == "yaml")
s = 1;
else
s = 0;
for (;
(s < tree.children.length) && !unist.isParagraph(tree.children[s]);
s++
);
if (s < tree.children.length) {
briefDesc = tree.children[s];
}
aggData.mdFileDesc[itemName] = briefDesc;
if (tree.children[0].type == "yaml") {
var metadata = yaml.load(tree.children[0].value);
var status = metadata["Status"];
if (status) {
var compName = path.basename(pathname, ".md");
aggData.mdFileStatus[compName] = status;
}
}
var linkPath = pathname.replace(/\\/g, '/');
linkPath = linkPath.substr(linkPath.indexOf("docs") + 5);
aggData.mdFilePath[itemName] = linkPath;
}
function aggPhase(aggData) {
var sections = prepareIndexSections(aggData);
var indexFileText = fs.readFileSync(indexMdFilePath, "utf8");
var indexFileTree = remark().use(frontMatter, ["yaml"]).parse(indexFileText);
for (var l = 0; l < adfLibNames.length; l++) {
var libName = adfLibNames[l];
var libSection = sections[libName];
var md = makeLibSectionMD(libSection, false);
zone(indexFileTree, libName, (startComment, oldSection, endComment) => {
md.unshift(startComment);
md.push(endComment);
return md;
});
var md = makeLibSectionMD(libSection, true);
var subIndexFilePath = path.resolve(docsFolderPath, libName, "README.md");
var subIndexText = fs.readFileSync(subIndexFilePath, "utf8");
var subIndexTree = remark().use(frontMatter, ["yaml"]).parse(subIndexText);
zone(subIndexTree, libName, (startComment, oldSection, endComment) => {
md.unshift(startComment);
md.push(endComment);
return md;
});
subIndexText = remark().use(frontMatter, ["yaml"]).data("settings", {paddedTable: false}).stringify(subIndexTree);
fs.writeFileSync(subIndexFilePath, subIndexText);
}
var guideSection = buildGuideSection(guideSummaryFileName, false);
zone(indexFileTree, "guide", (startComment, oldSection, endComment) => {
return [
startComment, guideSection, endComment
]
});
fs.writeFileSync(path.resolve("docs", "README.md"), remark().use(frontMatter, ["yaml"]).data("settings", {paddedTable: false}).stringify(indexFileTree));
guideSection = buildGuideSection(guideSummaryFileName, true);
subIndexFilePath = path.resolve(docsFolderPath, "user-guide", "README.md");
subIndexText = fs.readFileSync(subIndexFilePath, "utf8");
subIndexTree = remark().use(frontMatter, ["yaml"]).parse(subIndexText);
zone(subIndexTree, "guide", (startComment, oldSection, endComment) => {
return [
startComment, guideSection, endComment
]
});
subIndexText = remark().use(frontMatter, ["yaml"]).data("settings", {paddedTable: false}).stringify(subIndexTree);
fs.writeFileSync(subIndexFilePath, subIndexText);
}
// Create a stoplist of regular expressions.
function makeStoplist(config) {
var listExpressions = config.undocStoplist;
var result = [];
for (var i = 0; i < listExpressions.length; i++) {
result.push(new RegExp(listExpressions[i]));
}
return result;
}
// Check if an item is covered by the stoplist and reject it if so.
function rejectItemViaStoplist(stoplist, itemName) {
for (var i = 0; i < stoplist.length; i++) {
if (stoplist[i].test(itemName)) {
return true;
}
}
return false;
}
function prepareIndexSections(aggData) {
var srcNames = Object.keys(aggData.srcData);
var sections = initEmptySections();
for (var i = 0; i < srcNames.length; i++) {
var itemName = srcNames[i];
var srcData = aggData.srcData[itemName];
var libName = srcData.path.substr(0, srcData.path.indexOf("/"));
var briefDesc = aggData.mdFileDesc[itemName];
var displayName = ngHelpers.ngNameToDisplayName(itemName);
var pathname = aggData.mdFilePath[itemName];
var status = "";
if (aggData.mdFileStatus[itemName])
status = aggData.mdFileStatus[itemName];
if (briefDesc) {
sections[libName][srcData.type].documented.push({
"displayName": displayName,
"mdName": itemName + ".md",
"mdPath": pathname,
"srcPath": srcData.path,
"briefDesc": briefDesc,
"status": status
});
} else if (!rejectItemViaStoplist(aggData.stoplist, itemName)) {
if(sections[libName]){
sections[libName][srcData.type].undocumented.push({
"displayName": displayName,
"mdName": itemName + ".md",
"srcPath": srcData.path
});
}
}
}
return sections;
}
function initEmptySections() {
var result = {};
for (var l = 0; l < adfLibNames.length; l++) {
var lib = result[adfLibNames[l]] = {};
for (var c = 0; c < ngHelpers.classTypes.length; c++) {
var classType = lib[ngHelpers.classTypes[c]] = {};
classType.undocumented = [];
classType.documented = [];
}
}
return result;
}
function buildMDDocumentedTable(docItems, forSubFolder) {
var rows = [
];
for (var i = 0; i < docItems.length; i++) {
rows.push(makeMDDocumentedTableRow(docItems[i], forSubFolder));
}
return rows;
}
function buildMDUndocumentedTable(docItems, forSubFolder) {
var rows = [
];
for (var i = 0; i < docItems.length; i++) {
rows.push(makeMDUndocumentedTableRow(docItems[i], forSubFolder));
}
return rows;
}
function makeMDDocumentedTableRow(docItem, forSubFolder) {
var mdPath = docItem.mdPath;
if (forSubFolder) {
mdPath = path.basename(mdPath);
}
var mdFileLink = unist.makeLink(unist.makeText(docItem.displayName), mdPath);
var srcPath = "../lib/" + docItem.srcPath;
if (forSubFolder) {
srcPath = "../" + srcPath;
}
var srcFileLink = unist.makeLink(unist.makeText("Source"), srcPath);
var desc = JSON.parse(JSON.stringify(docItem.briefDesc));
removeBriefDescLinks(desc);
var linkCellItems = [mdFileLink];
var pathPrefix = "";
if (forSubFolder) {
pathPrefix = "../";
}
if (docItem.status) {
if (statusIcons[docItem.status]) {
linkCellItems.push(unist.makeText(" "));
linkCellItems.push(unist.makeImage(pathPrefix + statusIcons[docItem.status], docItem.status));
}
}
return unist.makeTableRow([
unist.makeTableCell(linkCellItems),
unist.makeTableCell([desc]),
unist.makeTableCell([srcFileLink])
]);
}
function makeMDUndocumentedTableRow(docItem, forSubFolder) {
var itemName = unist.makeText(docItem.displayName);
var srcPath = "../lib/" + docItem.srcPath;
if (forSubFolder) {
srcPath = "../" + srcPath;
}
var srcFileLink = unist.makeLink(unist.makeText("Source"), srcPath);
return unist.makeTableRow([
unist.makeTableCell([unist.makeEmphasis([itemName])]),
unist.makeTableCell([unist.makeEmphasis([unist.makeText("Not currently documented")])]),
unist.makeTableCell([srcFileLink])
]);
}
function makeLibSectionMD(libSection, forSubFolder){
var md = [];
var libClassTypes = Object.keys(libSection);
for (var i = 0; i < libClassTypes.length; i++) {
var classType = libClassTypes[i];
var classSection = libSection[classType];
if (!classSection)
continue;
var displayNameNode;
if ((classSection.documented.length > 0) || (classSection.undocumented.length > 0)) {
displayNameNode = unist.makeText(ngHelpers.dekebabifyName(classType + "s"));
md.push(unist.makeHeading(displayNameNode, 2));
var tableRows = [
unist.makeTableRow([
unist.makeTableCell([unist.makeText("Name")]),
unist.makeTableCell([unist.makeText("Description")]),
unist.makeTableCell([unist.makeText("Source link")])
])
];
if (classSection.documented.length > 0) {
tableRows = tableRows.concat(buildMDDocumentedTable(classSection.documented, forSubFolder));
}
if (classSection.undocumented.length > 0) {
tableRows = tableRows.concat(buildMDUndocumentedTable(classSection.undocumented, forSubFolder));
}
md.push(unist.makeTable([null, null, null, null], tableRows));
}
}
return md;
}
function buildGuideSection(guideJsonFilename, forSubFolder) {
var summary = JSON.parse(fs.readFileSync(guideJsonFilename, "utf8"));
var listItems = [];
for (var i = 0; i < summary.length; i++) {
var filePath = summary[i].file;
if (!forSubFolder) {
filePath = guideFolderName + "/" + filePath;
}
if (summary[i].title !== "Tutorials") {
var link = unist.makeLink(unist.makeText(summary[i].title), filePath);
listItems.push(unist.makeListItem(link));
}
}
return unist.makeListUnordered(listItems);
}
function removeBriefDescLinks(desc) {
var nav = new mdNav.MDNav(desc);
var links = nav.links();
links.forEach(link => {
link.item.type = "text";
link.item.value = link.item.children[0].value;
link.item.children = null;
});
}

View File

@@ -1,105 +0,0 @@
'use strict';
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, '__esModule', { value: true });
exports.processDocs = processDocs;
var path = require('path');
var fs = require('fs');
var unist_util_select_1 = require('unist-util-select');
var suffixesNotToCheck = /\.ts/;
function processDocs(mdCache, aggData) {
var pathnames = Object.keys(mdCache);
var linkSet = new LinkSet(pathnames);
var imageFolderPath = path.resolve(aggData['rootFolder'], 'docs', 'docassets', 'images');
var imageSet = new LinkSet(getImagePaths(imageFolderPath));
pathnames.forEach(function (pathname) {
var tree = mdCache[pathname].mdOutTree;
fixUrls(tree, pathname, linkSet, 'link');
fixUrls(tree, pathname, imageSet, 'image');
});
}
function fixUrls(tree, docFilePath, linkSet, selector) {
var linksInDoc = (0, unist_util_select_1.selectAll)(selector, tree);
var errors = [];
linksInDoc.forEach(function (linkElem) {
var origFullUrlPath = path.resolve(path.dirname(docFilePath), linkElem.url);
var hashPos = origFullUrlPath.indexOf('#');
var anchor = '';
if (hashPos !== -1) {
anchor = origFullUrlPath.substring(hashPos);
origFullUrlPath = origFullUrlPath.substring(0, hashPos);
}
if (
!linkElem.url.match(/http:|https:|ftp:|mailto:/) &&
!path.extname(origFullUrlPath).match(suffixesNotToCheck) &&
origFullUrlPath !== '' &&
!fs.existsSync(origFullUrlPath)
) {
var newUrl = linkSet.update(origFullUrlPath) || origFullUrlPath;
linkElem.url = path.relative(path.dirname(docFilePath), newUrl).replace(/\\/g, '/') + anchor;
errors.push('Bad link: '.concat(origFullUrlPath, '\nReplacing with ').concat(linkElem.url));
} /*else {
console.log(`Link OK: ${origFullUrlPath}`);
}
*/
});
if (errors.length > 0) {
showMessages('File: '.concat(docFilePath, ':'), errors);
}
}
function showMessages(groupName, messages) {
console.group(groupName);
messages.forEach(function (message) {
console.log(message);
});
console.groupEnd();
}
function getImagePaths(imageFolderPath) {
return fs.readdirSync(imageFolderPath).map(function (imageFileName) {
return path.resolve(imageFolderPath, imageFileName);
});
}
var LinkSet = /** @class */ (function () {
function LinkSet(urls) {
var _this = this;
this.links = new Map();
urls.forEach(function (url) {
var fileName = path.basename(url);
if (_this.links.has(fileName)) {
var item = _this.links.get(fileName);
item.push(url);
} else {
_this.links.set(fileName, [url]);
}
});
}
LinkSet.prototype.update = function (oldUrl) {
var oldFileName = path.basename(oldUrl);
if (!this.links.has(oldFileName)) {
return '';
} else {
var candidates = this.links.get(oldFileName);
if (candidates.length === 1) {
return candidates[0];
} else {
console.log('Multiple candidates for '.concat(oldUrl));
return '';
}
}
};
return LinkSet;
})();

View File

@@ -1,126 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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) {
const pathnames = Object.keys(mdCache);
const linkSet = new LinkSet(pathnames);
const imageFolderPath = path.resolve(aggData['rootFolder'], 'docs', 'docassets', 'images');
const imageSet = new LinkSet(getImagePaths(imageFolderPath));
pathnames.forEach(pathname => {
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) {
const linksInDoc = selectAll(selector, tree);
const errors: string[] = [];
linksInDoc.forEach(linkElem => {
let origFullUrlPath = path.resolve(path.dirname(docFilePath), linkElem.url);
const hashPos = origFullUrlPath.indexOf('#');
let anchor = '';
if (hashPos !== -1) {
anchor = origFullUrlPath.substring(hashPos);
origFullUrlPath = origFullUrlPath.substring(0, hashPos);
}
if (!linkElem.url.match(/http:|https:|ftp:|mailto:/) &&
!path.extname(origFullUrlPath).match(suffixesNotToCheck) &&
(origFullUrlPath !== '') &&
!fs.existsSync(origFullUrlPath)
) {
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}`);
}
*/
});
if (errors.length > 0) {
showMessages(`File: ${docFilePath}:`, errors);
}
}
function showMessages(groupName: string, messages: string[]) {
console.group(groupName);
messages.forEach(message => {
console.log(message);
});
console.groupEnd();
}
function getImagePaths(imageFolderPath: string): string[] {
return fs.readdirSync(imageFolderPath)
.map(imageFileName => path.resolve(imageFolderPath, imageFileName));
}
class LinkSet {
links: Map<string, string[]>;
constructor(urls: string[]) {
this.links = new Map();
urls.forEach(url => {
const fileName = path.basename(url);
if (this.links.has(fileName)) {
const item = this.links.get(fileName);
item.push(url);
} else {
this.links.set(fileName, [url]);
}
});
}
update(oldUrl: string): string {
const oldFileName = path.basename(oldUrl);
if (!this.links.has(oldFileName)) {
return '';
} else {
const candidates = this.links.get(oldFileName);
if (candidates.length === 1) {
return candidates[0];
} else {
console.log(`Multiple candidates for ${oldUrl}`);
return '';
}
}
}
}

View File

@@ -1,143 +0,0 @@
const path = require('path');
const unist = require('../unistHelpers');
const seeAlsoHeading = 'See Also';
module.exports = {
initPhase: initPhase,
readPhase: readPhase,
aggPhase: aggPhase,
updatePhase: updatePhase
};
function initPhase(aggData) {
aggData.saGraph = {};
aggData.saUpdateGraph = {};
}
function readPhase(tree, pathname, aggData) {
var saHeadingOffset = findSeeAlsoSection(tree);
var saNode = [];
if (saHeadingOffset !== -1) {
// Skip over non-list parts.
var s;
for (s = saHeadingOffset; s < tree.children.length && !unist.isListUnordered(tree.children[s]); s++);
if (s < tree.children.length && unist.isListUnordered(tree.children[s])) {
var list = tree.children[s];
for (var i = 0; i < list.children.length; i++) {
var itemLink = getItemLinkInfo(list.children[i]);
if (itemLink) {
saNode.push(itemLink);
}
}
}
}
aggData.saGraph[path.basename(pathname, '.md')] = saNode;
}
function aggPhase(aggData) {
aggData.saUpdateGraph = tidyGraph(aggData.saGraph);
}
function updatePhase(tree, pathname, aggData) {
var currNodeName = path.basename(pathname, '.md');
var currNodeArcs = aggData.saUpdateGraph[currNodeName];
if (currNodeArcs.length > 0) {
var saListItems = [];
for (var i = 0; i < currNodeArcs.length; i++) {
var linkText = graphKeyToLinkName(currNodeArcs[i]);
var linkTarget = currNodeArcs[i] + '.md';
var link = unist.makeLink(unist.makeText(linkText), linkTarget);
saListItems.push(unist.makeListItem(link));
}
var saHeadingOffset = findSeeAlsoSection(tree);
if (saHeadingOffset !== -1) {
// Skip over non-list parts.
var s;
for (s = saHeadingOffset; s < tree.children.length && !unist.isListUnordered(tree.children[s]); s++);
// Push all elements of the items array as if they were separate elements.
Array.prototype.push.apply(tree.children[s].children, saListItems);
} else {
// This file doesn't currently have a See Also section, so add one at the end.
tree.children.push(unist.makeHeading(unist.makeText(seeAlsoHeading), 2));
tree.children.push(unist.makeListUnordered(saListItems));
}
}
return true;
}
function graphKeyToLinkName(key) {
var mainSections = key.split('.');
mainSections[0] = tidyName(mainSections[0]);
return mainSections.join(' ');
}
// Convert an Angular-style name (eg, "card-view") into one with correct spaces and uppercase (eg, "Card view").
function tidyName(name) {
var result = name.replace(/-/g, ' ');
result = result.substr(0, 1).toUpperCase() + result.substr(1);
return result;
}
// Makes link symmetrical between items (ie, if A links to B but not the other way
// around then it adds the missing link).
function tidyGraph(graph) {
var nodeNames = Object.keys(graph);
var result = {};
for (let n = 0; n < nodeNames.length; n++) {
result[nodeNames[n]] = [];
}
for (let n = 0; n < nodeNames.length; n++) {
var currNodeName = nodeNames[n];
var currNodeArcs = graph[currNodeName];
for (var a = 0; a < currNodeArcs.length; a++) {
var linkedNode = graph[currNodeArcs[a]];
var resultNode = result[currNodeArcs[a]];
if (!linkedNode) {
console.log(`Warning: item '${currNodeArcs[a]}' (in See Also section of '${currNodeName}') has no corresponding file`);
} else if (linkedNode.indexOf(currNodeName) === -1) {
linkedNode.push(currNodeName);
resultNode.push(currNodeName);
}
}
}
return result;
}
function findSeeAlsoSection(tree) {
var i;
for (i = 0; i < tree.children.length; i++) {
var child = tree.children[i];
if (unist.isHeading(child) && child.children[0].value.toLowerCase() === seeAlsoHeading.toLowerCase()) return i;
}
return -1;
}
function getItemLinkInfo(listItem) {
var linkTarget = listItem.children[0].children[0].url;
if (linkTarget.startsWith('http:') || linkTarget.startsWith('#') || !linkTarget.endsWith('.md')) return null;
else return path.basename(linkTarget, '.md');
}

View File

@@ -1,60 +0,0 @@
'use strict';
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, '__esModule', { value: true });
exports.processDocs = processDocs;
var path = require('path');
var unist_util_select_1 = require('unist-util-select');
var ngHelpers = require('../ngHelpers');
var angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(dialog)|(directive)|(interface)|(model)|(pipe)|(service)|(widget))/;
function processDocs(mdCache, aggData) {
var pathnames = Object.keys(mdCache);
pathnames.forEach(function (pathname) {
var fileBaseName = path.basename(pathname, '.md');
if (!fileBaseName.match(angFilenameRegex)) {
return;
}
var tree = mdCache[pathname].mdOutTree;
var className = ngHelpers.ngNameToClassName(fileBaseName, aggData.config.typeNameExceptions);
var classInfo = aggData.classInfo[className];
var sourcePath = classInfo ? classInfo.sourcePath : '';
var titleHeading = (0, 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') {
var titleText = titleHeading.children[0];
titleHeading.children[0] = {
type: 'link',
url: srcUrl, // `../../${sourcePath}`,
title: 'Defined in '.concat(path.basename(sourcePath)),
children: [titleText]
};
} else if (titleHeading && titleHeading.children[0].type === 'link' && sourcePath) {
var linkElem = titleHeading.children[0];
((linkElem.url = srcUrl), // `../../${sourcePath}`;
(linkElem.title = 'Defined in '.concat(path.basename(sourcePath))));
}
});
}
function fixRelSrcUrl(docPath, srcPath) {
var docPathSegments = docPath.split(/[\\\/]/);
var dotPathPart = '';
for (var i = 0; i < docPathSegments.length - 1; i++) {
dotPathPart += '../';
}
return dotPathPart + srcPath;
}

View File

@@ -1,67 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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) {
const pathnames = Object.keys(mdCache);
pathnames.forEach(pathname => {
const fileBaseName = path.basename(pathname, '.md');
if (!fileBaseName.match(angFilenameRegex)) {
return;
}
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') {
const titleText = titleHeading.children[0];
titleHeading.children[0] = {
type: 'link',
url: srcUrl, // `../../${sourcePath}`,
title: `Defined in ${path.basename(sourcePath)}`,
children: [titleText]
};
} 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) {
const docPathSegments = docPath.split(/[\\\/]/);
let dotPathPart = '';
for (let i = 0; i < (docPathSegments.length - 1); i++) {
dotPathPart += '../';
}
return dotPathPart + srcPath;
}

View File

@@ -1,138 +0,0 @@
const path = require('path');
const fs = require('fs');
const remark = require('remark');
const replaceSection = require('mdast-util-heading-range');
const toString = require('mdast-util-to-string');
const ejs = require('ejs');
const unist = require('../unistHelpers');
const mdNav = require('../mdNav');
const contentsHeading = 'Contents';
const minHeadingsForToc = 8;
const maxTocHeadingDepth = 3;
const templateFolder = path.resolve('tools', 'doc', 'templates');
module.exports = {
processDocs: processDocs
};
function processDocs(mdCache, aggData, errorMessages) {
const pathNames = Object.keys(mdCache);
pathNames.forEach((pathname) => {
updateFile(mdCache[pathname].mdOutTree, pathname, aggData, errorMessages);
});
}
// Find an existing Contents section or add a new empty one if needed.
// Returns true if section is present/needed, false if not needed.
function establishContentsSection(mdTree) {
let firstL2HeadingPos = -1;
let numTocHeadings = 0;
let foundContentsHeading = false;
for (let i = 0; i < mdTree.children.length; i++) {
const child = mdTree.children[i];
// Look through all headings.
if (child.type === 'heading') {
if (child.depth > 1 && child.depth <= maxTocHeadingDepth) {
numTocHeadings++;
}
if (child.depth === 2) {
// Note where the first L2 heading is.
if (firstL2HeadingPos === -1) {
firstL2HeadingPos = i;
}
// If it is also a Contents heading then we're done. We don't include the
// Contents heading itself within the ToC, so decrement the count for that.
if (child.children[0].value === contentsHeading && !foundContentsHeading) {
foundContentsHeading = true;
numTocHeadings--;
}
}
}
}
// If we get here then a level 2 Contents heading was not found.
// If there are enough headings for a ToC to be necessary then
// add one in the right place.
if (!foundContentsHeading) {
const newHeading = unist.makeHeading(unist.makeText(contentsHeading), 2);
// If we found another L2 heading then add the Contents in just before it.
if (firstL2HeadingPos !== -1) {
mdTree.children.splice(firstL2HeadingPos, 0, newHeading);
} else {
// Otherwise, the unlikely situation where a ToC is required but there
// are no L2 headings! Add it as the second element in the document.
mdTree.children.splice(1, 0, newHeading);
}
}
return numTocHeadings;
}
function updateFile(tree, pathname, _aggData, _errorMessages) {
if (path.basename(pathname, '.md').match(/README|versionIndex/)) {
return false;
}
// If we need a contents section then add one or update the existing one.
const numTocHeadings = establishContentsSection(tree);
if (numTocHeadings >= minHeadingsForToc) {
const newToc = makeToc(tree);
replaceSection(tree, contentsHeading, function (before, oldSection, after) {
return [before, newToc, after];
});
} else {
// Otherwise, we don't need one, so remove any existing one.
replaceSection(tree, contentsHeading, function (before, oldSection, after) {
return [after];
});
}
return true;
}
function makeToc(tree) {
const nav = new mdNav.MDNav(tree);
const headings = nav.headings((h) => h.depth > 1 && h.depth <= maxTocHeadingDepth);
const context = { headings: [] };
headings.forEach((heading) => {
let linkTitle = '';
if (!(heading.item.children.length > 0 && heading.item.children[0].type === 'text' && heading.item.children[0].value === 'Contents')) {
linkTitle = toString(heading.item).trim();
}
if (linkTitle !== '') {
context.headings.push({
level: heading.item.depth - 2,
title: linkTitle,
anchor:
'#' +
linkTitle
.toLowerCase()
.replace(/[^a-z0-9\s\-_]/g, '')
.replace(/\s/g, '-')
.replace(/-+$/, '')
});
}
});
const templateName = path.resolve(templateFolder, 'toc.ejs');
const templateSource = fs.readFileSync(templateName, 'utf8');
const template = ejs.compile(templateSource);
const mdText = template(context);
const newMD = remark().parse(mdText);
return newMD.children[0];
}

View File

@@ -1,198 +0,0 @@
'use strict';
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, '__esModule', { value: true });
exports.processDocs = processDocs;
var fs = require('fs');
var path = require('path');
var replaceSection = require('mdast-util-heading-range');
var remark = require('remark');
var ejs = require('ejs');
var mdNav_1 = require('../mdNav');
var ngHelpers_1 = require('../ngHelpers');
var templateFolder = path.resolve('tools', 'doc', 'templates');
var nameExceptions;
function processDocs(mdCache, aggData) {
nameExceptions = aggData.config.typeNameExceptions;
var pathNames = Object.keys(mdCache);
var internalErrors;
pathNames.forEach(function (pathname) {
internalErrors = [];
updateFile(mdCache[pathname].mdOutTree, pathname, aggData, internalErrors);
if (internalErrors.length > 0) {
showErrors(pathname, internalErrors);
}
});
}
function showErrors(filename, errorMessages) {
console.log(filename);
errorMessages.forEach(function (message) {
console.log(' ' + message);
});
console.log('');
}
function updateFile(tree, pathname, aggData, errorMessages) {
var className = (0, 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);
updatePropDocsFromMD(compData, inputMD, outputMD, errorMessages);
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 template = ejs.compile(templateSource);
var mdText = template(compData);
mdText = mdText.replace(/^ +\|/gm, '|');
var newSection_1 = remark().parse(mdText.trim()).children;
replaceSection(tree, 'Class members', function (before, section, after) {
newSection_1.unshift(before);
newSection_1.push(after);
return newSection_1;
});
compData.errors.forEach(function (err) {
errorMessages.push(err);
});
}
return true;
}
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';
});
var propsTable = classMemHeading
.heading(function (h) {
return h.children[0].type === 'text' && h.children[0].value === sectionHeading;
})
.table();
var propTableRow = propsTable.childNav.tableRow(function () {
return true;
}, 1).childNav;
var i = 1;
while (!propTableRow.empty) {
var propName = propTableRow.tableCell().childNav.text().item.value;
var propDocText = propTableRow
.tableCell(function () {
return true;
}, docsColumn)
.childNav.text().item;
if (propDocText) {
result[propName] = propDocText.value;
}
i++;
propTableRow = propsTable.childNav.tableRow(function () {
return true;
}, i).childNav;
}
return result;
}
function getMethodDocsFromMD(tree) {
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';
});
var methListItems = classMemHeading
.heading(function (h) {
return h.children[0].type === 'text' && h.children[0].value === 'Methods';
})
.list().childNav;
var methItem = methListItems.listItem();
var i = 0;
while (!methItem.empty) {
var methNameSection = methItem.childNav.paragraph().childNav.strong().childNav;
var methName = '';
// Method docs must be in "new" format with names and types styled separately.
if (!methNameSection.empty) {
methName = methNameSection.text().item.value;
var methDoc = methItem.childNav.paragraph().childNav.html().text().value;
var params = getMDMethodParams(methItem);
result[methName] = {
docText: methDoc.replace(/^\n/, ''),
params: params
};
}
i++;
methItem = methListItems.listItem(function (l) {
return true;
}, i);
}
return result;
}
function getMDMethodParams(methItem) {
var result = {};
var paramList = methItem.childNav.list().childNav;
var paramListItems = paramList.listItems();
paramListItems.forEach(function (paramListItem) {
var paramNameNode = paramListItem.childNav.paragraph().childNav.emph().childNav;
var paramName;
if (!paramNameNode.empty) {
paramName = paramNameNode.text().item.value.replace(/:/, '');
} else {
var item = paramListItem.childNav.paragraph().childNav.strong().childNav.text();
if (paramName) {
paramName = item.value;
}
}
var paramDoc = paramListItem.childNav.paragraph().childNav.text(function (t) {
return true;
}, 1).value; // item.value;
result[paramName] = paramDoc.replace(/^[ -]+/, '');
});
return result;
}
function updatePropDocsFromMD(comp, inputDocs, outputDocs, errorMessages) {
comp.properties.forEach(function (prop) {
var propMDDoc;
if (prop.isInput) {
propMDDoc = inputDocs[prop.name];
} else if (prop.isOutput) {
propMDDoc = outputDocs[prop.name];
}
// If JSDocs are empty but MD docs aren't then the Markdown is presumably more up-to-date.
if (!prop.docText && propMDDoc) {
prop.docText = propMDDoc;
errorMessages.push('Warning: empty JSDocs for property "'.concat(prop.name, '" may need sync with the .md file.'));
}
});
}
function updateMethodDocsFromMD(comp, methodDocs, errorMessages) {
comp.methods.forEach(function (meth) {
var 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) {
meth.docText = currMethMD.docText;
errorMessages.push('Warning: empty JSDocs for method sig "'.concat(meth.name, '" may need sync with the .md file.'));
}
meth.params.forEach(function (param) {
if (!param.docText && currMethMD && currMethMD.params[param.name]) {
param.docText = currMethMD.params[param.name];
errorMessages.push(
'Warning: empty JSDocs for parameter "'.concat(param.name, ' (').concat(meth.name, ')" may need sync with the .md file.')
);
}
});
});
}

View File

@@ -1,245 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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';
const templateFolder = path.resolve('tools', 'doc', 'templates');
let nameExceptions;
export function processDocs(mdCache, aggData) {
nameExceptions = aggData.config.typeNameExceptions;
const pathNames = Object.keys(mdCache);
let internalErrors;
pathNames.forEach((pathname) => {
internalErrors = [];
updateFile(mdCache[pathname].mdOutTree, pathname, aggData, internalErrors);
if (internalErrors.length > 0) {
showErrors(pathname, internalErrors);
}
});
}
function showErrors(filename, errorMessages) {
console.log(filename);
errorMessages.forEach((message) => {
console.log(' ' + message);
});
console.log('');
}
function updateFile(tree, pathname, aggData, errorMessages) {
const className = ngNameToClassName(path.basename(pathname, '.md'), nameExceptions);
const classTypeMatch = className.match(/component|directive|service/i);
const compData = aggData.classInfo[className];
if (classTypeMatch && compData) {
const classType = classTypeMatch[0].toLowerCase();
// Copy docs back from the .md file when the JSDocs are empty.
const inputMD = getPropDocsFromMD(tree, 'Properties', 3);
const outputMD = getPropDocsFromMD(tree, 'Events', 2);
updatePropDocsFromMD(compData, inputMD, outputMD, errorMessages);
if (classType === 'service') {
const methodMD = getMethodDocsFromMD(tree);
updateMethodDocsFromMD(compData, methodMD, errorMessages);
}
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(/^ +\|/gm, '|');
const newSection = remark().parse(mdText.trim()).children;
replaceSection(tree, 'Class members', (before, section, after) => {
newSection.unshift(before);
newSection.push(after);
return newSection;
});
compData.errors.forEach((err) => {
errorMessages.push(err);
});
}
return true;
}
function getPropDocsFromMD(tree, sectionHeading, docsColumn) {
const result = {};
const nav = new MDNav(tree);
const classMemHeading = nav.heading((h) => {
return h.children[0].type === 'text' && h.children[0].value === 'Class members';
});
const propsTable = classMemHeading
.heading((h) => {
return h.children[0].type === 'text' && h.children[0].value === sectionHeading;
})
.table();
let propTableRow = propsTable.childNav.tableRow(() => true, 1).childNav;
let i = 1;
while (!propTableRow.empty) {
const propName = propTableRow.tableCell().childNav.text().item.value;
const propDocText = propTableRow.tableCell(() => true, docsColumn).childNav.text().item;
if (propDocText) {
result[propName] = propDocText.value;
}
i++;
propTableRow = propsTable.childNav.tableRow(() => true, i).childNav;
}
return result;
}
function getMethodDocsFromMD(tree) {
const result = {};
const nav = new MDNav(tree);
const classMemHeading = nav.heading((h) => {
return h.children[0].type === 'text' && h.children[0].value === 'Class members';
});
const methListItems = classMemHeading
.heading((h) => {
return h.children[0].type === 'text' && h.children[0].value === 'Methods';
})
.list().childNav;
let methItem = methListItems.listItem();
let i = 0;
while (!methItem.empty) {
const methNameSection = methItem.childNav.paragraph().childNav.strong().childNav;
let methName = '';
// Method docs must be in "new" format with names and types styled separately.
if (!methNameSection.empty) {
methName = methNameSection.text().item.value;
const methDoc = methItem.childNav.paragraph().childNav.html().text().value;
const params = getMDMethodParams(methItem);
result[methName] = {
docText: methDoc.replace(/^\n/, ''),
params: params
};
}
i++;
methItem = methListItems.listItem((l) => true, i);
}
return result;
}
function getMDMethodParams(methItem: MDNav) {
const result = {};
const paramList = methItem.childNav.list().childNav;
const paramListItems = paramList.listItems();
paramListItems.forEach((paramListItem) => {
const paramNameNode = paramListItem.childNav.paragraph().childNav.emph().childNav;
let paramName;
if (!paramNameNode.empty) {
paramName = paramNameNode.text().item.value.replace(/:/, '');
} else {
let item = paramListItem.childNav.paragraph().childNav.strong().childNav.text();
if (paramName) {
paramName = item.value;
}
}
const paramDoc = paramListItem.childNav.paragraph().childNav.text((t) => true, 1).value; // item.value;
result[paramName] = paramDoc.replace(/^[ -]+/, '');
});
return result;
}
function updatePropDocsFromMD(comp: ComponentInfo, inputDocs, outputDocs, errorMessages) {
comp.properties.forEach((prop) => {
let propMDDoc: string;
if (prop.isInput) {
propMDDoc = inputDocs[prop.name];
} else if (prop.isOutput) {
propMDDoc = outputDocs[prop.name];
}
// If JSDocs are empty but MD docs aren't then the Markdown is presumably more up-to-date.
if (!prop.docText && propMDDoc) {
prop.docText = propMDDoc;
errorMessages.push(`Warning: empty JSDocs for property "${prop.name}" may need sync with the .md file.`);
}
});
}
function updateMethodDocsFromMD(comp: ComponentInfo, methodDocs, errorMessages) {
comp.methods.forEach((meth) => {
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) {
meth.docText = currMethMD.docText;
errorMessages.push(`Warning: empty JSDocs for method sig "${meth.name}" may need sync with the .md file.`);
}
meth.params.forEach((param) => {
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

@@ -1,116 +0,0 @@
'use strict';
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, '__esModule', { value: true });
exports.processDocs = processDocs;
var fs = require('fs');
var path = require('path');
var replaceSection = require('mdast-util-heading-range');
var remark = require('remark');
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() {
aggPhase();
}
function aggPhase() {
var indexDocData = getIndexDocData();
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(/^ +\|/gm, '|');
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)
);
}
function getIndexDocData() {
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'];
}
});
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 metadata = getDocMetadata(tutMD);
if (metadata['Level']) {
tutData['level'] = metadata['Level'];
} else {
tutData['level'] = '';
}
var briefDesc = getFirstParagraph(tutMD);
tutData['briefDesc'] = remark()
.use(frontMatter, { type: 'yaml', fence: '---' })
.data('settings', { paddedTable: false, gfm: false })
.stringify(briefDesc);
var title = getFirstHeading(tutMD);
tutData['title'] = remark()
.use(frontMatter, { type: 'yaml', fence: '---' })
.data('settings', { paddedTable: false, gfm: false })
.stringify(title.children[0]);
result.tuts.push(tutData);
});
return result;
}
function getDocMetadata(tree) {
if (tree.children[0].type === 'yaml') {
return yaml.load(tree.children[0].value);
} else {
return {};
}
}
function getFirstParagraph(tree) {
var s = 0;
for (; s < tree.children.length && !unist.isParagraph(tree.children[s]); s++) {}
if (s < tree.children.length) {
return tree.children[s];
} else {
return null;
}
}
function getFirstHeading(tree) {
var s = 0;
for (; s < tree.children.length && !unist.isHeading(tree.children[s]); s++) {}
if (s < tree.children.length) {
return tree.children[s];
} else {
return null;
}
}

View File

@@ -1,142 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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() {
const indexDocData = getIndexDocData();
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(/^ +\|/gm, '|');
const newSection = remark().use(frontMatter, ['yaml']).data('settings', { paddedTable: false, gfm: false }).parse(mdText.trim()).children;
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) => {
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)
);
}
function getIndexDocData() {
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'];
}
});
const result = {
tuts: []
};
indexArray.forEach((element) => {
const tutData = { link: element['file'] };
const tutFile = path.resolve(tutFolder, element['file']);
const tutFileText = fs.readFileSync(tutFile, 'utf8');
const tutMD = remark().use(frontMatter, ['yaml']).parse(tutFileText);
const metadata = getDocMetadata(tutMD);
if (metadata['Level']) {
tutData['level'] = metadata['Level'];
} else {
tutData['level'] = '';
}
const briefDesc = getFirstParagraph(tutMD);
tutData['briefDesc'] = remark()
.use(frontMatter, { type: 'yaml', fence: '---' })
.data('settings', { paddedTable: false, gfm: false })
.stringify(briefDesc);
const title = getFirstHeading(tutMD);
tutData['title'] = remark()
.use(frontMatter, { type: 'yaml', fence: '---' })
.data('settings', { paddedTable: false, gfm: false })
.stringify(title.children[0]);
result.tuts.push(tutData);
});
return result;
}
function getDocMetadata(tree) {
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++) {}
if (s < tree.children.length) {
return tree.children[s];
} else {
return null;
}
}
function getFirstHeading(tree) {
let s = 0;
for (; s < tree.children.length && !unist.isHeading(tree.children[s]); s++) {}
if (s < tree.children.length) {
return tree.children[s];
} else {
return null;
}
}

View File

@@ -1,356 +0,0 @@
'use strict';
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var __spreadArray =
(this && this.__spreadArray) ||
function (to, from, pack) {
if (pack || arguments.length === 2)
for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, '__esModule', { value: true });
exports.processDocs = processDocs;
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'
];
var externalNameLinks;
var linkOverrides;
var ignoreLinkWords;
function processDocs(mdCache, aggData) {
initPhase(aggData, mdCache);
var pathnames = Object.keys(mdCache);
pathnames.forEach(function (pathname) {
updateFile(mdCache[pathname].mdOutTree, pathname, aggData);
});
}
function initPhase(aggData, mdCache) {
externalNameLinks = aggData.config.externalNameLinks;
ignoreLinkWords = aggData.config.ignoreLinkWords;
linkOverrides = {};
aggData.config.linkOverrides.forEach(function (override) {
linkOverrides[override.toLowerCase()] = 1;
});
aggData.docFiles = {};
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');
aggData.docFiles[compName] = relPath;
});
var classNames = Object.keys(aggData.classInfo);
classNames.forEach(function (currClassName) {
if (currClassName.match(/(Component|Directive|Interface|Model|Pipe|Service|Widget)$/)) {
aggData.nameLookup.addName(currClassName);
}
});
}
function updateFile(tree, pathname, aggData) {
traverseMDTree(tree);
return true;
function traverseMDTree(node) {
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 (!ignoreLinkWords.includes(node.children[0].value)) {
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') {
node.children.forEach(function (child, index) {
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, __spreadArray([index, 1], newNodes, false));
} else {
traverseMDTree(child);
}
});
}
}
}
var SplitNameNode = /** @class */ (function () {
function SplitNameNode(key, value) {
if (key === void 0) {
key = '';
}
if (value === void 0) {
value = '';
}
this.key = key;
this.value = value;
this.children = {};
}
SplitNameNode.prototype.addChild = function (child) {
this.children[child.key] = child;
};
return SplitNameNode;
})();
var SplitNameMatchElement = /** @class */ (function () {
function SplitNameMatchElement(node, textPos) {
this.node = node;
this.textPos = textPos;
}
return SplitNameMatchElement;
})();
var SplitNameMatchResult = /** @class */ (function () {
function SplitNameMatchResult(value, startPos) {
this.value = value;
this.startPos = startPos;
}
return SplitNameMatchResult;
})();
var SplitNameMatcher = /** @class */ (function () {
function SplitNameMatcher(root) {
this.root = root;
this.reset();
}
/* Returns all names that match when this word is added. */
SplitNameMatcher.prototype.nextWord = function (word, textPos) {
var result = [];
this.matches.push(new SplitNameMatchElement(this.root, textPos));
for (var i = this.matches.length - 1; i >= 0; i--) {
if (this.matches[i].node.children) {
var child = this.matches[i].node.children[word];
if (child) {
if (child.value) {
/* Using unshift to add the match to the array means that
* the longest matches will appear first in the array.
* User can then just use the first array element if only
* the longest match is needed.
*/
result.unshift(new SplitNameMatchResult(child.value, this.matches[i].textPos));
this.matches.splice(i, 1);
} else {
this.matches[i] = new SplitNameMatchElement(child, this.matches[i].textPos);
}
} else {
this.matches.splice(i, 1);
}
} else {
this.matches.splice(i, 1);
}
}
if (result === []) {
return null;
} else {
return result;
}
};
SplitNameMatcher.prototype.reset = function () {
this.matches = [];
};
return SplitNameMatcher;
})();
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 currNode = this.root;
segments.forEach(function (segment, index) {
var value = '';
if (index === segments.length - 1) {
value = name;
}
var childNode = currNode.children[segment];
if (!childNode) {
childNode = new SplitNameNode(segment, value);
currNode.addChild(childNode);
}
currNode = childNode;
});
};
return SplitNameLookup;
})();
var WordScanner = /** @class */ (function () {
function WordScanner(text) {
this.text = text;
this.separators = ' \n\r\t.;:<>[]&|';
this.index = 0;
this.nextSeparator = 0;
this.next();
}
WordScanner.prototype.finished = function () {
return this.index >= this.text.length;
};
WordScanner.prototype.next = function () {
this.advanceIndex();
this.advanceNextSeparator();
this.current = this.text.substring(this.index, this.nextSeparator);
};
WordScanner.prototype.advanceNextSeparator = function () {
for (var i = this.index; i < this.text.length; i++) {
if (this.separators.indexOf(this.text[i]) !== -1) {
this.nextSeparator = i;
return;
}
}
this.nextSeparator = this.text.length;
};
WordScanner.prototype.advanceIndex = function () {
for (var i = this.nextSeparator; i < this.text.length; i++) {
if (this.separators.indexOf(this.text[i]) === -1) {
this.index = i;
return;
}
}
this.index = this.text.length;
};
return WordScanner;
})();
function handleLinksInBodyText(aggData, docFilePath, text, wrapInlineCode) {
if (wrapInlineCode === void 0) {
wrapInlineCode = false;
}
var result = [];
var currTextStart = 0;
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, '');
if (!ignoreLinkWords.includes(word)) {
var link = resolveTypeLink(aggData, docFilePath, word);
var matchStart = void 0;
if (!link) {
var 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;
}
if (link) {
var linkText = text.substring(matchStart, scanner.nextSeparator);
var linkTitle = void 0;
if (wrapInlineCode) {
linkTitle = unist.makeInlineCode(linkText);
} else {
linkTitle = unist.makeText(linkText);
}
var linkNode = unist.makeLink(linkTitle, link);
var prevText = text.substring(currTextStart, matchStart);
if (prevText) {
if (wrapInlineCode) {
result.push(unist.makeInlineCode(prevText));
} else {
result.push(unist.makeText(prevText));
}
}
result.push(linkNode);
currTextStart = scanner.nextSeparator;
matcher.reset();
}
}
}
var remainingText = text.substring(currTextStart, text.length);
if (remainingText) {
if (wrapInlineCode) {
result.push(unist.makeInlineCode(remainingText));
} else {
result.push(unist.makeText(remainingText));
}
}
return result;
}
function resolveTypeLink(aggData, docFilePath, text) {
var possTypeName = cleanTypeName(text);
if (possTypeName === 'constructor') {
return '';
}
var classInfo = aggData.classInfo[possTypeName];
if (linkOverrides[possTypeName.toLowerCase()]) {
return '';
} else if (externalNameLinks[possTypeName]) {
return externalNameLinks[possTypeName];
} else if (classInfo) {
var kebabName = ngHelpers.kebabifyClassName(possTypeName);
var possDocFile = aggData.docFiles[kebabName];
var url = fixRelSrcUrl(docFilePath, classInfo.sourcePath);
if (possDocFile) {
url = fixRelDocUrl(docFilePath, possDocFile);
}
return url;
} else {
return '';
}
}
function fixRelSrcUrl(docPath, srcPath) {
var relDocPath = docPath.substring(docPath.indexOf('docs'));
var docPathSegments = relDocPath.split(/[\\\/]/);
var dotPathPart = '';
for (var i = 0; i < docPathSegments.length - 1; i++) {
dotPathPart += '../';
}
return dotPathPart + srcPath;
}
function fixRelDocUrl(docPathFrom, docPathTo) {
var relDocPathFrom = docPathFrom.substring(docPathFrom.indexOf('docs'));
var docPathSegments = relDocPathFrom.split(/[\\\/]/);
var dotPathPart = '';
for (var i = 0; i < docPathSegments.length - 2; i++) {
dotPathPart += '../';
}
return dotPathPart + docPathTo;
}
function cleanTypeName(text) {
var matches = text.match(/[a-zA-Z0-9_]+<([a-zA-Z0-9_]+)(\[\])?>/);
if (matches) {
return matches[1];
} else {
return text.replace(/\[\]$/, '');
}
}
function convertNodeToTypeLink(node, text, url, title) {
if (title === void 0) {
title = null;
}
var linkDisplayText = unist.makeInlineCode(text);
node.type = 'link';
node.title = title;
node.url = url;
node.children = [linkDisplayText];
}

View File

@@ -1,397 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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'
];
let externalNameLinks;
let linkOverrides;
let ignoreLinkWords: any[];
export function processDocs(mdCache, aggData) {
initPhase(aggData, mdCache);
const pathnames = Object.keys(mdCache);
pathnames.forEach(pathname => {
updateFile(mdCache[pathname].mdOutTree, pathname, aggData);
});
}
function initPhase(aggData, mdCache) {
externalNameLinks = aggData.config.externalNameLinks;
ignoreLinkWords = aggData.config.ignoreLinkWords;
linkOverrides = {};
aggData.config.linkOverrides.forEach(override => {
linkOverrides[override.toLowerCase()] = 1;
});
aggData.docFiles = {};
aggData.nameLookup = new SplitNameLookup();
const docFilePaths = Object.keys(mdCache);
docFilePaths.forEach(docFilePath => {
const relPath = docFilePath.substring(docFilePath.indexOf('docs') + 5).replace(/\\/g, '/');
const compName = path.basename(relPath, '.md');
aggData.docFiles[compName] = relPath;
});
const classNames = Object.keys(aggData.classInfo);
classNames.forEach(currClassName => {
if (currClassName.match(/(Component|Directive|Interface|Model|Pipe|Service|Widget)$/)) {
aggData.nameLookup.addName(currClassName);
}
});
}
function updateFile(tree, pathname, aggData) {
traverseMDTree(tree);
return true;
function traverseMDTree(node) {
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 (!ignoreLinkWords.includes(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')) {
node.children.forEach((child, index) => {
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);
}
});
}
}
}
class SplitNameNode {
children: {};
constructor(public key: string = '', public value: string = '') {
this.children = {};
}
addChild(child: SplitNameNode) {
this.children[child.key] = child;
}
}
class SplitNameMatchElement {
constructor(public node: SplitNameNode, public textPos: number) {
}
}
class SplitNameMatchResult {
constructor(public value: string, public startPos: number) {
}
}
class SplitNameMatcher {
matches: SplitNameMatchElement[];
constructor(public root: SplitNameNode) {
this.reset();
}
/* Returns all names that match when this word is added. */
nextWord(word: string, textPos: number): SplitNameMatchResult[] {
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) {
const child = this.matches[i].node.children[word];
if (child) {
if (child.value) {
/* Using unshift to add the match to the array means that
* the longest matches will appear first in the array.
* User can then just use the first array element if only
* the longest match is needed.
*/
result.unshift(new SplitNameMatchResult(child.value, this.matches[i].textPos));
this.matches.splice(i, 1);
} else {
this.matches[i] = new SplitNameMatchElement(child, this.matches[i].textPos);
}
} else {
this.matches.splice(i, 1);
}
} else {
this.matches.splice(i, 1);
}
}
if (result === []) {
return null;
} else {
return result;
}
}
reset() {
this.matches = [];
}
}
class SplitNameLookup {
root: SplitNameNode;
constructor() {
this.root = new SplitNameNode();
}
addName(name: string) {
const spacedName = name.replace(/([A-Z])/g, ' $1');
const segments = spacedName.trim().toLowerCase().split(' ');
let currNode = this.root;
segments.forEach((segment, index) => {
let value = '';
if (index === (segments.length - 1)) {
value = name;
}
let childNode = currNode.children[segment];
if (!childNode) {
childNode = new SplitNameNode(segment, value);
currNode.addChild(childNode);
}
currNode = childNode;
});
}
}
class WordScanner {
separators: string;
index: number;
nextSeparator: number;
current: string;
constructor(public text: string) {
this.separators = ' \n\r\t.;:<>[]&|';
this.index = 0;
this.nextSeparator = 0;
this.next();
}
finished() {
return this.index >= this.text.length;
}
next(): void {
this.advanceIndex();
this.advanceNextSeparator();
this.current = this.text.substring(this.index, this.nextSeparator);
}
advanceNextSeparator() {
for (let i = this.index; i < this.text.length; i++) {
if (this.separators.indexOf(this.text[i]) !== -1) {
this.nextSeparator = i;
return;
}
}
this.nextSeparator = this.text.length;
}
advanceIndex() {
for (let i = this.nextSeparator; i < this.text.length; i++) {
if (this.separators.indexOf(this.text[i]) === -1) {
this.index = i;
return;
}
}
this.index = this.text.length;
}
}
function handleLinksInBodyText(aggData, docFilePath: string, text: string, wrapInlineCode: boolean = false): Node[] {
const result = [];
let currTextStart = 0;
const matcher = new SplitNameMatcher(aggData.nameLookup.root);
for (const scanner = new WordScanner(text); !scanner.finished(); scanner.next()) {
const word = scanner.current
.replace(/'s$/, '')
.replace(/^[;:,\."']+/g, '')
.replace(/[;:,\."']+$/g, '');
if (!ignoreLinkWords.includes(word)) {
let link = resolveTypeLink(aggData, docFilePath, word);
let matchStart;
if (!link) {
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;
}
if (link) {
const linkText = text.substring(matchStart, scanner.nextSeparator);
let linkTitle;
if (wrapInlineCode) {
linkTitle = unist.makeInlineCode(linkText);
} else {
linkTitle = unist.makeText(linkText);
}
const linkNode = unist.makeLink(linkTitle, link);
const prevText = text.substring(currTextStart, matchStart);
if (prevText) {
if (wrapInlineCode) {
result.push(unist.makeInlineCode(prevText));
} else {
result.push(unist.makeText(prevText));
}
}
result.push(linkNode);
currTextStart = scanner.nextSeparator;
matcher.reset();
}
}
}
const remainingText = text.substring(currTextStart, text.length);
if (remainingText) {
if (wrapInlineCode) {
result.push(unist.makeInlineCode(remainingText));
} else {
result.push(unist.makeText(remainingText));
}
}
return result;
}
function resolveTypeLink(aggData, docFilePath, text): string {
const possTypeName = cleanTypeName(text);
if (possTypeName === 'constructor') {
return '';
}
const classInfo = aggData.classInfo[possTypeName];
if (linkOverrides[possTypeName.toLowerCase()]) {
return '';
} else if (externalNameLinks[possTypeName]) {
return externalNameLinks[possTypeName];
} else if (classInfo) {
const kebabName = ngHelpers.kebabifyClassName(possTypeName);
const possDocFile = aggData.docFiles[kebabName];
let url = fixRelSrcUrl(docFilePath, classInfo.sourcePath);
if (possDocFile) {
url = fixRelDocUrl(docFilePath, possDocFile);
}
return url;
} else {
return '';
}
}
function fixRelSrcUrl(docPath: string, srcPath: string) {
const relDocPath = docPath.substring(docPath.indexOf('docs'));
const docPathSegments = relDocPath.split(/[\\\/]/);
let dotPathPart = '';
for (let i = 0; i < (docPathSegments.length - 1); i++) {
dotPathPart += '../';
}
return dotPathPart + srcPath;
}
function fixRelDocUrl(docPathFrom: string, docPathTo: string) {
const relDocPathFrom = docPathFrom.substring(docPathFrom.indexOf('docs'));
const docPathSegments = relDocPathFrom.split(/[\\\/]/);
let dotPathPart = '';
for (let i = 0; i < (docPathSegments.length - 2); i++) {
dotPathPart += '../';
}
return dotPathPart + docPathTo;
}
function cleanTypeName(text) {
const matches = text.match(/[a-zA-Z0-9_]+<([a-zA-Z0-9_]+)(\[\])?>/);
if (matches) {
return matches[1];
} else {
return text.replace(/\[\]$/, '');
}
}
function convertNodeToTypeLink(node, text, url, title = null) {
const linkDisplayText = unist.makeInlineCode(text);
node.type = 'link';
node.title = title;
node.url = url;
node.children = [linkDisplayText];
}

View File

@@ -1,132 +0,0 @@
const fs = require('fs');
const path = require('path');
const yaml = require('js-yaml');
const remark = require('remark');
const zone = require('mdast-zone');
const frontMatter = require('remark-frontmatter');
const ejs = require('ejs');
const ngHelpers = require('../ngHelpers');
module.exports = {
processDocs: processDocs
};
const docsFolderPath = path.resolve('docs');
const histFilePath = path.resolve(docsFolderPath, 'versionIndex.md');
const initialVersion = 'v2.0.0';
const templateFolder = path.resolve('tools', 'doc', 'templates');
function processDocs(mdCache, aggData) {
initPhase(aggData);
readPhase(mdCache, aggData);
aggPhase(aggData);
}
function initPhase(aggData) {
aggData.versions = { 'v2.0.0': [] };
}
function readPhase(mdCache, aggData) {
const pathNames = Object.keys(mdCache);
pathNames.forEach((pathname) => {
getFileData(mdCache[pathname].mdInTree, pathname, aggData);
});
}
function getFileData(tree, pathname, aggData) {
const compName = pathname;
const angNameRegex = /([a-zA-Z0-9\-]+)\.((component)|(directive)|(model)|(pipe)|(service)|(widget)|(dialog))/;
if (!compName.match(angNameRegex)) return;
if (compName.match(/boilerplate/)) return;
if (tree && tree.children[0] && tree.children[0].type === 'yaml') {
const metadata = yaml.load(tree.children[0].value);
const version = metadata['Added'];
if (version) {
if (aggData.versions[version]) {
aggData.versions[version].push(compName);
} else {
aggData.versions[version] = [compName];
}
} else {
aggData.versions[initialVersion].push(compName);
}
} else {
aggData.versions[initialVersion].push(compName);
}
}
function aggPhase(aggData) {
const histFileText = fs.readFileSync(histFilePath, 'utf8');
const histFileTree = remark()
.use(frontMatter, ['yaml'])
.data('settings', {
paddedTable: false,
gfm: false
})
.parse(histFileText);
const keys = Object.keys(aggData.versions);
keys.sort((a, b) => {
if (a > b) return -1;
else if (b > a) return 1;
else return 0;
});
const templateName = path.resolve(templateFolder, 'versIndex.ejs');
const templateSource = fs.readFileSync(templateName, 'utf8');
const template = ejs.compile(templateSource);
for (let i = 0; i < keys.length; i++) {
const version = keys[i];
const versionItems = aggData.versions[version];
versionItems.sort((a, b) => {
const aa = path.basename(a, '.md');
const bb = path.basename(b, '.md');
return aa.localeCompare(bb);
});
const versionTemplateData = { items: [] };
for (let v = 0; v < versionItems.length; v++) {
const displayName = ngHelpers.ngNameToDisplayName(path.basename(versionItems[v], '.md'));
let pageLink = versionItems[v]; // + ".md";
pageLink = pageLink.replace(/\\/g, '/');
pageLink = pageLink.substr(pageLink.indexOf('docs') + 5);
versionTemplateData.items.push({
title: displayName,
link: pageLink
});
}
let mdText = template(versionTemplateData);
mdText = mdText.replace(/^ +-/gm, '-');
const newSection = remark()
.use(frontMatter, ['yaml'])
.data('settings', {
paddedTable: false,
gfm: false
})
.parse(mdText.trim()).children;
const versSectionName = version.replace(/\./g, '');
zone(histFileTree, versSectionName, (startComment, oldSection, endComment) => {
newSection.unshift(startComment);
newSection.push(endComment);
return newSection;
});
}
fs.writeFileSync(
histFilePath,
remark().use(frontMatter, { type: 'yaml', fence: '---' }).data('settings', { paddedTable: false, gfm: false }).stringify(histFileTree)
);
}

View File

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

View File

@@ -1,88 +0,0 @@
module.exports = {
makeText: function (textVal) {
return {
type: 'text',
value: textVal
};
},
makeEmphasis: function (content) {
return {
type: 'emphasis',
children: content
};
},
makeHeading: function (caption, depth) {
return {
type: 'heading',
depth: depth,
children: [caption]
};
},
makeLink: function (caption, url, title = null) {
return {
type: 'link',
title: title,
url: url,
children: [caption]
};
},
makeListItem: function (itemValue) {
return {
type: 'listItem',
loose: false,
children: [itemValue]
};
},
makeListUnordered: function (itemsArray) {
return {
type: 'list',
ordered: false,
children: itemsArray,
loose: false
};
},
makeTable: function (colAlignArray, rowArray) {
return {
type: 'table',
align: colAlignArray,
children: rowArray
};
},
makeTableRow: function (cellArray) {
return {
type: 'tableRow',
children: cellArray
};
},
makeTableCell: function (content) {
return {
type: 'tableCell',
children: content
};
},
makeInlineCode: function (codeText) {
return {
"type": "inlineCode",
"value": codeText
}
},
makeImage: function (url, alt) {
return {
type: 'image',
url: url,
alt: alt
};
},
isHeading: function (node) {
return node.type === 'heading';
},
isListUnordered: function (node) {
return node.type === 'list' && !node.ordered;
},
isParagraph: function (node) {
return node.type === 'paragraph';
},
isLink: function (node) {
return node.type === 'inlineCode';
}
};

View File

@@ -1,35 +0,0 @@
summary: >-
<%- ((typeof sig.comment !== "undefined") && (typeof sig.comment.shortText !== "undefined")) ? (sig.comment.shortText || "").replace(/[\n\r]+/g, " ").trim() : "" %>
tags:
<% if ((typeof sig.comment !== "undefined") && (typeof sig.comment.tags !== "undefined")) { -%>
<% sig.comment.tags.forEach(tag => { -%>
- name: <%= tag.tag %>
text: >-
<%= (tag.text || "").replace(/[\n\r]+/g, " ").trim() %>
<% }) -%>
<% } -%>
syntax:
parameters:
<% if ((typeof sig.parameters !== "undefined") && (sig.parameters.length > 0)) { -%>
<% sig.parameters.forEach((param) => { -%>
- id: <%= param.name %>
type: >-
<%- include("type", {type: param.type}).trim() %>
description: >-
<%- param.comment ? (param.comment.text || "").replace(/[\n\r]+/g, " ").trim() : "" %>
defaultValue: >-
<%- (typeof param.defaultValue !== "undefined") ? param.defaultValue : "" %>
flags:
<%_ if (typeof param.flags !== "undefined") { -%>
<%_ Object.keys(param.flags).forEach(flagName => { -%>
- name: <%= flagName %>
value: <%- param.flags[flagName] %>
<% }) -%>
<% } -%>
<% }) -%>
<% } -%>
return:
type: >-
<%- include("type", {type: sig.type}).trim() %>
summary: >-
<%- ((typeof sig.comment !== "undefined") && (typeof sig.comment.returns !== "undefined")) ? (sig.comment.returns || "").replace(/[\n\r]+/g, " ").trim() : "" %>

View File

@@ -1,6 +0,0 @@
syntax:
return:
type: >-
<%- child['type'] ? include("type", {type: child.type}).trim() : '' %>
defaultValue: >-
<%- (child.defaultValue || "").length < 20 ? child.defaultValue : "" %>

View File

@@ -1,23 +0,0 @@
summary: >-
<%- (typeof child.comment !== "undefined") ? (child.comment.shortText || "").replace(/[\n\r]+/g, " ").trim() : "" %>
tags:
<%_ if ((typeof child.comment !== "undefined") && (typeof child.comment.tags !== "undefined")) { -%>
<% child.comment.tags.forEach(tag => { -%>
- name: <%= tag.tag %>
text: >-
<%- (tag.text || "").replace(/[\n\r]+/g, " ").trim() %>
<%_ }) -%>
<% } -%>
decorators:
<%_ if (typeof child.decorators !== "undefined") { -%>
<% child.decorators.forEach(dec => { -%>
- name: <%= dec.name %>
arguments:
<%_if (typeof dec.arguments !== "undefined") { -%>
<% Object.keys(dec.arguments).forEach(argName => { -%>
- id: <%= argName %>
value: <%- dec.arguments[argName] %>
<% }) %>
<% } -%>
<%_ }) -%>
<% } -%>

View File

@@ -1,48 +0,0 @@
items:
- uid: <%= name %>
name: <%= name %>
fullName: <%= name %>
source:
path: <%= sources[0].fileName %>
startLine: <%= sources[0].line %>
children:
<%_ if (typeof children !== "undefined") { -%>
<%_ children.forEach((child) => { -%>
- <%= name %>.<%= child.name %>
<% }) -%>
<% } -%>
langs: typeScript
type: <%= kindString.toLowerCase() %>
<%_ if (typeof children !== "undefined") { -%>
<%_ children.forEach((child) => { -%>
<%_ if ((child.kindString === "Constructor") || (child.kindString === "Method")) { -%>
<%_ child.signatures.forEach((sig) => { -%>
- uid: <%= name %>.<%= child.name %>
name: <%= child.name %>
type: <%= child.kindString.toLowerCase() %>
flags:
<%_ if (typeof child.flags !== "undefined") { -%>
<%_ Object.keys(child.flags).forEach(flagName => { -%>
- name: <%= flagName %>
value: <%= child.flags[flagName] %>
<% }) -%>
<% } -%>
<%- include("methodSig", {sig: sig}); -%>
<% }); %>
<% } else if ((child.kindString === "Property") || (child.kindString === "Accessor")) { -%>
- uid: <%= name %>.<%= child.name %>
name: <%= child.name %>
type: <%= child.kindString.toLowerCase() %>
<%- include("property", {child: child}); -%>
<% if (child.kindString === "Accessor") { -%>
<% if (typeof child.getSignature !== "undefined") { -%>
<%- include("propSyntaxSection", {child: child.getSignature[0]}); -%>
<% } else if (typeof child.setSignature !== "undefined") { -%>
<%- include("propSyntaxSection", {child: child.setSignature[0]}); -%>
<% } -%>
<% } else { -%>
<%- include("propSyntaxSection", {child: child}); -%>
<% } -%>
<% } -%>
<% }) -%>
<% } -%>

View File

@@ -1,20 +0,0 @@
<%_ if ((type.type === "intrinsic") || (type.type === "reference")) { _%>
<%= type.name _%>
<%_ if (typeof type.typeArguments !== "undefined") { _%>
<<%_ type.typeArguments.forEach((arg, index) => { _%>
<%= index === 0 ? "" : ", " _%>
<%- include("type", {type: arg}).trim() _%>
<%_ }) _%>>
<%_ } _%>
<%_ } else if (type.type === "stringLiteral") { _%>
"<%= type.value _%>"
<%_ } else if (type.type === "reflection") { _%>
Function
<%_ } else if (type.type === "array") { _%>
<%- include("type", {type: type.elementType}).trim() _%>[]
<%_ } else if (type.type === "union") { _%>
<%_ type.types.forEach((unionItem, index) => { _%>
<%= index === 0 ? "" : " | " _%>
<%- include("type", {type: unionItem}).trim() _%>
<%_ }) _%>
<%_ } _%>

View File

@@ -37,7 +37,7 @@
"@alfresco/js-api": ["lib/js-api/src/index.ts"]
}
},
"exclude": ["lib/config", "integration", "scripts", "assets", "tools", "node_modules"],
"exclude": ["lib/config", "integration", "scripts", "assets", "node_modules"],
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,