Skip to content

Commit

Permalink
chore(deps): bump typedoc to 0.17
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsogl committed May 15, 2020
1 parent 1dfd8a0 commit fd8d83a
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 69 deletions.
94 changes: 36 additions & 58 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"ts-node": "^8.10.1",
"tslint": "^5.20.1",
"tslint-ionic-rules": "0.0.21",
"typedoc": "^0.16.11",
"typedoc": "^0.17.6",
"typescript": "~3.8.3",
"typescript-tslint-plugin": "0.5.5",
"uglifyjs-webpack-plugin": "^2.2.0",
Expand Down
19 changes: 9 additions & 10 deletions scripts/docs-json/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as fs from 'fs-extra';
import { basename, dirname, resolve } from 'path';
import { Application } from 'typedoc';
import { runInNewContext } from 'vm';

import TypeDoc = require('typedoc');
import { runInNewContext } from 'vm';

interface Plugin {
packageName: string;
Expand All @@ -28,7 +27,7 @@ typedoc.options.addReader(new TypeDoc.TypeDocReader());

typedoc.bootstrap({
mode: 'modules',
ignoreCompilerErrors: true
ignoreCompilerErrors: true,
});

run(pluginsDir);
Expand All @@ -38,13 +37,13 @@ async function run(pluginsDir: string) {
const modules = typedocData.children.filter(isModule);
const plugins = modules.filter(hasPlugin).map(processPlugin);
await fs.outputJson(resolve(__dirname, 'plugins.json'), plugins, {
spaces: 2
spaces: 2,
});
}

async function generateTypedoc(root: string, outputPath = typedocTmp) {
const pluginDirs = await fs.readdir(root);
const paths = pluginDirs.map(dir => resolve(root, dir, 'index.ts'));
const paths = pluginDirs.map((dir) => resolve(root, dir, 'index.ts'));
typedoc.generateJson(paths, outputPath);
return fs.readJson(outputPath);
}
Expand All @@ -67,8 +66,8 @@ function processPlugin(pluginModule): Plugin {
repo: decorator.repo,
installVariables: decorator.installVariables,
cordovaPlugin: {
name: decorator.plugin
}
name: decorator.plugin,
},
};
}

Expand All @@ -79,14 +78,14 @@ function processPlugin(pluginModule): Plugin {
*/
const getPluginDecorator = (child: any) => {
if (isPlugin(child)) {
const decorator = child.decorators.find(d => d.name === 'Plugin');
const decorator = child.decorators.find((d) => d.name === 'Plugin');
return runInNewContext(`(${decorator.arguments.config})`);
}
};

const getTag = (child: any, tagName: string): string => {
if (hasTags(child)) {
const tag = child.comment.tags.find(t => t.tag === tagName);
const tag = child.comment.tags.find((t) => t.tag === tagName);
if (tag) {
return tag.text;
}
Expand All @@ -101,7 +100,7 @@ const isPlugin = (child: any): boolean =>
isClass(child) &&
hasTags(child) &&
Array.isArray(child.decorators) &&
child.decorators.some(d => d.name === 'Plugin');
child.decorators.some((d) => d.name === 'Plugin');

const hasPlugin = (child: any): boolean => child.children.some(isPlugin);

Expand Down

0 comments on commit fd8d83a

Please sign in to comment.