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
Merged

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

merged 8 commits into from Apr 25, 2020

Conversation

WilliamJns
Copy link
Contributor

Fix #1272

Every time we open the option files and after reading the value of extends in each one, this property is removed from that file, so the next time the value of extends is no longer available to us (according to this code logics).

Therefore, reading the options file more than once will cause #1272 issue.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Apr 20, 2020

This will break wrappers around TypeDoc. Both the Grunt and Gulp wrappers around TypeDoc use the option passing in bootstrap to let users specify config files or options directly.

A better solution would be to clone the options object before mutating it.

@WilliamJns WilliamJns marked this pull request as draft April 20, 2020 13:21
@WilliamJns WilliamJns marked this pull request as ready for review April 20, 2020 13:53
@WilliamJns
Copy link
Contributor Author

@Gerrit0 Thanks for the tip. Please review the new changes.

Copy link
Collaborator

@Gerrit0 Gerrit0 left a comment

Choose a reason for hiding this comment

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

One last thing

@@ -21,6 +21,11 @@ export function addTypeDocOptions(options: Options) {
type: ParameterType.Array
});

options.addDeclaration({
Copy link
Collaborator

Choose a reason for hiding this comment

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

This implies that users can specify --extends on the command line, or in typedocOptions in tsconfig.json, which isn't true.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Best to just remove it, I still need to update the website docs to mention this, but it shouldn't show up in --help.

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.

👍

@WilliamJns WilliamJns requested a review from Gerrit0 April 21, 2020 08:26
@Gerrit0 Gerrit0 merged commit d5c2d47 into TypeStrong:master Apr 25, 2020
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Apr 25, 2020

Thanks! Should have a release out this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"extends" option not working in TypeDoc config
2 participants