clj-commons

hlship 2023-03-22T21:49:29.569759Z

So, one thing I typically do is have a GitHub project just to contain and publish API docs, such as https://github.com/AvisoNovate/docs. Is that something the makes sense here, or do we just lean on http://cljdoc.org? (e.g., https://cljdoc.org/d/clojure-humanize/clojure-humanize/0.2.2/doc/readme

lread 2023-03-23T13:58:04.617979Z

On some projects I've created a bb cljdoc-preview, it doesn't make the process less heavy, you still have to push your changes, start a cljdoc docker server and then ingest your docs, and then view them. But it abstracts the nitty gritties. Here's the https://github.com/clj-commons/etaoin/blob/07277c1f78ec9bed74b9c7b74084897346adc2c3/script/cljdoc_preview.clj#L1-L253 that backs the task for etaoin.

borkdude 2023-03-23T13:59:26.353899Z

@lee why do we need to use docker at all and can't we invoke a pure Java lib?

borkdude 2023-03-23T14:00:34.390279Z

I think it would be awesome if you could generate the docs locally more easily for previewing and detecting errors early. Optionally: upload them in a cljdoc folder or branch and self-host them. And cljdoc could pick up on those as "pre-generated" such that it doesn't need the analyzer remotely again

lread 2023-03-23T14:03:42.563819Z

Yeah, I think we even chatted about something similar a while back @borkdude: https://github.com/cljdoc/cljdoc/issues/565.

lread 2023-03-23T14:04:39.841159Z

I also think an option for static analysis will solve a ton of problems for folks. https://github.com/cljdoc/cljdoc/issues/543

lread 2023-03-23T14:10:39.134529Z

The first source of truth for cljdoc is currently the jar. And that is also currently the case for preview. The advantage is that this mimics production, the disadvantage is that it is awkward and heavy.

borkdude 2023-03-23T14:12:07.478579Z

@lee Maybe integrating with tools/deps and being able to provide a SHA could work too?

borkdude 2023-03-23T14:12:57.886039Z

E.g. nextjournal/garden does nice job of this: you can build it locally and on the server, using the same config in our deps.edn: https://github.clerk.garden/

borkdude 2023-03-23T14:14:50.737139Z

this would solve the preview problem for me too, first I would request a specific sha, make changes and then release to clojars

lread 2023-03-23T14:14:53.909229Z

Yeah, if you mean building docs from hosted git sources, we have an open issue for that one too: https://github.com/cljdoc/cljdoc/issues/459 Sean and I hashed out many details for that one.

lread 2023-03-23T14:18:53.281549Z

I'll take a peek at the clerk strategy to see what we can potentially steal (find inspiration from).

borkdude 2023-03-23T14:19:59.719209Z

one aspect of clerk is "local first", which I think is one of the frictions it solves compared to existing "notebook" solutions

lread 2023-03-23T14:20:41.008419Z

Yeah, cljdoc was certainly not designed with local-first in mind.

lread 2023-03-23T14:21:12.092209Z

But that doesn't mean it has to stay that way.

lread 2023-03-23T14:28:08.492979Z

Until the cljdoc preview flow improves @borkdude, I'll volunteer to review/preview for your projects. Just lemme know which ones you'd like me to monitor. Not ideal, because it would be better for you to preview quickly before a release, but maybe an ok compromise for now.

lread 2023-03-23T14:29:04.385259Z

And the pain of doing this, might just motivate me to change cljdoc. simple_smile

borkdude 2023-03-23T14:30:11.965639Z

Haha, deal! :)

borkdude 2023-03-23T14:30:50.619789Z

And if you want my help with static analysis for cljdoc via clj-kondo, I'll gladly return the favor

lread 2023-03-23T14:41:46.131289Z

Thanks! I actually got pretty far with static analysis. I got a bit stuck on a difference between static vs dynamic analysis wrt to macros and ClojureScript. The friction was enough to let another distraction distract me. But iirc, dynamic cljs analysis only includes macros if they are used/loaded by the lib and my static cljs analysis always includes all macros. We chatted about this at the time and you helped me to see that static analysis makes more sense because all macros can be potentially used from cljs.

lread 2023-03-23T16:04:38.686459Z

@borkdude I've done a cljdoc sweep for sci and clj-kondo. Ping me whenever you need a cljdoc review/sweep help for any of your projects.

❤️ 1
borkdude 2023-03-22T22:12:45.937299Z

@hlship What I do personally is create an API.md using quickdoc: https://github.com/borkdude/quickdoc/blob/main/API.md This works well for projects whose vars can be detected statically. There is also codox, which works well. For publishing docs you can use Github Pages. cljdoc should work automatically

hlship 2023-03-22T22:13:44.446889Z

I generally prefer codox, and regenerate it which releases, then copy the codox to the appropriate docs subfolder, commit, and push.

borkdude 2023-03-22T22:15:34.332439Z

@hlship yeah, cool. I recently discovered another way of doing this, without committing the generated html stuff to your local tree: You can build the codox (or ClojureScript, or whatever you want to push to Github Pages) on github actions This is the github actions config: https://github.com/borkdude/clj2el/blob/49f602a2a5f441946f48fd0d0c3b53109eeba2e5/.github/workflows/pages.yml#L42-L53

seancorfield 2023-03-22T22:16:45.090649Z

What I really like about http://cljdoc.org is that it a) includes all the API docs derived from the ns and var docstrings and it includes readme, changelog, and everything in the docs folder (and you can tell it how to structure that via an EDN file).

hlship 2023-03-22T22:17:10.285299Z

Yes, and leaning on that is simpler than the process I currently use!

seancorfield 2023-03-22T22:17:21.821399Z

Then you don't have to worry about any external doc-gen tools -- and you get automatic docs for every version of your project published to clojars!

☝️ 1
seancorfield 2023-03-22T22:17:54.390399Z

(and you get the benefit of discoverability for your library when people search for stuff on http://cljdoc.org itself!)

borkdude 2023-03-22T22:18:10.131919Z

One thing I find difficult about cljdoc though is that it's hard/slow to preview what is going to get generated. E.g. forgetting to add something to cljdoc.edn, a namespace which should not have been included in the API docs, etc

seancorfield 2023-03-22T22:18:34.417149Z

You can run it locally -- but I agree that's a bit clunky.

borkdude 2023-03-22T22:18:54.067399Z

I contributed that "run it locally" initially

seancorfield 2023-03-22T22:19:10.428709Z

You can at least include a step in your GH Actions to verify the cljdoc.edn file 🙂

borkdude 2023-03-22T22:19:28.724489Z

but after too many times that "analysis failed", etc, I gave up on checking how my docs looked on http://cljdoc.org (I should probably start doing that again)

lread 2023-03-23T02:35:29.944819Z

I'm one of the maintainers for cljdoc. I like it and use it for clj-commons projects where I'm a maintainer. Agreed that local preview is awkward. But I have the luxury of not being pressed for time so it does not bother me too much.