Skip to content

video: introduce Clojure CLI and Practicalli workflow #472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
practicalli-johnny opened this issue Mar 12, 2025 · 0 comments
Open

video: introduce Clojure CLI and Practicalli workflow #472

practicalli-johnny opened this issue Mar 12, 2025 · 0 comments
Assignees

Comments

@practicalli-johnny
Copy link
Contributor

practicalli-johnny commented Mar 12, 2025

Video scripts to evolve:

  • Introducing Clojure CLI
  • TODO Practicalli Clojure Workflow - "There are many Clojure Workflows.. and this one is mine"

Clojure CLI is installed along with Java (21) as the host platform. Practicalli Clojure CLI config is the user configuration, containing a wide range of aliases that extend the features of Clojure CLI.

Create a new project using the app template or clone practicalli/clojure-app-template

clojure -T:project/create :template app :name practicalli/gameboard/service

The :project/create alias is defined in the Practicalli Clojure CLI config.

clojure -X:deps aliases lists the available aliases in the current project and the Clojure user configuration

Add a dev/user.clj file to the root of the created project.

The dev/user.clj file configures the REPL during startup, adding library hotload, namespace reload and portal data inspector

copy dev/user.clj from practicalli/clojure-app-template

Start a rich terminal UI repl prompt with a additional dev tools

clojure -T:project/create :template app :name practicalli/gameboard

Start a REPL via the command line, using an alias from practicalli/clojure-deps-edn

clojure -M:repl/reloaded

Library dependencies for Rebel and other development tools are already cached in the local maven repository, so startup should be very quick.

Although Clojure code can be evaluated in the terminal UI prompt for the REPL, it is more effective to use an editor connected to the REPL

In this video I am using Emacs, although the process is conceptually the same for Neovim, VS Code, Sublime Text and any other Clojure aware editor.

Start Emacs and connect to the running REPL

A Clojure file is opened from the project previously created.

The deps.edn file contains dependency and path configuration, along with some optional aliases.

The :deps keywork defines the library names and versions the project depends upon. An org.clojure/clojure library is included to set a specific version of Clojure to use. Otherwise the Clojure version shipped with the Clojure CLI tool is used.

The project is going to serve an API, so a server will be defined

Open the src/practicalli/gameboard/service.clj file in the editor

Create a rich comment to contain the code as we experiment. Editors supporting Clojure LSP can use the snippets to create a rich comment.

(comment )

look up a library for a http server (using find-deps either from an alias or via the dev/user.clj file)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Options
Development

No branches or pull requests

1 participant