-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move into separate repo from thheller/shadow-cljs
prep for adding full launcher functionality
- Loading branch information
0 parents
commit 06eab91
Showing
4 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
target/ | ||
node_modules/ | ||
checkouts/ | ||
pom.xml | ||
pom.xml.asc | ||
*.iml | ||
*.jar | ||
*.js.map | ||
*.class | ||
.cpcache | ||
.cljs-cache | ||
.shadow-cljs | ||
.cljs-repl | ||
.cljs_node_repl | ||
.idea | ||
.lein-* | ||
.nrepl-* | ||
/tmp | ||
.DS_Store | ||
yarn.lock | ||
package-lock.json | ||
/package.json | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This is a utility used by `shadow-cljs` to resolve/download dependencies. | ||
|
||
https://github.com/thheller/shadow-cljs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
(defproject shadow-cljs/launcher "1.2.0" | ||
:description "CLJS development tools" | ||
:url "https://github.com/thheller/shadow-cljs" | ||
:dependencies | ||
[[org.clojure/clojure "1.9.0"] | ||
[com.cemerick/pomegranate "1.0.0"] | ||
[org.slf4j/slf4j-nop "1.7.25"]] | ||
|
||
:source-paths | ||
["src/main"] | ||
|
||
:profiles | ||
{:uberjar | ||
{:aot [shadow.cljs.launcher.deps] | ||
:main shadow.cljs.launcher.deps}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
(ns shadow.cljs.launcher.deps | ||
"lightweight launcher that just downloads jars and builds a classpath" | ||
(:gen-class) | ||
(:require | ||
[clojure.java.io :as io] | ||
[cemerick.pomegranate.aether :as aether])) | ||
|
||
(defn transfer-listener | ||
[{:keys [type error resource] :as info}] | ||
(let [{:keys [name repository]} resource] | ||
(binding [*out* *err*] | ||
(case type | ||
:started (println "Retrieving" name "from" repository) | ||
;; :progressed | ||
;; :succeeded | ||
:corrupted (when error (println (.getMessage error))) | ||
nil)))) | ||
|
||
(defn -main [] | ||
(try | ||
(let [{:keys [cache-root repositories proxy local-repo dependencies mirrors version] | ||
:or {dependencies [] | ||
repositories {} | ||
cache-root ".shadow-cljs"} | ||
:as config} | ||
(read *in*)] | ||
|
||
(println "shadow-cljs - updating dependencies") | ||
|
||
;; FIXME: resolve conflicts? | ||
(let [resolve-args | ||
(-> {:coordinates | ||
dependencies | ||
:repositories | ||
(merge aether/maven-central {"clojars" "https://clojars.org/repo"} repositories) | ||
:transfer-listener | ||
transfer-listener} | ||
(cond-> | ||
mirrors | ||
(assoc :mirrors mirrors) | ||
proxy | ||
(assoc :proxy proxy) | ||
local-repo | ||
(assoc :local-repo local-repo) | ||
)) | ||
|
||
deps | ||
(apply aether/resolve-dependencies (into [] (mapcat identity) resolve-args)) | ||
|
||
files | ||
(into [] (map #(.getAbsolutePath %)) (aether/dependency-files deps)) | ||
|
||
result | ||
{:dependencies dependencies | ||
:version version | ||
:files files | ||
:deps deps} | ||
|
||
classpath-file | ||
(io/file cache-root "classpath.edn")] | ||
|
||
(io/make-parents classpath-file) | ||
|
||
(spit classpath-file (pr-str result))) | ||
|
||
(println "shadow-cljs - dependencies updated")) | ||
|
||
(catch Exception e | ||
(println "shadow-cljs - dependency update failed -" (.getMessage e)) | ||
(System/exit 1) | ||
))) |