Skip to content

Commit 45cabc0

Browse files
committed
Add support for the Bun and pnpm package managers
1 parent b7ede4b commit 45cabc0

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

src/main/clojure/cljs/cli.clj

+3-3
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ generic - the combinations must be explicitly supported"}
638638
:doc (str "Set the output directory to use. If "
639639
"supplied, cljsc_opts.edn in that directory "
640640
"will be used to set ClojureScript compiler "
641-
"options") }
641+
"options")}
642642
["-w" "--watch"] {:group ::compile :fn watch-opt
643643
:arg "paths"
644644
:doc (str "Continuously build, only effective with the "
@@ -649,7 +649,7 @@ generic - the combinations must be explicitly supported"}
649649
:doc "Set the output compiled file"}
650650
["--deps-cmd"] {:group ::compile :fn deps-cmd-opt
651651
:arg "string"
652-
:doc "Set the node dependency manager. Only npm or yarn supported"}
652+
:doc "Set the node dependency manager. Only npm, bun, pnpm, and yarn are supported"}
653653
["-O" "--optimizations"] {:group ::compile :fn optimize-opt
654654
:arg "level"
655655
:doc
@@ -661,7 +661,7 @@ generic - the combinations must be explicitly supported"}
661661
:doc
662662
(str "The JavaScript target. Configures environment bootstrap and "
663663
"defaults to browser. Supported values: node or nodejs, "
664-
"webworker, bundle, none") }
664+
"webworker, bundle, none")}
665665
["-ro" "--repl-opts"] {:group ::main&compile :fn repl-env-opts-opt
666666
:arg "edn"
667667
:doc (str "Options to configure the repl-env, can be an EDN string or "

src/main/clojure/cljs/closure.clj

+8-2
Original file line numberDiff line numberDiff line change
@@ -2623,7 +2623,11 @@
26232623
(let [proc (-> (ProcessBuilder.
26242624
(into (cond->>
26252625
[deps-cmd
2626-
({"npm" "install" "yarn" "add"} deps-cmd)
2626+
({"npm" "install"
2627+
"bun" "add"
2628+
"pnpm" "add"
2629+
"yarn" "add"}
2630+
deps-cmd)
26272631
"@cljs-oss/module-deps"]
26282632
util/windows? (into ["cmd" "/c"]))
26292633
(map (fn [[dep version]] (str (name dep) "@" version)))
@@ -2667,7 +2671,9 @@
26672671
(string/replace "CLJS_TARGET" (str "" (when target (name target))))
26682672
(string/replace "MAIN_ENTRIES" main-entries)
26692673
(string/replace "FILE_SEPARATOR" (escape-backslashes File/separator)))
2670-
proc (-> (ProcessBuilder. ["node" "--eval" code])
2674+
proc (-> (ProcessBuilder. (case (:deps-cmd opts)
2675+
"bun" ["bun" "--eval" code]
2676+
["node" "--eval" code]))
26712677
.start)
26722678
is (.getInputStream proc)
26732679
iw (StringWriter. (* 16 1024 1024))

src/test/clojure/cljs/foreign/node_test.clj

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
([f]
1212
(test-util/delete-node-modules)
1313
(doseq [f (map io/file
14-
["package.json" "package-lock.json" "yarn.lock"
15-
"yarn-error.log"])]
14+
["package.json" "package-lock.json" "bun.lockb"
15+
"pnpm-lock.yaml" "yarn.lock" "yarn-error.log"])]
1616
(when (.exists f)
1717
(io/delete-file f)))
1818
(f)))
@@ -21,7 +21,7 @@
2121
([lib version]
2222
(install :npm lib version))
2323
([cmd lib version]
24-
(let [action ({:npm "install" :yarn "add"} cmd)]
24+
(let [action ({:npm "install" :bun "add" :pnpm "add" :yarn "add"} cmd)]
2525
(sh/sh (name cmd) action (str lib "@" version)))))
2626

2727
(test/use-fixtures :once cleanup)

0 commit comments

Comments
 (0)