Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

feat: add namespace support & add extendedDescription property & add examples on class #1

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

favna
Copy link

@favna favna commented Dec 30, 2021

Adopting this library for Sapphire and for that project we use namespaces in several places. Namespaces are essentially just a collection of nested typedefs so it's easy enough to parse.

Namespaces

Very basic example code of namespaces:

export interface MyCoolClassOptions {}

export class MyCoolClass {
  public constructor(options: MyCoolClassOptions) {
    // whatever
  }
}

export namespace MyCoolClass {
  export type Options = MyCoolClassOptions;
}

Now users can use both MyCoolClassOptions and MyCoolClass.Options to get the same type.


Extended Description

Just another thing I noticed while setting up the parsing. For Sapphire some of our classes have more than what typedoc puts in shortText such as SapphireClient (highlighted the missing part). That part ends up in text but it is still something we'd like on the website. So I put that in extendedDescription.


Examples on class

Another thing I noticed that was missing. Examples on class level weren't being parsed. I.e. when the code is:

/**
 * @example
 * ```
 * const myClass = new MyClass();
 * ```
 */
export MyClass {

}

@favna favna changed the title feat: add namespace support feat: add namespace support & add extendedDescription property Dec 30, 2021
@favna favna changed the title feat: add namespace support & add extendedDescription property feat: add namespace support & add extendedDescription property & add examples on class Dec 30, 2021
@favna favna marked this pull request as draft December 30, 2021 21:01
@favna
Copy link
Author

favna commented Dec 30, 2021

Converted this to draft. I'll undraft it when I'm done with the Sapphire website just in case more ends up coming up. This way we can keep it all contained in 1 PR. Locally I can generate JSON files with a yarn link anyway.

@xhyrom
Copy link

xhyrom commented Feb 18, 2022

Converted this to draft. I'll undraft it when I'm done with the Sapphire website just in case more ends up coming up. This way we can keep it all contained in 1 PR. Locally I can generate JSON files with a yarn link anyway.

Hi, do you have a date when this PR might open and get merge?

@favna
Copy link
Author

favna commented Feb 18, 2022

I'm sorry but no @xhyrom. I've had a bit of a burn out with Docusaurus so I haven't worked on the Sapphire rewrite since I drafted this PR.

For added context, Sapphire's website uses docusaurus-plugin-typedoc right now but it's giving us major performance issued (we need to specify cross-env NODE_OPTIONS=\"--max-old-space-size=6144\" just to build it!!) and it's also veerry slow to generate. So instead I'm rewriting it to parse JSON that comes out of this lib, but with how Docusaurus works that is a crap tonne of effort. On the bright side... once I do 1 page, I'll have done most pages. But still, it's a lot of effort.

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

Successfully merging this pull request may close these issues.

3 participants