diff --git a/apps/automated/src/data/observable-array-tests.ts b/apps/automated/src/data/observable-array-tests.ts index 1d41cb036..61f5c74f1 100644 --- a/apps/automated/src/data/observable-array-tests.ts +++ b/apps/automated/src/data/observable-array-tests.ts @@ -360,7 +360,6 @@ export const test_ObservableArray_spliceShouldRemoveSpecifiedNumberOfElementsSta export const test_ObservableArray_spliceShouldRemoveSpecifiedNumberOfElementsStartingFromSpecifiedIndexAndRaiseChangeEventWithCorrectArgs = function () { let result: ChangedData; - // >> observable-array-splice-change const array = new ObservableArray([1, 2, 3, 4]); array.on(ObservableArray.changeEvent, (args: ChangedData) => { @@ -377,7 +376,6 @@ export const test_ObservableArray_spliceShouldRemoveSpecifiedNumberOfElementsSta }); array.splice(1, 2); - // << observable-array-splice-change TKUnit.assert(result.eventName === ObservableArray.changeEvent && result.action === ChangeType.Splice && result.removed.length === 2 && result.index === 1 && result.addedCount === 0, "ObservableArray splice() should raise 'change' event with correct args!"); }; @@ -385,7 +383,6 @@ export const test_ObservableArray_spliceShouldRemoveSpecifiedNumberOfElementsSta export const test_ObservableArray_spliceShouldAddSpecifiedNumberOfElementsStartingFromSpecifiedIndexAndRaiseChangeEventWithCorrectArgs = function () { let result: ChangedData; - // >> observable-array-splice-change const array = new ObservableArray([0]); array.on(ObservableArray.changeEvent, (args: ChangedData) => { @@ -404,7 +401,6 @@ export const test_ObservableArray_spliceShouldAddSpecifiedNumberOfElementsStarti // Because their is only one item in the above array the item index should be // normalized to Index 1. array.splice(2, 0, 1); - // << observable-array-splice-change TKUnit.assert(result.eventName === ObservableArray.changeEvent && result.action === ChangeType.Splice && result.removed.length === 0 && result.index === 1 && result.addedCount === 1, "ObservableArray splice() should raise 'change' event with correct args!"); }; @@ -412,7 +408,6 @@ export const test_ObservableArray_spliceShouldAddSpecifiedNumberOfElementsStarti export const test_ObservableArray_spliceShouldAddDeleteSpecifiedNumberOfElementsStartingFromSpecifiedIndexAndRaiseChangeEventWithCorrectArgs = function () { let result: ChangedData; - // >> observable-array-splice-change const array = new ObservableArray([0]); array.on(ObservableArray.changeEvent, (args: ChangedData) => { @@ -431,7 +426,6 @@ export const test_ObservableArray_spliceShouldAddDeleteSpecifiedNumberOfElements // Because we are starting at index 2, their is NOTHING to delete // So the Starting index should actually be normalized to Index 1 array.splice(2, 2, 1); - // << observable-array-splice-change TKUnit.assert(result.eventName === ObservableArray.changeEvent && result.action === ChangeType.Splice && result.removed.length === 0 && result.index === 1 && result.addedCount === 1, "ObservableArray splice() should raise 'change' event with correct args!"); }; diff --git a/package.json b/package.json index 3b2119498..9c60d1d1a 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "mocha-typescript": "^1.1.17", "module-alias": "^2.2.2", "nativescript": "~7.1.0", + "nativescript-typedoc-theme": "git://github.com/NativeScript/nativescript-typedoc-theme.git#master", "node-sass": "~4.14.1", "parse-css": "git+https://github.com/tabatkins/parse-css.git", "parserlib": "^1.1.1", @@ -57,6 +58,7 @@ "ts-node": "~8.10.2", "ts-patch": "^1.2.5", "tslint": "~6.1.2", + "typedoc": "^0.20.14", "typescript": "~4.0.3", "webpack": "~4.44.1", "webpack-cli": "~3.3.12" diff --git a/packages/core/index.d.ts b/packages/core/index.d.ts index 99a8e4f3f..13d43a714 100644 --- a/packages/core/index.d.ts +++ b/packages/core/index.d.ts @@ -9,6 +9,7 @@ export type { NativeScriptConfig } from './config'; export { iOSApplication, AndroidApplication } from './application'; export type { ApplicationEventData, LaunchEventData, OrientationChangedEventData, UnhandledErrorEventData, DiscardedErrorEventData, CssChangedEventData, LoadAppCSSEventData, AndroidActivityEventData, AndroidActivityBundleEventData, AndroidActivityRequestPermissionsEventData, AndroidActivityResultEventData, AndroidActivityNewIntentEventData, AndroidActivityBackPressedEventData, SystemAppearanceChangedEventData } from './application'; import { systemAppearanceChanged, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, notify, hasListeners, run, orientation, getNativeApplication, hasLaunched, systemAppearance } from './application'; +import { AndroidApplication, iOSApplication } from './application'; export declare const Application: { launchEvent: string; displayedEvent: string; @@ -39,8 +40,8 @@ export declare const Application: { getNativeApplication: typeof getNativeApplication; hasLaunched: typeof hasLaunched; systemAppearance: typeof systemAppearance; - android: import('./application').AndroidApplication; - ios: import('./application').iOSApplication; + android: typeof AndroidApplication; + ios: typeof iOSApplication; }; import { setString, getString, clear, flush, getAllKeys, getBoolean, getNumber, hasKey, remove, setBoolean, setNumber } from './application-settings'; export declare const ApplicationSettings: { @@ -73,13 +74,14 @@ export { VirtualArray } from './data/virtual-array'; export type { ItemsLoading } from './data/virtual-array'; export { File, FileSystemEntity, Folder, knownFolders, path, getFileAccess } from './file-system'; export type { HttpRequestOptions, HttpResponse, Headers, HttpResponseEncoding, HttpContent } from './http'; +import { HttpRequestOptions, HttpResponse } from './http'; import { getFile, getImage, getJSON, getString as httpGetString } from './http'; export declare const Http: { getFile: typeof getFile; getImage: typeof getImage; getJSON: typeof getJSON; getString: typeof httpGetString; - request: (options: import('./http').HttpRequestOptions) => Promise; + request: (options: HttpRequestOptions) => Promise; }; export { ImageAsset } from './image-asset'; export type { ImageAssetOptions } from './image-asset'; diff --git a/tools/scripts/api-extractor.json b/tools/scripts/api-extractor.json index 5abc9d315..f98610e82 100644 --- a/tools/scripts/api-extractor.json +++ b/tools/scripts/api-extractor.json @@ -32,7 +32,7 @@ * SUPPORTED TOKENS: * DEFAULT VALUE: "" */ - "projectFolder": "nativescript-core", + "projectFolder": "../../packages/core", /** * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor diff --git a/tools/scripts/build-docs.sh b/tools/scripts/build-docs.sh index dcf6cd329..164ae2d2f 100755 --- a/tools/scripts/build-docs.sh +++ b/tools/scripts/build-docs.sh @@ -27,7 +27,7 @@ extract_snippets() { npm install markdown-snippet-injector - for SNIPPET_DIR in {tests/app,apps/app,nativescript-core} ; do + for SNIPPET_DIR in {apps/automated,apps/toolbox,apps/ui,packages/core} ; do echo "Extracting snippets from: $SNIPPET_DIR" node "$BIN" --root="$SNIPPET_DIR" --target="$TARGET_DIR" \ --sourceext=".js|.ts|.xml|.html|.css" @@ -41,9 +41,10 @@ extract_apiref() { rm -rf "$APIREF_DIR" npm_install - npm run typedoc + #npx api-extractor run --config tools/scripts/api-extractor.json --local --verbose && (cd packages/core && cat nativescript-core.header index.d.ts > tmp_file && mv tmp_file nativescript-core.d.ts) + npx typedoc --tsconfig tools/scripts/tsconfig.typedoc.json - mv "$DIST_DIR/apiref" "$APIREF_DIR" + mv "dist/apiref" "$APIREF_DIR" archive_dist_dir "api-reference" } diff --git a/tools/scripts/tsconfig.typedoc.json b/tools/scripts/tsconfig.typedoc.json index e48c2cea4..7ddb54fd9 100644 --- a/tools/scripts/tsconfig.typedoc.json +++ b/tools/scripts/tsconfig.typedoc.json @@ -1,37 +1,41 @@ { + "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" + "../../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", + + "../../packages/core/ui/layouts/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/__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", "excludeExternals": true, - "externalPattern": "**/+(tns-core-modules|module).d.ts" + "externalPattern": "**/+(tns-core-modules|module).d.ts", + "exclude": [ + "packages/core/__tests__", + "packages/core/**/*.ts" + ] } } \ No newline at end of file