Skip to content

redstarssystems/apptemplate

Repository files navigation

Application project template

Intro

This template helps you to quick start new app project using clojure deps cli and deps-new.

This template provides:

  • project control using babashka tasks;

  • building Clojure project using tools-build;

  • editor configuration via .editorconfig file;

  • configured clj-kondo linter;

  • configured cljstyle formatter;

  • run tests using kaocha.

This template will give you the following basic project workflow:

mike@mbp02 ✗ bb tasks
The following tasks are available:

clean        Clean target folder
build        Build standalone executable uberjar file
run          Run application (-main function)
install      Install this app
deploy       Deploy this app
test         Run project tests
repl         Run Clojure repl
outdated     Check for outdated dependencies
outdated:fix Check for outdated dependencies and fix
format       Format source code
lint         Lint source code
javac        Compile java sources
standalone   Create a standalone application with bundled JDK (using jlink, JDK 9+)
requirements Install project requirements

See also:

Usage

Before run this template ensure you have installed deps-new and babashka (see Install prerequisites ).

Example: to generate new app project for artifact com.example/app01 run:

clojure -Sdeps '{:deps {org.rssys/apptemplate {:git/tag "0.1.1" :git/sha "215be27" :git/url "https://github.com/redstarssystems/apptemplate.git"}}}' -Tnew create :template org.rssys/apptemplate :name com.example/app01

or clone this project and run from its folder:

clojure -Sdeps '{:deps {org.rssys/apptemplate {:local/root "."}}}' -Tnew create :template org.rssys/apptemplate :name com.example/app01 :target-dir ../app01
Note
Please, see README.adoc in a root folder of created project.

To configure project workflow use scripts: tasks/src/*, bb.edn and build.clj.

Important
tasks/src/* only for Babashka tasks code.
bb.edn file should be as minimal as possible.
  • tasks/src/build/config.clj - for project configuration;

  • tasks/src/build/init.clj - for tasks internal constants and helpers;

  • tasks/src/build/tasks.clj - for tasks code.

Install prerequisites

All these tools you need to install only once.

  1. Install clojure deps cli tools version 1.10.3.1069+

    1. MacOS

      brew install clojure/tools/clojure
    2. Linux

      Ensure that the following dependencies are installed in OS: bash, curl, rlwrap, and Java.

      curl -O https://download.clojure.org/install/linux-install-1.10.3.1069.sh
      chmod +x linux-install-1.10.3.1069.sh
      sudo ./linux-install-1.10.3.1069.sh
  2. Install latest deps-new

    clojure -Ttools install io.github.seancorfield/deps-new '{:git/tag "v0.4.9"}' :as new

    Tool will be installed in ~/.gitlibs/libs/

  3. Install babashka v0.4.0+

    1. MacOS

      brew install borkdude/brew/babashka
    2. Linux

      sudo bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)

License

Copyright © 2021 Mike Ananev
Distributed under the Eclipse Public License 1.0 or (at your option) any later version.

About

Application project template for Clojure

Resources

License

Stars

Watchers

Forks

Packages

No packages published