Skip to content

Migrate the project to TypeScript #61

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

Merged
merged 1 commit into from
Nov 5, 2022
Merged

Migrate the project to TypeScript #61

merged 1 commit into from
Nov 5, 2022

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented Nov 5, 2022

Descriptions

TypeScript has excellent documentation tools. JavaScript doesn't.

I've tried to generate an API reference documentation from the JavaScript code. All the tools I've tried were either lacking, outdated, abandoned, or they didn't support the modern JavaScript syntax.

TypeScript's official TSdoc toolkit is capable of generating an api data model from the codebase. From there, building a markdown reference is just a templating problem.

Documentation aside, this brings the type safety, enables static checks, and gives us autocompletion for free.

@adamziel adamziel force-pushed the typescript/migrate branch 2 times, most recently from 70ba935 to 69f970c Compare November 5, 2022 05:13
The major reason is that JavaScript documentation tools are severely
lacking and they don't even support the modern JavaScript syntax.
TypeScript is well supported, and the official tsdoc project provides
tools to generate the api model from the codebase. From there,
generating a markdown reference is just a templating problem.

Documentatino aside, this brings the type safety, enables static checks,
and gives us autocompletion for free.
@adamziel adamziel merged commit 77d9047 into trunk Nov 5, 2022
@adamziel adamziel deleted the typescript/migrate branch November 5, 2022 05:15
@adamziel adamziel mentioned this pull request Nov 5, 2022
adamziel added a commit that referenced this pull request Nov 5, 2022
## Overview

Adds a API documentation pipeline:

1. Build TypeScript types using `tsc`
2. Generate an API model and store it as JSON using `api-extractor` from the [TSDoc toolkit](https://tsdoc.org/)
3. Generate markdown files from the API model using a **highly** customized version of TSDoc's api-extractor I put in the  `typescript-reference-doc-generator` package.
4. Generate a pretty HTML page from the markdown using Vitepress (it's likely to change to another tool)

I'll merge the documentation itself in another PR.

Technically, you run these commands:

```
npm run build:api-docs
npm run dev:docs:server
```

And get this page:

<img width="1125" alt="CleanShot 2022-11-04 at 22 11 57@2x" src="https://user-images.githubusercontent.com/205419/200110405-b4bc130f-50cd-432d-a09d-93a6f10e05d8.png">

<img width="1134" alt="CleanShot 2022-11-04 at 22 11 41@2x" src="https://user-images.githubusercontent.com/205419/200110401-22740c94-cd5b-42e6-96c6-e77724a10908.png">

Follows up on #61
adamziel added a commit that referenced this pull request Nov 7, 2022
This PR populates /docs with a step-by-step documentation connecting the priors documentation efforts shipped in:

* API Reference documentation #63
* Migrate the project to TypeScript #61
* Add developer documentation  #60
* Monorepo #57
Pookie717 added a commit to Pookie717/wordpress-playground that referenced this pull request Oct 1, 2023
## Overview

Adds a API documentation pipeline:

1. Build TypeScript types using `tsc`
2. Generate an API model and store it as JSON using `api-extractor` from the [TSDoc toolkit](https://tsdoc.org/)
3. Generate markdown files from the API model using a **highly** customized version of TSDoc's api-extractor I put in the  `typescript-reference-doc-generator` package.
4. Generate a pretty HTML page from the markdown using Vitepress (it's likely to change to another tool)

I'll merge the documentation itself in another PR.

Technically, you run these commands:

```
npm run build:api-docs
npm run dev:docs:server
```

And get this page:

<img width="1125" alt="CleanShot 2022-11-04 at 22 11 57@2x" src="https://user-images.githubusercontent.com/205419/200110405-b4bc130f-50cd-432d-a09d-93a6f10e05d8.png">

<img width="1134" alt="CleanShot 2022-11-04 at 22 11 41@2x" src="https://user-images.githubusercontent.com/205419/200110401-22740c94-cd5b-42e6-96c6-e77724a10908.png">

Follows up on WordPress/wordpress-playground#61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant