Skip to content

Commit 8d71364

Browse files
committed
Update docs to describe babashka tasks
We have moved from bb script invocation to bb task invocation.
1 parent f1ed92f commit 8d71364

File tree

3 files changed

+62
-31
lines changed

3 files changed

+62
-31
lines changed

bb.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
test-cljs-watch {:task cljs-watch/-main :doc "watch cljs test with fighweel main"}
2626
test-coverage {:task coverage/-main :doc "generate code coverage reports for Clojure tests"}
2727
test-doc {:task doc-tests/-main :doc "test doc code blocks"}
28-
test-libs {:task libs-tests/-main :doc "(run|outdated) - verify taht libs using rewrite-clj* work with current rewrite-clj"}
28+
test-libs {:task libs-tests/-main :doc "(list|run|outdated) - verify that libs using rewrite-clj* work with current rewrite-clj"}
2929
outdated {:task outdated/-main :doc "report on outdated Clojure and npm dependencies"}
3030
doc-api-diffs {:task gen-api-diffs/-main :doc "generate diff docs for rewrite-clj* APIs"}
3131
doc-update-readme {:task update-readme/-main :doc "honour our contributors in README"}

doc/02-developer-guide.adoc

Lines changed: 59 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Automated testing is setup using GraalVM v21 JDK11.
2020
* NodeJs v12 or above
2121
* Clojure v1.10.1.697 or above for `clojure` command
2222
** Note that rewrite-clj v1 itself supports Clojure v1.9 and above
23-
* Babashka v0.3.2 or above
23+
* Babashka v0.3.7 or above
2424
* GraalVM v21.1.0 JDK 11 (if you want to run GraalVM native image tests)
2525

2626
=== Windows Notes
@@ -77,9 +77,30 @@ npm install
7777
3. Initialize cache for clj-kondo so it can lint against your dependencies
7878
+
7979
----
80-
bb ./script/lint.clj
80+
bb lint
8181
----
8282

83+
== Babashka Tasks
84+
85+
We make use of babashka tasks for development related commands.
86+
87+
To see all available tasks with a short description run:
88+
----
89+
bb tasks
90+
----
91+
92+
To run a task, for example, the `lint` task:
93+
----
94+
bb lint
95+
----
96+
97+
Usage help for a task is requested via `--help`, for example:
98+
----
99+
bb lint --help
100+
----
101+
102+
Tasks are described throughout this document.
103+
83104
== Code Generation
84105
Rewrite-clj v0 used a version of potemkin import-vars.
85106
Potemkin import-vars copies specified vars from a specified namespace to the current namespace at load time.
@@ -121,15 +142,15 @@ At this time, we don't handle destructuring in arglists, and will throw unless a
121142
To generate target source from templates run:
122143
[source,shell]
123144
----
124-
bb script/apply_import_vars.clj gen-code
145+
bb apply-import-vars gen-code
125146
----
126147
You are expected to review the generated changes and commit the generated source to version control.
127148
We don't link:#linting[lint] templates, but we do lint the generated code.
128149

129150
To perform a read-only check, run:
130151
[source,shell]
131152
----
132-
bb script/apply_import_vars.clj check
153+
bb apply-import-vars check
133154
----
134155
The check command will exit with 0 if no changes are required, otherwise it will exit with 1.
135156
Our build script will run the check command and fail the build if there are any pending changes that have not been applied.
@@ -141,7 +162,7 @@ Your personal preference will likely be different, but during maintenance and re
141162
For Clojure, I open a shell terminal window and run:
142163

143164
----
144-
bb ./script/clj_watch.clj
165+
bb test-clj-watch
145166
----
146167

147168
This launches https://github.com/lambdaisland/kaocha[kaocha] in watch mode.
@@ -150,7 +171,7 @@ This launches https://github.com/lambdaisland/kaocha[kaocha] in watch mode.
150171
For ClojureScript, I open a shell terminal window and run:
151172

152173
----
153-
bb ./script/cljs_watch.clj
174+
bb test-cljs-watch
154175
----
155176

