A feature rich deps.edn file with a collection of aliases for Clojure projects. Include aliases with common options for convienience and to minimise the amount of cognitive load required to remember how to use aliases. Inspiration taken from seancorfield/dot-clojure.
Fork this repository and clone your fork to the ~/.clojure directory in the root of your home directory for the operating system in use.
git clone your-fork-url ~/.clojureAlternately, manually copy the deps.edn file or specific sections of that file to ~/.clojure/deps.edn, creating that file if it does not exist.
The configuration and aliases will be included in any deps.edn project. Any directory containing a deps.edn project is considered a Clojure project. Project specific deps.edn files containing an empty map, {} or a map with any additional configuration. Either way, all the configuration from ~/.clojure/deps.edn will be available (unless over-ridden by project specific settings).
The collection of aliases is regularly reviewed and expanded upon and suggestions are most welcome.
The versions of libraries are manually updated at least once per month using the :outdated alias and a new version of the deps.edn file pushed to this repository.
clojure -A:outdatedTo automatically update library versions for aliases, then use the :outdated-update alias. It is prudent to review what has been updated before using the results.
clojure -A:outdated-updateHere is a summary of the aliases included so far.
Please read the deps.edn file to see the specific configuration for each alias.
Create and update projects from deps, leiningen and boot templates with clj-new
:new
Create a new project: clojure -A:new template-name domain/namespace
Run project: clojure -m myname.myapp
Rebel readline provides a feature rich REPL experience, far beyond the basic clojure and clj commands.
rebel- run a Clojure REPLrebel-cljs- run the default ClojureScript REPL, eg. Nashorn
:repl/help in the REPL for help and available commands. :repl/quit to close the REPL.
Look up Java Class and method definitions, eg. cider-find-var in Emacs
Requires: Java sources installed locally, examples from Ubuntu package install locations
:java-8-source:java-11-source
Unti test libraries, contracts and generative testing
clojure-testrequires no alias as it is a part of the Clojure jar file.:spec- define contracts for function definitions and data structures:spec2- under active development:expectations- test framework
Run expectations with cognitect test runner: clojure -A:expectations:test-runner-cognitect
Tools to run unit tests in a project which are defined under test path.
Run clojure with the specific test runner alias: clojure -A:test-runner-alias
:test-runner-cognitect- Cognitect test-runner:test-runner-midje:test-runner-eftest- fast and pretty test runner:test-runner-kaocha- comprehensive test runner for Clojure/Script
:lint- comprehensive and fast lint tool:lint-eastwood- classic lint tool for Clojure:idiom-check- checking for idiomatic Clojure code with Kibit
Manage versions for maven and git dependencies
- :outdated - report newer dependencies (git and maven)
- :outdated-update - update all dependencies (git and maven)
- :outdated-ancient - check for newer dependencies (maven)
:hot-load-deps- Add jar dependencies into a running REPL.
Require the add-lib function to include a maven style dependency
(require '[clojure.tools.deps.alpha.repl :refer [add-lib]])
(add-lib 'domain/library {:mvn/version "RELEASE"})
Require clojure.tools.gitlibs namesapace to hot load dependencies from a Git repository
(require '[clojure.tools.gitlibs :as gitlibs])
(defn load-master [library]
(let [git (str "https://github.com/" library ".git")]
(add-lib library {:git/url git :sha (gitlibs/resolve git "master")})))
(load-master 'clojure/tools.trace)
Create Graphviz graphs of project and library dependencies
Morpheus creates grahps of project vars and their relationships
:graph-vars- generate graph of vars in a project as a .dot file:graph-vars-png- generate graph of vars in a project as a .png file usingsrcandtestpaths:graph-vars-svg- generate graph of vars in a project as a .svg file usingsrcandtestpaths
Install Graphviz to generate PNG and SVG images. Or use the Edotor website to convert .dot files to PNG or SVG images and select different graph layout engines.
Vizns creates graphs of relationships between library dependencies and project namespaces
:graph-deps:graph-deps-png- generate a single deps-graph png image
Other options:
clj -A:graph-deps navigate# navigable folder of SVGsclj -A:graph-deps single# deps-graph.dot fileclj -A:graph-deps single -o deps-graph.png -f pngclj -A:graph-deps single -o deps-graph.svg -f svgclj -A:graph-deps single --show# View graph without saving
- :build-depstar - build jars, uberjars for deps.edn projects
clojure -A:depstar -m hf.depstar.jar MyLib.jar
clojure -A:depstar -m hf.depstar.uberjar MyProject.jar
- :build-uberdeps - uberjar builder
- :benchmark Adhoc performance testing the the REPL
clojure -A:rebel:bench
(require '[criterium.core :refer [bench quick-bench]])
(bench (adhoc-expression))
Performance test a project in the REPL
clojure -A:rebel:bench
(require '[practicalli/namespace-name]) ; require project code
(in-ns 'practicalli/namespace-name)
(quick-bench (project-function args))
- :measure - memory usage In the REPL:
(require '[clj-memory-meter.core :as memory-meter])
(memory-meter/measure (your-expression))
