Skip to content

Publish JS documentation to HexDocs#4216

Closed
rhcarvalho wants to merge 1 commit intophoenixframework:mainfrom
rhcarvalho:js-typedoc
Closed

Publish JS documentation to HexDocs#4216
rhcarvalho wants to merge 1 commit intophoenixframework:mainfrom
rhcarvalho:js-typedoc

Conversation

@rhcarvalho
Copy link
Copy Markdown
Contributor

In order to make consuming and pointing to the LiveView JS documentation easier, this commit replicates the setup used in Phoenix to build and publish the JS documentation alongside the Elixir documentation in HexDocs.

Because TypeScript is used in the LiveView JS codebase in the past year, use typedoc instead of documentation (which Phoenix uses for plain JS). By pointing typedoc directly to the index.ts entry point, we ensure only the public API is generated and documented.

The resulting HexDocs sidebar includes a "JS Documentation" entry right after the Changelog, same as in Phoenix.

Preview

HexDocs index/sidebar

image

JS/TS docs

image

In order to make consuming and pointing to the LiveView JS documentation
easier, this commit replicates the setup used in Phoenix to build and publish
the JS documentation alongside the Elixir documentation in HexDocs.

Because TypeScript is used in the LiveView JS codebase in the past year, use
`typedoc` instead of `documentation` (which Phoenix uses for plain JS). By
pointing `typedoc` directly to the `index.ts` entry point, we ensure only the
public API is generated and documented.

The resulting HexDocs sidebar includes a "JS Documentation" entry right after
the Changelog, same as in Phoenix.
Comment thread package.json
"cover": "npm run test && npm run cover:merge",
"cover:report": "npx monocart show-report cover/merged-js/index.html"
"cover:report": "npx monocart show-report cover/merged-js/index.html",
"docs": "typedoc assets/js/phoenix_live_view/index.ts --readme none --html doc/js"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--readme none matches the output in the Phoenix JS docs, i.e. it will not copy LiveView's README.md.

Without this the result was rather confusing, as the README is not written in the context of the JS codebase, but rather a general overview of the project.

Comment thread mix.exs
end

defp generate_js_docs(_) do
Mix.Task.run("app.start")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is strictly necessary, mix docs seems to work just fine with this commented out. I copied from Phoenix' mix.exs.

@SteffenDE SteffenDE mentioned this pull request May 6, 2026
@SteffenDE
Copy link
Copy Markdown
Collaborator

Thank you! I needed to do some more changes to the LiveView code to not expose some of the things we only did because we didn't type the LiveSocket, e.g. LiveSocketInstanceInterface. Merged via #4217.

@SteffenDE SteffenDE closed this May 7, 2026
@SteffenDE
Copy link
Copy Markdown
Collaborator

https://phoenixframework.github.io/phoenix_live_view/js/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants