File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -185,6 +185,10 @@ classpath. Classpath-relative paths have prefix of @ or @/")
185185 [cfg path]
186186 (assoc-in cfg [:options :output-to ] path))
187187
188+ (defn- deps-cmd-opt
189+ [cfg deps-cmd]
190+ (assoc-in cfg [:options :deps-cmd ] deps-cmd))
191+
188192(defn- target-opt
189193 [cfg target]
190194 (let [target (if (= " node" target) " nodejs" target)]
@@ -600,6 +604,9 @@ present"
600604 [" -o" " --output-to" ] {:group ::compile :fn output-to-opt
601605 :arg " file"
602606 :doc " Set the output compiled file" }
607+ [" --deps-cmd" ] {:group ::compile :fn deps-cmd-opt
608+ :arg " string"
609+ :doc " Set the node dependency manager. Only npm or yarn supported" }
603610 [" -O" " --optimizations" ] {:group ::compile :fn optimize-opt
604611 :arg " level"
605612 :doc
Original file line number Diff line number Diff line change 205205 :watch :watch-error-fn :watch-fn :install-deps :process-shim :rename-prefix :rename-prefix-namespace
206206 :closure-variable-map-in :closure-property-map-in :closure-variable-map-out :closure-property-map-out
207207 :stable-names :ignore-js-module-exts :opts-cache :aot-cache :elide-strict :fingerprint :spec-skip-macros
208- :nodejs-rt :target-fn })
208+ :nodejs-rt :target-fn :deps-cmd })
209209
210210(def string->charset
211211 {" iso-8859-1" StandardCharsets/ISO_8859_1
25392539 (recur buf)))))
25402540
25412541(defn maybe-install-node-deps!
2542- [{:keys [npm-deps verbose] :as opts}]
2542+ [{:keys [deps-cmd npm-deps verbose] :or {deps-cmd " npm " } :as opts}]
25432543 (let [npm-deps (merge npm-deps (compute-upstream-npm-deps opts))]
25442544 (when-not (empty? npm-deps)
25452545 (let [pkg-json (io/file " package.json" )]
25482548 (when-not (.exists pkg-json)
25492549 (spit pkg-json " {}" ))
25502550 (let [proc (-> (ProcessBuilder.
2551- (into (cond->> [" npm" " install" " @cljs-oss/module-deps" ]
2551+ (into (cond->>
2552+ [deps-cmd
2553+ ({" npm" " install" " yarn" " add" } deps-cmd)
2554+ " @cljs-oss/module-deps" ]
25522555 util/windows? (into [" cmd" " /c" ]))
25532556 (map (fn [[dep version]] (str (name dep) " @" version)))
25542557 npm-deps))
You can’t perform that action at this time.
0 commit comments