b9c6bf2fe8
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
78 lines
2.2 KiB
JSON
78 lines
2.2 KiB
JSON
{
|
|
"name": "@tldraw/docs",
|
|
"description": "A docs site for tldraw.",
|
|
"version": "0.1.1-alpha.0",
|
|
"private": true,
|
|
"packageManager": "yarn@3.5.0",
|
|
"author": {
|
|
"name": "tldraw GB Ltd.",
|
|
"email": "hello@tldraw.com"
|
|
},
|
|
"homepage": "https://tldraw.dev",
|
|
"license": "Apache-2.0",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/tldraw/tldraw"
|
|
},
|
|
"bugs": {
|
|
"url": "https://github.com/tldraw/tldraw/issues"
|
|
},
|
|
"keywords": [
|
|
"tldraw",
|
|
"drawing",
|
|
"app",
|
|
"development",
|
|
"whiteboard",
|
|
"canvas",
|
|
"infinite"
|
|
],
|
|
"scripts": {
|
|
"dev": "yarn docs-content && NODE_ENV=development next-remote-watch ./content/**/*.mdx -c 'yarn run -T tsx ./scripts/generate-on-reload.ts'",
|
|
"build": "next build",
|
|
"start": "next start",
|
|
"lint": "yarn run -T tsx ../../scripts/lint.ts",
|
|
"docs-content": "ts-node --project tsconfig.content.json ./scripts/index.ts",
|
|
"content": "lazy docs-content"
|
|
},
|
|
"dependencies": {
|
|
"@microsoft/tsdoc": "^0.14.2",
|
|
"@tldraw/utils": "workspace:*",
|
|
"@types/node": "18.15.0",
|
|
"@types/react": "^18.0.24",
|
|
"@types/react-dom": "^18.0.6",
|
|
"eslint": "8.36.0",
|
|
"eslint-config-next": "13.2.4",
|
|
"gray-matter": "^4.0.3",
|
|
"next": "13.2.4",
|
|
"next-mdx-remote": "^4.4.1",
|
|
"next-remote-watch": "^2.0.0",
|
|
"next-themes": "^0.2.1",
|
|
"prettier": "^2.8.7",
|
|
"react": "18.2.0",
|
|
"react-dom": "18.2.0",
|
|
"rehype-autolink-headings": "^6.1.1",
|
|
"rehype-highlight": "^6.0.0",
|
|
"rehype-slug": "^5.1.0",
|
|
"rehype-slug-custom-id": "^1.1.0",
|
|
"remark-gfm": "^3.0.1"
|
|
},
|
|
"//": [
|
|
"Anything that starts with @tldraw in devDependencies will get included in the docs site.",
|
|
"We have to list them here so lazyrepo knows the docs depends on those packages (ie their",
|
|
"tsdoc comments), even though we don't use any of their code to run the docs site."
|
|
],
|
|
"devDependencies": {
|
|
"@microsoft/api-extractor-model": "^7.26.4",
|
|
"@tldraw/editor": "workspace:*",
|
|
"@tldraw/file-format": "workspace:*",
|
|
"@tldraw/primitives": "workspace:*",
|
|
"@tldraw/store": "workspace:*",
|
|
"@tldraw/tldraw": "workspace:*",
|
|
"@tldraw/tlschema": "workspace:*",
|
|
"@tldraw/ui": "workspace:*",
|
|
"@tldraw/validate": "workspace:*",
|
|
"lazyrepo": "0.0.0-alpha.27",
|
|
"rimraf": "^4.4.0",
|
|
"ts-node": "^10.9.1"
|
|
}
|
|
}
|