Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix loading options twice in bootstrap to keep 'extends'. #1273

Merged
merged 8 commits into from Apr 25, 2020
9 changes: 6 additions & 3 deletions src/lib/utils/options/readers/typedoc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Path from 'path';
import * as FS from 'fs';
import * as _ from 'lodash';
import { cloneDeep } from 'lodash';

import { OptionsReader } from '..';
import { Logger } from '../../loggers';
Expand Down Expand Up @@ -51,13 +51,16 @@ export class TypeDocReader implements OptionsReader {
}
seen.add(file);

const data: unknown = require(file);
const fileContent: unknown = require(file);

if (typeof data !== 'object' || !data) {
if (typeof fileContent !== 'object' || !fileContent) {
logger.error(`The file ${file} is not an object.`);
return;
}

// clone option object to avoid of property changes in re-calling this file
const data: object = cloneDeep(fileContent);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


if ('extends' in data) {
const extended: string[] = getStringArray(data['extends']);
for (const extendedFile of extended) {
Expand Down