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

DocBlock parser #22

Closed
crookse opened this issue Mar 13, 2019 · 1 comment
Closed

DocBlock parser #22

crookse opened this issue Mar 13, 2019 · 1 comment
Assignees

Comments

@crookse
Copy link
Member

crookse commented Mar 13, 2019

Summary

What: Need a DocBlock parser to generate API Reference page(s).

Why: After some investigating, TypeDoc seems to be the best option for generating docs. However, without editing its internals, you can't really parse .ts files (especially Deno-friendly .ts files). Errors are thrown because of linting, errors are thrown because TypeDoc can't find imports, etc. Just make a parser for now until something better and faster comes along.

Acceptance Critera

  • Parser must output parsed docblocks into JSON. Sample below (it doesn't have to meet the sample's exact spec):

    {
        "my_cool_class.ts": {
            "properties": [
                {
                    "name": "property_one",
                    "type" "string"
                },
                {
                    "name": "property_two",
                    "type" "boolean"
                }
            ],
            "methods": [
                {
                    "name": "MethodOne",
                    "params": [],
                    "returns": [
                        {
                            "type": "void",
                            "description": "It just delegates."
                        }
                    ],
                    "throws": []
                },
                {
                    "name": "MethodTwo",
                    "params": [
                        {
                            "type": "any",
                            "name": "object",
                            "description": "The object to use."
                        },
                        {
                            "type": "key",
                            "name": "key",
                            "description": "The key to find in the object to use."
                        }
                    ],
                    "returns": [
                        {
                            "type": "any",
                            "description": "Returns the value of the key in the object to use."
                        }
                    ],
                    "throws": []
                }
            ]
        }
    }
  • Unit tests are required.

Example Pseudo Code (for implementation)

let files = {
  "file.js": {}
}

for (let key in files) {
  files[key] = parseDocBlocks(key);
}

parseDocBlocks(file: string) {
    // do something
}

parseDocBlock(docBlock: string) {
    // do something
}
@crookse crookse self-assigned this Mar 13, 2019
@crookse
Copy link
Member Author

crookse commented Mar 14, 2019

Done. It's now generating api_reference.json which is data taken from the docblocks of each specified class.

@crookse crookse closed this as completed Mar 14, 2019
crookse pushed a commit that referenced this issue Jun 27, 2021
crookse added a commit that referenced this issue Jun 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant