feat(docs): typedoc api reference (#9378)

This commit is contained in:
Janos Hrubos
2021-05-06 16:49:07 +02:00
committed by GitHub
parent 342108c1af
commit 6d91c2a019
4 changed files with 374 additions and 398 deletions

View File

@ -66,6 +66,7 @@
"ts-node": "9.1.1", "ts-node": "9.1.1",
"ts-patch": "^1.3.0", "ts-patch": "^1.3.0",
"tslint": "6.1.3", "tslint": "6.1.3",
"typedoc": "^0.20.14",
"typescript": "4.1.4", "typescript": "4.1.4",
"webpack": "~4.44.1", "webpack": "~4.44.1",
"webpack-cli": "~3.3.12" "webpack-cli": "~3.3.12"

View File

@ -32,7 +32,7 @@
* SUPPORTED TOKENS: <lookup> * SUPPORTED TOKENS: <lookup>
* DEFAULT VALUE: "<lookup>" * DEFAULT VALUE: "<lookup>"
*/ */
"projectFolder": "nativescript-core", "projectFolder": "../../packages/core",
/** /**
* (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor
@ -62,7 +62,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName> * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/tsconfig.json" * DEFAULT VALUE: "<projectFolder>/tsconfig.json"
*/ */
"tsconfigFilePath": "<projectFolder>/tsconfig.json", "tsconfigFilePath": "<projectFolder>/tsconfig.json"
/** /**
* Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk. * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk.
@ -122,7 +122,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName> * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/etc/" * DEFAULT VALUE: "<projectFolder>/etc/"
*/ */
"reportFolder": "api-reports/", "reportFolder": "api-reports/"
/** /**
* Specifies the folder where the temporary report file is written. The file name portion is determined by * Specifies the folder where the temporary report file is written. The file name portion is determined by
@ -147,7 +147,7 @@
/** /**
* (REQUIRED) Whether to generate a doc model file. * (REQUIRED) Whether to generate a doc model file.
*/ */
"enabled": true, "enabled": true
/** /**
* The output path for the doc model file. The file extension should be ".api.json". * The output path for the doc model file. The file extension should be ".api.json".
@ -182,7 +182,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName> * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/dist/<unscopedPackageName>.d.ts" * DEFAULT VALUE: "<projectFolder>/dist/<unscopedPackageName>.d.ts"
*/ */
"untrimmedFilePath": "<projectFolder>/nativescript-core.d.ts", "untrimmedFilePath": "<projectFolder>/nativescript-core.d.ts"
/** /**
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release. * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release.
@ -196,7 +196,6 @@
*/ */
// "betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-beta.d.ts", // "betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-beta.d.ts",
/** /**
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release. * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release.
* This file will include only declarations that are marked as "@public". * This file will include only declarations that are marked as "@public".
@ -231,7 +230,6 @@
* DEFAULT VALUE: true * DEFAULT VALUE: true
*/ */
// "enabled": true, // "enabled": true,
/** /**
* Specifies where the TSDoc metadata file should be written. * Specifies where the TSDoc metadata file should be written.
* *
@ -279,7 +277,7 @@
* *
* DEFAULT VALUE: "warning" * DEFAULT VALUE: "warning"
*/ */
"logLevel": "error", //"warning", "logLevel": "error" //"warning",
/** /**
* When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md), * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md),
@ -289,7 +287,7 @@
* DEFAULT VALUE: false * DEFAULT VALUE: false
*/ */
// "addToApiReportFile": false // "addToApiReportFile": false
}, }
// "TS2551": { // "TS2551": {
// "logLevel": "warning", // "logLevel": "warning",
@ -308,13 +306,13 @@
*/ */
"extractorMessageReporting": { "extractorMessageReporting": {
"default": { "default": {
"logLevel": "warning", "logLevel": "warning"
// "addToApiReportFile": false // "addToApiReportFile": false
}, },
"ae-missing-release-tag": { "ae-missing-release-tag": {
"logLevel": "none", "logLevel": "none",
"addToApiReportFile": false "addToApiReportFile": false
}, }
// "ae-extra-release-tag": { // "ae-extra-release-tag": {
// "logLevel": "warning", // "logLevel": "warning",
// "addToApiReportFile": true // "addToApiReportFile": true
@ -332,7 +330,7 @@
*/ */
"tsdocMessageReporting": { "tsdocMessageReporting": {
"default": { "default": {
"logLevel": "warning", "logLevel": "warning"
// "addToApiReportFile": false // "addToApiReportFile": false
}, },
"tsdoc-param-tag-missing-hyphen": { "tsdoc-param-tag-missing-hyphen": {
@ -354,7 +352,7 @@
"tsdoc-malformed-html-name": { "tsdoc-malformed-html-name": {
"logLevel": "none", "logLevel": "none",
"addToApiReportFile": false "addToApiReportFile": false
}, }
// "tsdoc-link-tag-unescaped-text": { // "tsdoc-link-tag-unescaped-text": {
// "logLevel": "warning", // "logLevel": "warning",
@ -364,5 +362,4 @@
// . . . // . . .
} }
} }
} }

