• Stars
    star
    615
  • Rank 72,884 (Top 2 %)
  • Language
    Clojure
  • License
    Apache License 2.0
  • Created over 6 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

My .clojure/deps.edn file

dot-clojure

This is my personal .clojure/deps.edn file providing useful clj aliases drawn from a variety of projects. It is published to GitHub so I can keep all my computers sync'd up -- and to provide a range of examples that folks new to the Clojure CLI might find helpful.

Several git dependencies here assume you have at least Clojure CLI 1.11.1.1273!

In addition, my .clojure/tools/ folder is also here, containing the tools that I've installed globally, via the latest Clojure CLI (was 1.11.1.1273 when I last updated this) -- see Tool installation and invocation in the Deps and CLI Reference. As I add global tools, I am removing them as aliases.

The main alias I use here is :dev/repl which starts various combinations of REPL tooling. See The :dev/repl Alias below for more details.

Since it is my personal file, it may make assumptions about my own environment. For example, it uses "RELEASE" for several tools so I can always get the latest stable version of any dev/test tool I use. I make no effort at backward-compatibility and may add, delete, or change aliases as they benefit me personally. Caveat Programmer!

If you want a really well-documented, well-maintained alternative that actually tracks versions of tools, I would recommend you use the Practicalli Clojure deps.edn project instead!

With that caveat out of the way, here is some basic documentation about my tools and aliases (there are additional examples in the comments in the deps.edn file itself). Note: I have recently cleaned this file up and removed a lot of aliases I no longer use!

TL;DR: add the following dependency and then start a REPL with clj -M:dev/repl (optionally with other aliases to bring in more tooling):

:aliases
{:dev/repl
 {:extra-deps
  {io.github.seancorfield/dot-clojure
   {:git/tag "v1.0.2"
    :git/sha "6a3f903"}}
  :main-opts ["-e" "((requiring-resolve 'org.corfield.dev.repl/start-repl))"]}}

Basic Tools

These are installed via clojure -Ttools install ... and usable via clojure -T with the tool name.

  • antq -- the outdated dependencies checker:
    • clojure -Tantq outdated -- check the current project's dependencies,
    • clojure -A:deps -Tantq help/doc -- for more information and other functions.
  • clj-watson -- a software composition analysis scanner, based on the National Vulnerability Database: clj-watson
    • clojure -Tclj-watson scan :deps-edn-path '"deps.edn"' :output '"stdout"'
  • new -- the latest version of deps-new to create new CLI/deps.edn projects: [This uses a different (simpler!) templating system to clj-new, below, and therefore does not recognize Leiningen or Boot templates!]
    • clojure -Tnew app :name myname/myapp -- creates a new deps.edn-based application project,
    • clojure -Tnew lib :name myname/mylib -- creates a new deps.edn-based library project,
    • clojure -Tnew template :name myname/mytemplate -- creates a new deps.edn-based template project,
    • clojure -A:somealias -Tnew create :template some/thing :name myname/myapp -- locates a template for some/thing on the classpath, based on :somealias, and uses it to create a new deps.edn-based project,
    • clojure -A:deps -Tnew help/doc -- for more information and other functions.
  • poly -- a recent master version of Polylith's poly tool for working with Polylith projects:
    • clojure -Tpoly shell -- start an interactive Polylith shell,
    • clojure -Tpoly info :loc true -- display information about a Polylith workspace, including lines of code,
    • clojure -Tpoly create c user -- create a user component in a Polylith workspace,
    • clojure -Tpoly test :dev true -- run tests in the dev project context, in a Polylith workspace,
    • clojure -A:deps -Tpoly help/doc -- for more information and other functions.

And the older clj-new tool:

  • clj-new -- the latest stable release of clj-new to create new projects from (Leiningen and other) templates:
    • clojure -Tclj-new app :name myname/myapp -- creates a new deps.edn-based application project (using tools.build for the uberjar),
    • clojure -Tclj-new lib :name myname/mylib -- creates a new deps.edn-based library project (using tools.build for the jar),
    • clojure -Tclj-new template :name myname/mytemplate -- creates a new deps.edn-based template project (using tools.build for the jar),
    • clojure -Tclj-new create :template something :name myname/myapp -- locates a template for something and uses it to create a new project (which might be deps.edn-based or lein-based, depending on the template),
    • clojure -A:deps -Tclj-new help/doc -- for more information and other functions.

