-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* restore props tables! ensure docs tasks run after sources are compiled * generalize releases and versions they both accept an `IPackageInfo`, which now includes `url` field. resolve the URLs at require time (means we can use regular links for documentation versions). * add resolveInterface prop functions similarly to the other `resolve*` props. we provide a `PropsStore` class that can intelligently resolve props including inheritance. this is necessary because the previous impl used a relative path that does not exist in internal repo.
- Loading branch information
Showing
7 changed files
with
66 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { IInterfaceEntry, IPropertyEntry } from "ts-quick-docs/src/interfaces"; | ||
|
||
export class PropsStore { | ||
constructor(private props: IInterfaceEntry[]) {} | ||
|
||
public getProps = (name: string): IPropertyEntry[] => { | ||
const entry = this.props.filter((props) => props.name === name)[0]; | ||
if (entry == null) { | ||
return []; | ||
} else if (entry.extends == null) { | ||
return entry.properties; | ||
} else { | ||
// dirty deduplication for overridden/inherited props | ||
const props: {[name: string]: IPropertyEntry} = {}; | ||
entry.extends.map(this.getInheritedProps).forEach((inherited) => { | ||
inherited.forEach((prop) => props[prop.name] = prop); | ||
}); | ||
entry.properties.forEach((prop) => props[prop.name] = prop); | ||
// return a sorted array of unique props | ||
return Object.keys(props).sort().map((n) => props[n]); | ||
} | ||
} | ||
|
||
private getInheritedProps = (name: string) => { | ||
return this.getProps(name).map((p) => { | ||
p.inheritedFrom = name; | ||
return p; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8984b08
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generalize docs data (#63)
Preview: docs Coverage: core | datetime