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-patch": "^1.3.0",
"tslint": "6.1.3",
"typedoc": "^0.20.14",
"typescript": "4.1.4",
"webpack": "~4.44.1",
"webpack-cli": "~3.3.12"

View File

@ -32,7 +32,7 @@
* SUPPORTED TOKENS: <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
@ -62,7 +62,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* 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.
@ -122,7 +122,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* 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
@ -147,7 +147,7 @@
/**
* (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".
@ -182,7 +182,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* 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.
@ -196,7 +196,6 @@
*/
// "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.
* This file will include only declarations that are marked as "@public".
@ -231,7 +230,6 @@
* DEFAULT VALUE: true
*/
// "enabled": true,
/**
* Specifies where the TSDoc metadata file should be written.
*
@ -279,7 +277,7 @@
*
* 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),
@ -289,7 +287,7 @@
* DEFAULT VALUE: false
*/
// "addToApiReportFile": false
},
}
// "TS2551": {
// "logLevel": "warning",
@ -308,13 +306,13 @@
*/
"extractorMessageReporting": {
"default": {
"logLevel": "warning",
"logLevel": "warning"
// "addToApiReportFile": false
},
"ae-missing-release-tag": {
"logLevel": "none",
"addToApiReportFile": false
},
}
// "ae-extra-release-tag": {
// "logLevel": "warning",
// "addToApiReportFile": true
@ -332,7 +330,7 @@
*/
"tsdocMessageReporting": {
"default": {
"logLevel": "warning",
"logLevel": "warning"
// "addToApiReportFile": false
},
"tsdoc-param-tag-missing-hyphen": {
@ -354,7 +352,7 @@
"tsdoc-malformed-html-name": {
"logLevel": "none",
"addToApiReportFile": false
},
}
// "tsdoc-link-tag-unescaped-text": {
// "logLevel": "warning",
@ -364,5 +362,4 @@
// . . .
}
}
}

View File

@ -3,7 +3,6 @@ set -e
ENV="${ENV:-dev}"
DIST_DIR="bin/dist"
TARGET_DIR="$DIST_DIR/snippets"
PACKAGE_VERSION="${PACKAGE_VERSION:-0.0.0}"
archive_dist_dir() {
@ -13,44 +12,27 @@ archive_dist_dir() {
npm_install() {
# Don't install modules twice.
MARKER_FILE="./node_modules/installed"
if [ ! -f "$MARKER_FILE" ] ; then
# Fixes perm issue while installing
npm i -g npm@^6.13.6
npm install
npm install @types/handlebars@4.0.33
touch "$MARKER_FILE"
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() {
APIREF_DIR="$DIST_DIR/api-reference"
rm -rf "$APIREF_DIR"
npm_install
npm run typedoc
# npm_install
npx typedoc --tsconfig tools/scripts/tsconfig.typedoc.json
mv "$DIST_DIR/apiref" "$APIREF_DIR"
mv "dist/apiref" "$APIREF_DIR"
archive_dist_dir "api-reference"
}
rm -rf "$TARGET_DIR"
mkdir -p "$TARGET_DIR"
if [ "${BASH_SOURCE[0]}" == "$0" ] ; then
extract_snippets
extract_apiref
fi

View File

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