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

Publish API Docs using the Docusaurus TypeDoc API plugin #288

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "xstate"]
path = xstate
url = https://github.com/statelyai/xstate
26 changes: 26 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,27 @@ const config = {
},
},
],

[
'docusaurus-plugin-typedoc-api',
{
disableVersioning: true,
projectRoot: `${__dirname}/xstate`,
packages: [
{ path: 'packages/core', slug: 'xstate' },
{ path: 'packages/xstate-analytics', slug: '@xstate/analytics' },
{ path: 'packages/xstate-graph', slug: '@xstate/graph' },
{ path: 'packages/xstate-immer', slug: '@xstate/immer' },
{ path: 'packages/xstate-inspect', slug: '@xstate/inspect' },
{ path: 'packages/xstate-react', slug: '@xstate/react' },
{ path: 'packages/xstate-solid', slug: '@xstate/solid' },
{ path: 'packages/xstate-svelte', slug: '@xstate/svelte' },
{ path: 'packages/xstate-test', slug: '@xstate/test' },
{ path: 'packages/xstate-vue', slug: '@xstate/vue' }
]
}
],

async function tailwindPlugin(context, options) {
return {
name: 'docusaurus-tailwindcss',
Expand Down Expand Up @@ -177,6 +198,11 @@ const config = {
position: 'right',
},
{ to: '/docs', label: 'Docs', position: 'right' },
{
to: 'api',
label: 'API',
position: 'right',
},
{
href: 'https://stately.ai/registry/projects',
label: 'Studio',
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc",
"format": "prettier --write '**/*.{js,jsx,ts,tsx,md,mdx,json}'"
"format": "prettier --write '**/*.{js,jsx,ts,tsx,md,mdx,json}'",
"postinstall": "patch-package"
},
"remarkConfig": {
"plugins": [
Expand Down Expand Up @@ -46,7 +47,9 @@
"headlessui": "^0.0.0",
"lucide-react": "^0.293.0",
"mdx-embed": "^1.1.2",
"patch-package": "8.0.0",
"postcss": "^8.4.31",
"postinstall-postinstall": "2.1.0",
"prism-react-renderer": "^2.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -61,6 +64,7 @@
"@docusaurus/types": "^3.0.0",
"@fec/remark-a11y-emoji": "^4.0.2",
"concurrently": "^8.2.2",
"docusaurus-plugin-typedoc-api": "4.0.1",
"dotenv": "^16.3.1",
"remark-cli": "^12.0.0",
"remark-validate-links": "^13.0.0",
Expand Down
14 changes: 14 additions & 0 deletions patches/docusaurus-plugin-typedoc-api+4.0.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/node_modules/docusaurus-plugin-typedoc-api/lib/components/VersionBanner.js b/node_modules/docusaurus-plugin-typedoc-api/lib/components/VersionBanner.js
index 7853ea1..3c0e481 100644
--- a/node_modules/docusaurus-plugin-typedoc-api/lib/components/VersionBanner.js
+++ b/node_modules/docusaurus-plugin-typedoc-api/lib/components/VersionBanner.js
@@ -27,6 +27,9 @@ function VersionBanner() {
return null;
}
const latestVersionInfo = docs[latestVersion.label];
+
+ return null;
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
className: `${themeCommon.ThemeClassNames.docs.docVersionBanner} alert alert--warning margin-bottom--md`,
role: "alert",
1 change: 1 addition & 0 deletions versioned_docs/version-4/api-packages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"entryPoints":{"index":{"label":"Index","path":"src/index.ts"}},"packagePath":"packages/core","packageSlug":"core","packageName":"xstate","packageVersion":"5.0.0-beta.49"},{"entryPoints":{"index":{"label":"Index","path":"src/index.ts"}},"packagePath":"packages/xstate-analytics","packageSlug":"xstate-analytics","packageName":"@xstate/analytics","packageVersion":"0.0.1"},{"entryPoints":{"index":{"label":"Index","path":"src/index.ts"}},"packagePath":"packages/xstate-graph","packageSlug":"xstate-graph","packageName":"@xstate/graph","packageVersion":"2.0.0-beta.5"},{"entryPoints":{"index":{"label":"Index","path":"src/index.ts"}},"packagePath":"packages/xstate-immer","packageSlug":"xstate-immer","packageName":"@xstate/immer","packageVersion":"0.3.3"},{"entryPoints":{"index":{"label":"Index","path":"src/index.ts"}},"packagePath":"packages/xstate-inspect","packageSlug":"xstate-inspect","packageName":"@xstate/inspect","packageVersion":"0.8.0"},{"entryPoints":{"index":{"label":"Index","path":"src/index.ts"}},"packagePath":"packages/xstate-react","packageSlug":"xstate-react","packageName":"@xstate/react","packageVersion":"4.0.0-beta.11"},{"entryPoints":{"index":{"label":"Index","path":"src/index.ts"}},"packagePath":"packages/xstate-solid","packageSlug":"xstate-solid","packageName":"@xstate/solid","packageVersion":"0.1.3"},{"entryPoints":{"index":{"label":"Index","path":"src/index.ts"}},"packagePath":"packages/xstate-svelte","packageSlug":"xstate-svelte","packageName":"@xstate/svelte","packageVersion":"2.1.0"},{"entryPoints":{"index":{"label":"Index","path":"src/index.ts"}},"packagePath":"packages/xstate-test","packageSlug":"xstate-test","packageName":"@xstate/test","packageVersion":"1.0.0-beta.4"},{"entryPoints":{"index":{"label":"Index","path":"src/index.ts"}},"packagePath":"packages/xstate-vue","packageSlug":"xstate-vue","packageName":"@xstate/vue","packageVersion":"3.0.0-beta.6"}]
Loading