deps-new 2026-08-04

Hi (I posted this accidentally in clojure-dev, but deleted it). If I want to run a post-process application (i.e., clojure-lsp clean-ns), would I craft something in the post-process-fn to shell out to the terminal and invoke that utility?

Since clojure-lsp clean-ns needs to be in the directory of the project to operate in, would :artifact/id be a safe bet to use as the name of the directory to cd into?

{{target-dir}} would be safer, in case someone overrides where the project should be created.

👍 1

https://github.com/seancorfield/deps-new/blob/develop/doc/templates.md has an example of running the tests in a subprocess for post-process-fn.

works great...

#_{:clojure-lsp/ignore [:clojure-lsp/unused-public-var]}
(defn post-process-fn
  [_edn {:keys [target-dir] :as data}]
  (println (str "Executing 'clojure-lsp clean-ns' in '" target-dir "'."))
  (sh/sh "clojure-lsp" "-p" target-dir "clean-ns")
  (println "All done. Enjoy your new project!"))

👍🏻 1

Assumes clojure-lsp binary is on your path but, yeah, it's that easy!

Yeah, but since it's my system and my projects 🙂

Caveat programmator

dammit, you triggered my ocd 😉

(defn ^:private command-exists?
  [command]
  (zero? (:exit (sh/sh "sh" "-c" "command -v \"$1\" > /dev/null 2>&1" "sh" command))))

#_{:clojure-lsp/ignore [:clojure-lsp/unused-public-var]}
(defn post-process-fn
  [_edn {:keys [target-dir] :as data}]
  (when (command-exists? "clojure-lsp")
    (println (str "Executing 'clojure-lsp clean-ns' in '" target-dir "'."))
    (let [{:keys [exit out err] :as result} (sh/sh "clojure-lsp" "-p" target-dir "clean-ns")]
      (when-not (zero? exit)
        (throw (ex-info "clojure-lsp clean-ns has failed!" {:exit exit :stdout out :stderr err})))))
  (println "All done. Enjoy your new project!"))

You could always fallback to a Clojure invocation of clojure-lsp based on either an alias in the generated project or specifying the dependency in create-basis 🙂

Tee hee 😄

we're getting deep into the woods here...I think I'll just take a step back and have a breath 🙂

tis good enough 🙂

My email .sig:

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)
(although I believe it is a misattribution)

👍 1