156177
This launches https://figwheel.org/[fighweel main].
@@ -169,7 +190,7 @@ At the time of this writing draw.io does not remember export settings, so you'll
169190
We use https://github.com/lread/test-doc-blocks[test-doc-blocks] to verify that code blocks in our documentation are in good working order.
170191

171192
----
172-
bb ./script/doc_tests.clj
193+
bb test-doc
173194
----
174195

175196
This generates tests for doc code blocks and then runs them under Clojure and ClojureScript.
@@ -180,7 +201,7 @@ Before pushing, you likely want to mimic what is run on each push via GitHub Act
180201
=== Unit tests
181202
Unit tests are run via:
182203
----
183-
bb ./script/ci_tests.clj
204+
bb ci-unit-tests
184205
----
185206

186207
=== Native image tests
@@ -189,45 +210,49 @@ We also verify that rewrite-clj functions as expected when compiled via Graal's
189210
1. Tests and library natively compiled:
190211
+
191212
----
192-
bb ./script/pure_native_test.clj
213+
bb test-native
193214
----
194215
2. Library natively compiled and tests interpreted via sci
195216
+
196217
----
197-
bb ./script/sci_native_test.clj
218+
bb test-native-sci
198219
----
199220

200221
[#libs-test]
201222
=== Libs test
202223
To try to ensure our changes to rewrite-clj do not inadvertently break existing popular libraries, we run their tests, or a portion thereof, against rewrite-clj.
203-
204224
----
205-
bb ./script/libs_tests.clj run
225+
bb test-libs run
206226
----
207227

208228
See link:../README.adoc#used-in[README] for current libs we test against.
209229

210230
Additional libs are welcome.
211231

232+
To see a list of available libs we currently test against:
233+
----
234+
bb test-libs list
235+
----
236+
212237
If you are troubleshooting locally, and want to only run specific tests, you can specify which ones you'd like to run.
213238
For example:
214239

215240
----
216-
bb ./script/libs_tests.clj run cljfmt zprint
241+
bb test-libs run cljfmt zprint
217242
----
218243

219-
Running current versions of libs is recommended, but care must be taken when updating.
244+
Updating the test-libs script to run against current versions of libs is recommended, but care must be taken when updating.
220245
We want to make sure we are patching correctly to use rewrite-clj v1 and running a lib's tests as intended.
221246

222247
To check for outdated libs:
223248

224249
----
225-
bb ./script/libs_test.clj outdated
250+
bb test-libs outdated
226251
----
227252

228253
Notes:
229254

230-
* `libs_tests.clj` was developed on macOS and is run on CI under Linux only under JDK 11 only.
255+
* The `test-libs` task was developed on macOS and is run on CI under Linux only under JDK 11 only.
231256
We can expand variations at some later date if there is any value to it.
232257
* We test the current HEAD of rewrite-clj v1 against specific versions (latest at the time of this writing) of libs.
233258
* We patch lib deps and sometimes code (ex. `require` for `rewrite-cljc` becomes `rewrite-clj`).
@@ -238,7 +263,7 @@ We can expand variations at some later date if there is any value to it.
238263

239264
To see what new dependencies are available, run:
240265
----
241-
bb ./script/outdated.clj
266+
bb outdated
242267
----
243268

244269
We use https://github.com/liquidz/antq[antq] which also checks `pom.xml`.
@@ -258,12 +283,12 @@ We use https://github.com/borkdude/clj-kondo[clj-kondo] for linting rewrite-clj
258283
We fail the build on any lint violations.
259284
The CI server runs:
260285
----
261-
bb ./script/lint.clj
286+
bb lint
262287
----
263288
and you can too. The lint script will build the clj-kondo cache when it is missing or stale.
264289
If you want to force a rebuild of the cache run:
265290
----
266-
bb ./script/lint.clj --rebuild-cache
291+
bb lint --rebuild-cache
267292
----
268293

269294
https://github.com/borkdude/clj-kondo/blob/master/doc/editor-integration.md[Integrate clj-kondo into your editor] to catch mistakes as they happen.
@@ -275,9 +300,11 @@ To generate reports on differences between rewrite-clj v0, rewrite-cljs and
275300
rewrite-clj v1 APIs, run:
276301

277302
----
278-
bb ./script/gen_api_diffs.clj
303+
bb doc-api-diffs
279304
----
280305

306+
WARNING: This task currently needs love, see https://github.com/clj-commons/rewrite-clj/issues/132[#132].
307+
281308
Run this script manually on an as-needed basis, and certainly before any official release.
282309
Generated reports are to be checked in to version control.
283310

@@ -294,7 +321,7 @@ Before a release, it can be comforting to preview what docs will look like on ht
294321

295322
Limitations
296323

297-
* This script should be considered experimental, I have only tested running on macOS, but am fairly confident it will work on Linux.
324+
* This task should be considered experimental, I have only tested running on macOS, but am fairly confident it will work on Linux.
298325
Not sure about Windows at this time.
299326
* You have to push your changes to GitHub to preview them.
300327
This allows for a full preview that includes any links (source, images, etc) to GitHub.
@@ -304,7 +331,7 @@ This works fine from branches and forks - in case you don't want to affect your
304331

305332
To start the local cljdoc docker container:
306333
----
307-
bb ./script/cljdoc_preview.clj start
334+
bb cljdoc-preview start
308335
----
309336

310337
The local cljdoc server allows your ingested docs to be viewed in your web browser.
@@ -315,7 +342,7 @@ The start command also automatically checks docker hub for any updates so that o
315342

316343
To ingest rewrite-clj API and docs into the local cljdoc database:
317344
----
318-
bb ./script/cljdoc_preview.clj ingest
345+
bb cljdoc-preview ingest
319346
----
320347

321348
The ingest command automatically publishes rewrite-clj to your local maven repository (cljdoc only works with published jars).
@@ -327,7 +354,7 @@ Repeat these steps any time you want to preview changes.
327354

328355
To open a view to the ingested docs in your default web browser:
329356
----
330-
bb ./script/cljdoc_preview.clj view
357+
bb cljdoc-preview view
331358
----
332359

333360
If you have just run the start command, be a bit patient, the cljdoc server can take a few moments to start up - especially on macOS due to poor file sharing performance.
@@ -336,7 +363,7 @@ If you have just run the start command, be a bit patient, the cljdoc server can
336363

337364
When you are done, you'll want to stop your docker container:
338365
----
339-
bb ./script/cljdoc_preview.clj stop
366+
bb cljdoc-preview stop
340367
----
341368

342369
This will also delete temporary files created to support your preview session, most notably the local cljdoc database.
@@ -347,12 +374,16 @@ Note that NO cleanup is done for any rewrite-clj artifacts published to your loc
347374

348375
If you forget where you are at with your docker containers, run:
349376
----
350-
bb ./script/cljdoc_preview.clj status
377+
bb cljdoc-preview status
351378
----
352379

353380
== Code Coverage
354381

355-
We use https://github.com/cloverage/cloverage[cloverage] via https://github.com/lambdaisland/kaocha[kaocha] to generate code coverage reports.
382+
We use https://github.com/cloverage/cloverage[cloverage] via https://github.com/lambdaisland/kaocha[kaocha] to generate code coverage reports via:
383+
----
384+
bb test-coverage
385+
----
386+
356387
Our CI service is setup to automatically generate then upload reports to https://codecov.io[CodeCov].
357388

358389
We have no specific goals for code coverage, but new code is generally expected to have tests.
@@ -365,5 +396,5 @@ We honor current and past contributors to rewrite-clj in our README file.
365396
To update contributors, update `doc/contributors.edn` then run:
366397

367398
----
368-
clojure -M:update-readme
399+
bb doc-update-readme
369400
----

doc/04-maintainer-guide.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ To run the change log validation locally:
4141

4242
[source,shell]
4343
----
44-
bb script/release.clj validate
44+
bb ci-release validate
4545
----
4646

4747
If you so wish, you can also locally run all steps up to, but not including, deploy via:
4848

4949
[source,shell]
5050
----
51-
bb script/release.clj prep
51+
bb release prep
5252
----
5353
Be aware though that you will NOT want to check in changes `prep` makes to `CHANGELOG.adoc`, `pom.xml` and `01-user-guide.adoc`.
5454

0 commit comments

Comments
 (0)