More tools will be added to this section over time (as more tools add :tools/usage to their deps.edn files).

Basic Aliases

Deploy jar files (if you don't have a build.clj file):

  • :deploy -- pulls in and runs the latest stable release of Erik Assum's deps-deploy and deploys the specified JAR file to Clojars, based on your pom.xml and the CLOJARS_USERNAME and CLOJARS_PASSWORD environment variables; clojure -X:deploy :artifact '"MyProject.jar"'

There are aliases to pull in various useful testing and debugging tools:

  • :test -- adds both test and src/test/clojure to your classpath and pulls in the latest stable version of test.check
  • :runner -- pulls in Cognitect Labs' test-runner project and runs any tests it can find
  • :eastwood -- pulls in the latest stable release of Eastwood on your src and test folders; use with :test above
  • :check -- pulls in Athos' Check project to compile all your namespaces to check for syntax errors and reflection warnings like lein check
  • :expect -- pulls in the latest stable release of expectations/clojure-test -- the clojure.test-compatible version of Expectations
  • :bench -- pulls in the latest stable release of Criterium for benchmarking your code

There are aliases to pull in and start various REPL-related tools:

  • :dev/repl -- depending on what is on your classpath, start Rebel Readline, with a Socket REPL (if requested -- note that "port 0" will dynamically select an available port and print it out), but SOCKET_REPL_PORT env var and socket-repl-port property override, saves port to .socket-repl-port file for next time;

    • usage:
      • clj -M:portal:dev/repl -- basic REPL with Portal or
      • clojure -M:rebel:dev/repl -- Rebel Readline REPL or
      • clojure -M:rebel:portal:dev/repl -- ...with Portal or
      • clojure -M:nrepl:dev/repl -- basic nREPL server or
      • clojure -M:nrepl:portal:dev/repl -- basic nREPL server with Portal middleware or
      • clojure -M:cider-nrepl:dev/repl -- CIDER nREPL server or
      • clojure -M:cider-nrepl:portal:dev/repl -- CIDER nREPL server with Portal middleware or
    • Also works with Figwheel Main (now that I've started doing ClojureScript!):
      • clojure -M:portal:fig:build:dev/repl or
  • :classes -- adds the classes folder to your classpath to pick up compiled code (e.g., see https://clojure.org/guides/dev_startup_time)

  • :socket -- starts a Socket REPL on port 50505; can be combined with other aliases since this is just a JVM option

  • :rebel -- starts a Rebel Readline REPL

  • :nrepl -- starts a (headless) nREPL server on a random available port; clojure -M:nrepl

  • :cider-nrepl -- starts a (headless) CIDER-enhanced nREPL server on a random available port; clojure -M:cider-nrepl

  • :datomic/dev.datafy -- adds datafy/nav support for Datomic objects via datomic/dev.datafy

  • :dbxray -- adds donut-party/dbxray to help visualize your database structure

  • :jedi-time -- adds datafy/nav support for Java Time objects via jedi-time

  • :portal -- pulls in the latest stable release of the Portal data visualization tool -- see the Portal web site for usage options

  • :reflect -- adds Stuart Halloway's reflector utility (best used with Portal)

There are aliases to pull in specific versions of Clojure:

  • :master -- Clojure 1.12.0-master-SNAPSHOT
  • :1.12 -- Clojure 1.12.0-alpha4
  • :1.11 -- Clojure 1.11.1 -- see changes to Clojure in version 1.11.1
    • :1.11.0 -- Clojure 1.11.0
  • :1.10 -- Clojure 1.10.3
    • :1.10.2 -- Clojure 1.10.2
    • :1.10.1 -- Clojure 1.10.1
    • :1.10.0 -- Clojure 1.10.0
  • :1.9 -- Clojure 1.9.0
  • :1.8 -- Clojure 1.8.0
  • ... back to :1.0 (note: :1.5 is actually Clojure 1.5.1 to avoid a bug in Clojure 1.5.0, and :1.2 is 1.2.1)

Note: the EXPERIMENTAL :add-libs alias has been removed -- use the clojure.repl.deps in Clojure 1.12.0 Alpha 2 or later instead!

The :dev/repl Alias

The :dev/repl alias calls org.corfield.dev.repl/start-repl in the repl.clj file from this repo. That does a number of things (see the start-repl docstring for more details):

  • Optionally, starts a Socket REPL server (with the port selected via an environment variable, a JVM property, or a dot-file created on a previous run).
  • If both Portal and org.clojure/tools.logging are on the classpath, it patch tools.logging to also tap> every log message in a format that Portal understands and can display (usually with the ability to go to the file/line listed in the log entry); call (dev/toggle-logging!) to turn this tap>'ing on and off.
  • If Portal 0.33.0 or later is on the classpath, use the Portal middleware with nREPL (if CIDER or nREPL are on the classpath). If using Portal 0.40.0 or later, this also adds the Portal Notebook middleware.
  • Starts Figwheel Main, if present on the classpath, else
  • Starts Rebel Readline, if present on the classpath, else
  • Starts a CIDER-enhanced nREPL Server, if cider-nrepl is present on the classpath, else
  • Starts an nREPL Server, if present on the classpath.

Note 1: since the repl.clj code uses requiring-resolve, it requires at least Clojure 1.10.0!

Note 2: if the Portal middleware is added to nREPL/CIDER, all evaluated results will be tap>'d (if the Portal UI is open and listening); my VS Code/Calva setup has additional configuration for working with Portal when the middleware is enabled!

Use with Figwheel

If you are doing ClojureScript development with Figwheel (figwheel-main) then you can do something like:

clojure -M:portal:fig:build:dev/repl

You'll get the regular Figwheel build REPL (for ClojureScript, which uses Rebel Readline) and a browser open on your application, plus a Socket REPL on an available port (or whatever your env says, for Clojure evaluation).

Connect to the Socket REPL, write your code as .cljc files, and you'll have the full power of your editor, Portal, and Figwheel! What you evaluate in your editor will be treated as Clojure code (and can be tap>'d into Portal, for example). What you evaluate at the REPL itself will be treated as ClojureScript code (and will affect your application instead).

License

Copyright © 2018-2023 Sean Corfield

Distributed under the Apache Software License version 2.0.

More Repositories

1

honeysql

Turn Clojure data structures into SQL
Clojure
1,760
star
2

next-jdbc

A modern low-level Clojure wrapper for JDBC-based access to databases.
Clojure
752
star
3

deps-new

Create new projects for the Clojure CLI / deps.edn
Clojure
333
star
4

usermanager-example

A little demo web app in Clojure, using Component, Ring, Compojure, Selmer (and a database)
Clojure
325
star
5

build-clj

Common build tasks abstracted into a library.
Clojure
155
star
6

readme

A testing library that turns your README into executable Clojure tests!
Clojure
142
star
7

vscode-calva-setup

My VS Code / Calva / Portal / Joyride setup
Clojure
93
star
8

om-sente

Playground to create Om + Sente test app
JavaScript
46
star
9

jsql

Basic DSL for generating SQL/DDL, formerly java.jdbc.sql and java.jdbc.ddl
Clojure
43
star
10

boot-tools-deps

A Boot task (deps) that wraps tools.deps(.alpha) to read deps.edn files
Clojure
39
star
11

engine

A Clojure library to implement a query -> logic -> updates workflow, to separate persistence updates from business logic, to improve testing etc.
Clojure
22
star
12

clj-soap

Fork of https://bitbucket.org/taka2ru/clj-soap updated to latest Clojure version
Clojure
21
star
13

lein-fregec

A Leiningen plugin to compile Frege (http://www.frege-lang.org) code.
Clojure
20
star
14

atom-chlorine-setup

My Atom / Chlorine setup
Clojure
17
star
15

socket-rebl

A Socket REPL that also submits forms to Cognitect's REBL
Clojure
13
star
16

next.jdbc.xt

Experimental extension of next.jdbc to work with XTDB 2.0 (snapshots)
Clojure
12
star
17

ring-cfml

A version of Ring (Clojure) for CFML
ColdFusion
12
star
18

polylith-external-test-runner

An external (subprocess) test runner for Polylith
Clojure
12
star
19

java-clojure-example

Trivial example to show using Java from Clojure in deps.edn project
Clojure
9
star
20

datamapper

A couple of CFCs from the World Singles data mapper to show how we wrap Clojure (vectors of) hashmaps to present a thin OO veneer to our CFML code.
ColdFusion
8
star
21

liquid-setup

Configuration for the Liquid in-process Clojure editor
Clojure
7
star
22

logging4j2

A Clojure wrapper for log4j2
Clojure
6
star
23

boot-kotlinc

A Kotlin compilation task for Boot
Clojure
6
star
24

macro-day

Code examples I wrote during Amit Rathore's "A day with Clojure macros" training
Clojure
6
star
25

edmund

Edmund is an Event-Driven Model micro-framework for CFML / ColdFusion
ColdFusion
5
star
26

build-uber-log4j2-handler

A conflict handler for log4j2 plugins cache files for the tools.build uber task.
Clojure
5
star
27

avowal

Futures and Promises for modern CFML, inspired by my earlier cfconcurrency library
ColdFusion
3
star
28

datafy-nav-example

Examples of datafy and nav
Clojure
3
star
29

lein-fw1

A Leiningen plugin to create and manage FW/1 projects.
Clojure
3
star
30

cfml-interop

CFML/Clojure interop library extracted from World Singles code and open sourced!
Clojure
3
star
31

clojure-dining-car

A Categorized and Annotated Directory of Clojure Libraries
2
star
32

intro2fp

Code samples for Introduction to Functional Programming talk, cf.Objective() 2011
ColdFusion
2
star
33

cat-genetics

Utilities to help calculate TICA-specific color cat genetics etc
Clojure
2
star
34

clojure-lucee

A toy example of running CFML pages via Lucee as an embedded engine in a Clojure Ring application.
Clojure
2
star
35

lightstuff

Historical archive of Peter Bell's LightBase and LightGen utility framework/code
ColdFusion
2
star
36

orm-blog

A very simple blog/cms built in ColdFusion using Framework 1 and ORM.
ColdFusion
2
star
37

poly-classloader-bug

Repro for a potential classloader bug for poly test
Clojure
1
star
38

dojo-anthem

Team 1's code from the January 2013 San Francisco Clojure Dojo - to play the National Anthem
Clojure
1
star
39

cursive-expectations

Example of using Expectations with Cursive
Clojure
1
star
40

spd1

Introduction to Systematic Program Design Part 1 - some Clojure examples
Clojure
1
star
41

ordered-subset

Clojure
1
star
42

HUnitFrege

A port of HUnit from Haskell to Frege (WIP -- not even compiling yet!)
Frege
1
star
43

cfo2013

Code examples for my cf.Objective() 2013 presentations
ColdFusion
1
star
44

clojure-test

A place to discuss clojure.test concerns and possible enhancements
1
star
45

boot-localrepo

Boot tasks that wrap lein-localrepo functionality
Clojure
1
star
46

seancorfield.github.io

An Architect's View - my blog and personal web site
HTML
1
star
47

polylith-issue146

Repro for the setup-fn problem with the issue-146 branch
Clojure
1
star
48

WeeklyWrongChallenge

The weekly challenge repo for WPW
Clojure
1
star
49

ring-async-bug

SSCCE of Ring with async on Jetty that fails with thread death
Clojure
1
star
50

avaus-tv

Simulation of Avaus-TV prize draw, in Clojure
Clojure
1
star
51

hello-compojure

The Compojure template, but without lein-ring
Clojure
1
star
52

cfbloggers

Clojure scratch code to parse and analyze the feeds at coldfusionbloggers.org
Clojure
1
star