fix: add missing dependency typedoc

Fixes #5
This commit is contained in:
Anselm Stordeur
2019-01-09 15:17:05 +01:00
parent a2bd0d113b
commit b248d1b5e0
7 changed files with 90 additions and 87 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2018-2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -129,7 +129,13 @@ export function getProjectReflection(srcPath: PathLike): ProjectReflection {
const inputFiles = app.expandInputFiles([srcPath.toString()]);
// get project reflection from input files
return app.convert(inputFiles);
const result = app.convert(inputFiles);
if (typeof result === 'undefined') {
throw new Error('Project reflection could not be generated.');
}
return result;
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2018-2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -29,6 +29,10 @@ import {RouteWithMetaInformation} from './common';
export async function gatherRouteInformation(reflection: ProjectReflection): Promise<RouteWithMetaInformation[]> {
const routes: RouteWithMetaInformation[] = [];
if (!Array.isArray(reflection.children)) {
throw new Error('Project reflection doesn\'t contain any modules.');
}
await asyncPool(2, reflection.children, async (module: any) => {
if (Array.isArray(module.children) && module.children.length > 0) {
await asyncPool(2, module.children, (async (node: any) => {
@@ -49,6 +53,10 @@ export async function gatherRouteInformation(reflection: ProjectReflection): Pro
}
});
if (routes.length === 0) {
throw new Error('No route information found.');
}
return routes;
}
@@ -163,6 +171,10 @@ export function generateDocumentationForRoute(routeWithInfo: RouteWithMetaInform
export function getNodeMetaInformationMap(projectReflection: ProjectReflection): NodesWithMetaInformation {
const nodes: NodesWithMetaInformation = {};
if (typeof projectReflection.children === 'undefined') {
throw new Error('Project reflection doesn\'t contain any modules.');
}
// iterate over modules
projectReflection.children.forEach((module: any) => {
if (Array.isArray(module.children) && module.children.length > 0) {

View File

@@ -108,6 +108,10 @@ export class Converter {
export function getValidatableTypesFromReflection(projectReflection: ProjectReflection): string[] {
const validatableTypes: string[] = [];
if (typeof projectReflection.children === 'undefined') {
throw new Error('Project reflection doesn\'t contain any modules.');
}
// iterate over modules
projectReflection.children.forEach((module) => {
if (Array.isArray(module.children) && module.children.length > 0) {