Auto content refresh for docs site (#1606)

This PR improves the author experience when working on the docs site. 

When running `docs-dev`, the site's content will now update whenever a
content file is changed.

### Context

In the docs project, we generate content from two sources: from API
documentation generated by api-extractor and from markdown files in the
docs/content folder. Generating API docs is a relatively slow process
because it involves building and parsing TypeScript declaration files
for each package in the monorepo; however, generating docs from the
markdown files is basically instantaneous. The same script used to
address both tasks, which meant it was too slow to run on each save.
Instead, the script needed to be run manually or the dev server would
need to be restarted.

We now split the generation into two separate scripts. First, the script
runs to generate the API content; and then a second script runs to
generate the markdown content. The second script also imports and
combines the two sources of content. When we build the docs, both
scripts are run. When a markdown file changes, the new watcher only runs
the second script. This allows the site's content to be updated quickly
without having to generate the API docs each time.

Note that this does not incorporate live changes to package APIs, though
I can't think of a time where we be developing the docs and the APIs at
the same time.

### Change Type

- [x] `documentation` — Changes to the documentation only
This commit is contained in:
Steve Ruiz 2023-06-17 10:46:46 +01:00 committed by GitHub
parent 3f52c24fec
commit b9c6bf2fe8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 356 additions and 107 deletions

View file

@ -12,17 +12,18 @@ tldraw is a React component that you can use to create infinite canvas experienc
![screenshot of tldraw](/images/screenshot.png)
These docs relate to tldraw's **alpha version**. This version is not yet open sourced, however it is available on npm and permissively licensed under Apache 2.0.
These docs relate to tldraw's **alpha version**, which is [open source](https://github.com/tldraw/tldraw), permissively licensed under Apache 2.0, and available [on npm](https://www.npmjs.com/package/@tldraw/tldraw) under the alpha and canary versions.
- Want to explore the code? Visit the [GitHub repo](https://github.com/tldraw/tldraw)).
- Want to dive in? Visit the [examples StackBlitz](https://stackblitz.com/github/tldraw/tldraw/tree/examples?file=src%2F1-basic%2FBasicExample.tsx).
- Found a bug or integration problem? Please create a ticket [here](https://github.com/tldraw/tldraw/issues).
- Questions or feedback? Let us know on the [Discord](https://discord.gg/JMbeb96jsh).
And if you are just looking for the regular app, try [tldraw.com](https://www.tldraw.com).
And if you are just looking for the regular tldraw app, try [tldraw.com](https://www.tldraw.com).
## Installation
First, install the `@tldraw/tldraw` package using `@alpha` for the **latest alpha release**. It also has peer dependencies on `signia` and `signia-react` which you will need to install at the same time.
First, install the `@tldraw/tldraw` package using `@alpha` for the **latest alpha release**. The package also has peer dependencies on `signia` and `signia-react` which you will need to install at the same time.
```bash
yarn add @tldraw/tldraw@alpha signia signia-react
@ -30,6 +31,14 @@ yarn add @tldraw/tldraw@alpha signia signia-react
npm install @tldraw/tldraw@alpha signia signia-react
```
To get the very latest version, use the [latest canary release](https://www.npmjs.com/package/@tldraw/tldraw?activeTab=versions). Docs for the very latest version are also available at [canary.tldraw.dev](https://canary.tldraw.dev).
```bash
yarn add @tldraw/tldraw@canary signia signia-react
# or
npm install @tldraw/tldraw@canary signia signia-react
```
## Usage
You should be able to use the `<Tldraw/>` component in any React editor.