Skip to content

Commit

Permalink
fetch deps separately from running user code (#285)
Browse files Browse the repository at this point in the history
* fetch deps separately from running user code
* Use public DNS for fetch-deps
  • Loading branch information
Sohalt authored Sep 13, 2024
1 parent f521c08 commit 9d4d47f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/nextjournal/start_command.clj
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
(ns nextjournal.start-command
(:require [clojure.string :as str]))

(def garden-nrepl-sha "d64532bf7c16565b0dfc825bc27eafdb453c1a61")

(defn fetch-deps-command [{:as opts
:keys [garden-alias sdeps]}]
(filterv some?
["clojure"
"-P"
"-Srepro"
"-Sdeps" (pr-str (merge sdeps {:deps {'io.github.nextjournal/garden-nrepl {:git/sha garden-nrepl-sha}}}))
"-J-Dclojure.main.report=stdout"
(when-some [extra-aliases (get garden-alias :nextjournal.garden/aliases)]
(when-not (every? keyword? extra-aliases) (throw (ex-info "`:nextjournal.garden/aliases` must be a vector of keywords" opts)))
(str "-A" (str/join extra-aliases)))
"-A:nextjournal/garden"]))

(defn start-command [{:as opts
:keys [skip-inject-nrepl garden-alias sdeps]
:or {sdeps {}}}]
(let [sdeps (cond-> sdeps
(not skip-inject-nrepl) (merge {:deps {'io.github.nextjournal/garden-nrepl {:git/sha "d64532bf7c16565b0dfc825bc27eafdb453c1a61"}}
(not skip-inject-nrepl) (merge {:deps {'io.github.nextjournal/garden-nrepl {:git/sha garden-nrepl-sha}}
:aliases {:nextjournal/garden-nrepl {:exec-fn 'nextjournal.garden-nrepl/start!}}}))]
(filterv some?
["clojure"
Expand Down

0 comments on commit 9d4d47f

Please sign in to comment.