Skip to content
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

Add support for the Bun and pnpm package managers. #231

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/clojure/cljs/cli.clj
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ generic - the combinations must be explicitly supported"}
:doc (str "Set the output directory to use. If "
"supplied, cljsc_opts.edn in that directory "
"will be used to set ClojureScript compiler "
"options") }
"options")}
["-w" "--watch"] {:group ::compile :fn watch-opt
:arg "paths"
:doc (str "Continuously build, only effective with the "
Expand All @@ -649,7 +649,7 @@ generic - the combinations must be explicitly supported"}
:doc "Set the output compiled file"}
["--deps-cmd"] {:group ::compile :fn deps-cmd-opt
:arg "string"
:doc "Set the node dependency manager. Only npm or yarn supported"}
:doc "Set the node dependency manager. Only npm, bun, pnpm, and yarn are supported"}
["-O" "--optimizations"] {:group ::compile :fn optimize-opt
:arg "level"
:doc
Expand All @@ -661,7 +661,7 @@ generic - the combinations must be explicitly supported"}
:doc
(str "The JavaScript target. Configures environment bootstrap and "
"defaults to browser. Supported values: node or nodejs, "
"webworker, bundle, none") }
"webworker, bundle, none")}
["-ro" "--repl-opts"] {:group ::main&compile :fn repl-env-opts-opt
:arg "edn"
:doc (str "Options to configure the repl-env, can be an EDN string or "
Expand Down
10 changes: 8 additions & 2 deletions src/main/clojure/cljs/closure.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2623,7 +2623,11 @@
(let [proc (-> (ProcessBuilder.
(into (cond->>
[deps-cmd
({"npm" "install" "yarn" "add"} deps-cmd)
({"npm" "install"
"bun" "add"
"pnpm" "add"
"yarn" "add"}
deps-cmd)
"@cljs-oss/module-deps"]
util/windows? (into ["cmd" "/c"]))
(map (fn [[dep version]] (str (name dep) "@" version)))
Expand Down Expand Up @@ -2667,7 +2671,9 @@
(string/replace "CLJS_TARGET" (str "" (when target (name target))))
(string/replace "MAIN_ENTRIES" main-entries)
(string/replace "FILE_SEPARATOR" (escape-backslashes File/separator)))
proc (-> (ProcessBuilder. ["node" "--eval" code])
proc (-> (ProcessBuilder. (case (:deps-cmd opts)
"bun" ["bun" "--eval" code]
["node" "--eval" code]))
.start)
is (.getInputStream proc)
iw (StringWriter. (* 16 1024 1024))
Expand Down
6 changes: 3 additions & 3 deletions src/test/clojure/cljs/foreign/node_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
([f]
(test-util/delete-node-modules)
(doseq [f (map io/file
["package.json" "package-lock.json" "yarn.lock"
"yarn-error.log"])]
["package.json" "package-lock.json" "bun.lockb"
"pnpm-lock.yaml" "yarn.lock" "yarn-error.log"])]
(when (.exists f)
(io/delete-file f)))
(f)))
Expand All @@ -21,7 +21,7 @@
([lib version]
(install :npm lib version))
([cmd lib version]
(let [action ({:npm "install" :yarn "add"} cmd)]
(let [action ({:npm "install" :bun "add" :pnpm "add" :yarn "add"} cmd)]
(sh/sh (name cmd) action (str lib "@" version)))))

(test/use-fixtures :once cleanup)
Expand Down