View File

@ -3,7 +3,6 @@ set -e
ENV="${ENV:-dev}" ENV="${ENV:-dev}"
DIST_DIR="bin/dist" DIST_DIR="bin/dist"
TARGET_DIR="$DIST_DIR/snippets"
PACKAGE_VERSION="${PACKAGE_VERSION:-0.0.0}" PACKAGE_VERSION="${PACKAGE_VERSION:-0.0.0}"
archive_dist_dir() { archive_dist_dir() {
@ -13,44 +12,27 @@ archive_dist_dir() {
npm_install() { npm_install() {
# Don't install modules twice. # Don't install modules twice.
MARKER_FILE="./node_modules/installed" MARKER_FILE="./node_modules/installed"
if [ ! -f "$MARKER_FILE" ] ; then if [ ! -f "$MARKER_FILE" ] ; then
# Fixes perm issue while installing
npm i -g npm@^6.13.6
npm install npm install
npm install @types/handlebars@4.0.33 npm install @types/handlebars@4.0.33
touch "$MARKER_FILE" touch "$MARKER_FILE"
fi fi
} }
extract_snippets() {
BIN="./node_modules/markdown-snippet-injector/extract.js"
npm install markdown-snippet-injector
for SNIPPET_DIR in {tests/app,apps/app,nativescript-core} ; do
echo "Extracting snippets from: $SNIPPET_DIR"
node "$BIN" --root="$SNIPPET_DIR" --target="$TARGET_DIR" \
--sourceext=".js|.ts|.xml|.html|.css"
done
archive_dist_dir "snippets"
}
extract_apiref() { extract_apiref() {
APIREF_DIR="$DIST_DIR/api-reference" APIREF_DIR="$DIST_DIR/api-reference"
rm -rf "$APIREF_DIR" rm -rf "$APIREF_DIR"
npm_install # npm_install
npm run typedoc npx typedoc --tsconfig tools/scripts/tsconfig.typedoc.json
mv "$DIST_DIR/apiref" "$APIREF_DIR" mv "dist/apiref" "$APIREF_DIR"
archive_dist_dir "api-reference" archive_dist_dir "api-reference"
} }
rm -rf "$TARGET_DIR"
mkdir -p "$TARGET_DIR"
if [ "${BASH_SOURCE[0]}" == "$0" ] ; then if [ "${BASH_SOURCE[0]}" == "$0" ] ; then
extract_snippets
extract_apiref extract_apiref
fi fi

View File

@ -1,37 +1,33 @@
{ {
"extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"noEmitOnError": true, "outDir": "../../dist/packages/core",
"noEmitHelpers": true,
"target": "es5", "target": "es5",
"module": "commonjs", "module": "commonjs",
"declaration": false, "declaration": false,
"noImplicitAny": false, "lib": ["es6", "dom"]
"noImplicitUseStrict": true,
"experimentalDecorators": true,
"lib": [
"es6",
"dom"
]
}, },
"include": [ "include": ["../../packages/core/**/*.d.ts"],
"nativescript-core/**/*.d.ts"
],
"exclude": [ "exclude": [
"nativescript-core/index.d.ts", // "../../packages/core/index.d.ts",
"nativescript-core/ui/index.d.ts",
"nativescript-core/ui/layouts/index.d.ts",
"nativescript-core/references.d.ts", "../../packages/core/ui/layouts/index.d.ts",
"nativescript-core/node_modules",
"nativescript-core/ui/frame/transition-definitions.android.d.ts", // "../../packages/core/__tests__",
"nativescript-core/platforms/*"
"../../packages/core/references.d.ts",
"../../packages/core/node_modules",
"../../node_modules",
"../../packages/core/ui/frame/transition-definitions.android.d.ts",
"../../packages/core/platforms/*"
], ],
"typedocOptions": { "typedocOptions": {
"out": "bin/dist/apiref", "entryPoints": ["../../packages/core/index.d.ts", "../../packages/core"],
"includeDeclarations": true, "out": "dist/apiref",
"name": "NativeScript", "name": "NativeScript",
"theme": "./node_modules/nativescript-typedoc-theme", "theme": "/Users/janoshrubosimac/Code/nativescript-typedoc-theme",
"excludeExternals": true, "excludeExternals": true,
"externalPattern": "**/+(tns-core-modules|module).d.ts" "externalPattern": "**/+(tns-core-modules|module).d.ts",
"exclude": ["../../packages/core/__tests__", "../../packages/core/**/*.ts"]
} }
} }