chore(package): upgrate typedoc to 0.16

This commit is contained in:
Daniel Sogl 2020-01-27 06:40:43 +01:00
parent 15ed431819
commit 82939763ee
3 changed files with 28 additions and 20 deletions

16
package-lock.json generated
View File

@ -13589,21 +13589,21 @@
}
},
"typedoc": {
"version": "0.15.8",
"resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.15.8.tgz",
"integrity": "sha512-a0zypcvfIFsS7Gqpf2MkC1+jNND3K1Om38pbDdy/gYWX01NuJZhC5+O0HkIp0oRIZOo7PWrA5+fC24zkANY28Q==",
"version": "0.16.9",
"resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.16.9.tgz",
"integrity": "sha512-UvOGoy76yqwCXwxPgatwgXWfsQ3FczyZ6ZNLjhCPK+TsDir6LiU3YB6N9XZmPv36E+7LA860mnc8a0v6YADKFw==",
"dev": true,
"requires": {
"@types/minimatch": "3.0.3",
"fs-extra": "^8.1.0",
"handlebars": "^4.7.0",
"handlebars": "^4.7.2",
"highlight.js": "^9.17.1",
"lodash": "^4.17.15",
"marked": "^0.8.0",
"minimatch": "^3.0.0",
"progress": "^2.0.3",
"shelljs": "^0.8.3",
"typedoc-default-themes": "^0.6.3",
"typedoc-default-themes": "^0.7.2",
"typescript": "3.7.x"
},
"dependencies": {
@ -13645,9 +13645,9 @@
}
},
"typedoc-default-themes": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.6.3.tgz",
"integrity": "sha512-rouf0TcIA4M2nOQFfC7Zp4NEwoYiEX4vX/ZtudJWU9IHA29MPC+PPgSXYLPESkUo7FuB//GxigO3mk9Qe1xp3Q==",
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.7.2.tgz",
"integrity": "sha512-fiFKlFO6VTqjcno8w6WpTsbCgXmfPHVjnLfYkmByZE7moaz+E2DSpAT+oHtDHv7E0BM5kAhPrHJELP2J2Y2T9A==",
"dev": true,
"requires": {
"backbone": "^1.4.0",

View File

@ -54,7 +54,7 @@
"ts-node": "^8.6.2",
"tslint": "^5.20.1",
"tslint-ionic-rules": "0.0.21",
"typedoc": "^0.15.8",
"typedoc": "^0.16.9",
"typescript": "~3.5.3",
"uglifyjs-webpack-plugin": "^2.2.0",
"unminified-webpack-plugin": "^2.0.0",

View File

@ -1,8 +1,10 @@
import * as fs from 'fs-extra';
import { Application } from 'typedoc';
import { basename, dirname, resolve } from 'path';
import { Application } from 'typedoc';
import { runInNewContext } from 'vm';
import TypeDoc = require('typedoc');
interface Plugin {
packageName: string;
displayName: string;
@ -19,9 +21,13 @@ interface Plugin {
const rootDir = resolve(__dirname, '../..');
const typedocTmp = resolve(__dirname, 'typedoc.tmp.json');
const pluginsDir = resolve(rootDir, 'src/@ionic-native/plugins');
const typedoc = new Application({
const typedoc = new Application();
typedoc.options.addReader(new TypeDoc.TSConfigReader());
typedoc.options.addReader(new TypeDoc.TypeDocReader());
typedoc.bootstrap({
mode: 'modules',
tsconfig: resolve(rootDir, 'tsconfig.json'),
ignoreCompilerErrors: true
});
@ -46,7 +52,9 @@ async function generateTypedoc(root: string, outputPath = typedocTmp) {
function processPlugin(pluginModule): Plugin {
const pluginClass = pluginModule.children.find(isPlugin);
const decorator = getPluginDecorator(pluginClass);
const packageName = `@ionic-native/${basename(dirname(pluginModule.originalName))}`;
const packageName = `@ionic-native/${basename(
dirname(pluginModule.originalName)
)}`;
const displayName = getTag(pluginClass, 'name');
const usage = getTag(pluginClass, 'usage');
const description = getTag(pluginClass, 'description');
@ -85,17 +93,17 @@ const getTag = (child: any, tagName: string): string => {
}
};
const isModule = (child: any): boolean =>
child.kind === 1;
const isModule = (child: any): boolean => child.kind === 1;
const isClass = (child: any): boolean =>
child.kind === 128;
const isClass = (child: any): boolean => child.kind === 128;
const isPlugin = (child: any): boolean =>
isClass(child) && hasTags(child) && Array.isArray(child.decorators) && child.decorators.some(d => d.name === 'Plugin');
isClass(child) &&
hasTags(child) &&
Array.isArray(child.decorators) &&
child.decorators.some(d => d.name === 'Plugin');
const hasPlugin = (child: any): boolean =>
child.children.some(isPlugin);
const hasPlugin = (child: any): boolean => child.children.some(isPlugin);
const hasTags = (child: any): boolean =>
child.comment && Array.isArray(child.comment.tags);