diff --git a/CHANGELOG.md b/CHANGELOG.md index 38e1f24..8b73a24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ [Cherry](https://github.com/squint-cljs/cherry): Experimental ClojureScript to ES6 module compiler +## Unreleased + +- Fix `cherry compile` CLI command not receiving file arguments + ## 0.5.33 (2025-11-27) - Fix [#163](https://github.com/squint-cljs/cherry/issues/163): Add assert to macros ([@willcohen](https://github.com/willcohen)) diff --git a/bb/integration_tests.clj b/bb/integration_tests.clj index 64ec550..13aeb06 100644 --- a/bb/integration_tests.clj +++ b/bb/integration_tests.clj @@ -19,6 +19,14 @@ (let [out (:out (p/shell {:out :string} "node test-resources/js_api.mjs"))] (is (= ["1" "1"] (str/split-lines out))))) +(deftest compile-test + (let [tmp-file "/tmp/cherry-compile-test.cljs" + out-file "/tmp/cherry-compile-test.mjs"] + (spit tmp-file "(ns compile-test)\n(defn hello [] (js/console.log \"hello\"))") + (shell "rm" "-f" out-file) + (sh "npx" "cherry" "compile" tmp-file) + (is (.exists (java.io.File. out-file)) "compile should create output file"))) + (defn run-tests [] (shell {:dir "test-resources/test_project"} "npm install") (let [{:keys [fail error]} (t/run-tests 'integration-tests)] diff --git a/src/cherry/internal/cli.cljs b/src/cherry/internal/cli.cljs index 555ce53..9412a12 100644 --- a/src/cherry/internal/cli.cljs +++ b/src/cherry/internal/cli.cljs @@ -175,8 +175,8 @@ Options: (def table [{:cmds ["run"] :fn run :args->opts [:file]} - {:cmds ["compile"] :fn (fn [{:keys [opts rest-cmds]}] - (compile-files opts rest-cmds))} + {:cmds ["compile"] :fn (fn [{:keys [opts args]}] + (compile-files opts args))} {:cmds [] :fn fallback}]) (defn init []