Skip to content

Instantly share code, notes, and snippets.

@wdhowe
Last active February 3, 2024 18:22
Show Gist options
  • Save wdhowe/00f98c39dbdce21cfa67472939d2225e to your computer and use it in GitHub Desktop.
Save wdhowe/00f98c39dbdce21cfa67472939d2225e to your computer and use it in GitHub Desktop.
Analyze Clojure Docs Locally

Analyze Clojure Docs Locally

Analyzing your project via the cljdoc-analyzer locally will ensure that when your project is pushed to clojars, the API docs will have a much better chance of successfully generating.

Install the cljdoc-analyzer.

clojure -Ttools install io.github.cljdoc/cljdoc-analyzer '{:git/tag "RELEASE"}' :as cljdoc

Run the analyzer locally - lein based project.clj example

PROJECT_VERSION=$(awk '/defproject/ {print $3}' project.clj)

clojure -Tcljdoc analyze \
:project '"telegrambot-lib/telegrambot-lib"' \
:version '"${PROJECT_VERSION}"' \
:jarpath '"./target/telegrambot-lib-${PROJECT_VERSION}.jar"' \
:pompath '"./pom.xml"' \
:extra-repo '["clojars https://repo.clojars.org/"]'

Makefile target example

# Analyze cljdoc api imports locally.
cljdoc-analyze:
	@PROJECT_VERSION=$$(awk '/defproject/ {print $$3}' project.clj | tr -d '"') ; \
	clojure -Tcljdoc analyze \
	:project '"telegrambot-lib/telegrambot-lib"' \
	:version '"'$${PROJECT_VERSION}'"' \
	:jarpath '"'./target/telegrambot-lib-$${PROJECT_VERSION}.jar'"' \
	:pompath '"./pom.xml"' \
	:extra-repo '["clojars https://repo.clojars.org/"]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment