Fork me on GitHub
#clojurescript
<
2023-01-01
>
येसुदीप मंगलापिल्ली Yesudeep Mangalapilly04:01:24

Namasté all. I'm currently working on implementing rules_clojure (Clojure & ClojureScript) for Bazel, which simplifies tooling quite a bit: https://bazel.build fetches clojure(script) and all the specified dependencies and sets up the environment without you having to do anything other than have bazel and rlwrap installed on your system (macOS, Windows, Linux, & FreeBSD for now). The build targets for REPLs look like the following:

clojurescript_repl(
    name = "hello_world_clojurescript_repl",
    #ns = "hello_world.core",
    visibility = ["//visibility:public"],
    deps = [
        ":hello_world_cljs_lib",
    ],
)
And the REPL can then be launched as follows:
❯❯ bazel run //tests/hello_world:hello_world_clojurescript_repl
However, I'm running into a few issues when defining a rebel-readline-cljs REPL variant and I'm not sure the command that it runs in the background is correct (or what I'm missing). This screencast (https://www.youtube.com/watch?v=ZeOK-piWQGU) should show you how the regular clojurescript repl works (including how bazel fetches everything you need to run clojure) and the error that I get when running the rebel-readline-cljs variant.
❯❯ bazel run -s //tests/hello_world:hello_world_clojurescript_rebl
...
INFO: Running command line: bazel-bin/tests/hello_world/hello_world_clojurescript_rebl.cmd
Exception in thread "main" clojure.lang.ExceptionInfo: Namespace rebel-readline.cljs.main does not exist. Please check that namespaces with dashes use underscores in the ClojureScript file name. {:cljs.main/error :invalid-arg}
        at cljs.cli$default_main$fn__996.invoke(cli.clj:422)
        at cljs.compiler$with_core_cljs.invokeStatic(compiler.cljc:1477)
        at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1466)
        at cljs.compiler.api$with_core_cljs.invokeStatic(api.clj:47)
        at cljs.compiler.api$with_core_cljs.invoke(api.clj:35)
        at cljs.compiler.api$with_core_cljs.invokeStatic(api.clj:43)
        at cljs.compiler.api$with_core_cljs.invoke(api.clj:35)
        at cljs.cli$default_main.invokeStatic(cli.clj:369)
        at cljs.cli$default_main.invoke(cli.clj:343)
        at cljs.cli$main_opt.invokeStatic(cli.clj:437)
        at cljs.cli$main_opt.invoke(cli.clj:433)
        at cljs.cli$main.invokeStatic(cli.clj:703)
        at cljs.cli$main.doInvoke(cli.clj:692)
        at clojure.lang.RestFn.applyTo(RestFn.java:139)
        at clojure.core$apply.invokeStatic(core.clj:667)
        at clojure.core$apply.invoke(core.clj:660)
        at cljs.main$_main.invokeStatic(main.clj:65)
        at cljs.main$_main.doInvoke(main.clj:56)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at cljs.main.main(Unknown Source
Could someone please examine the command below and tell me whether it is constructed correctly? I'd appreciate a fresh pair of eyes (I'm fairly new to Clojure(Script)). I'm a little stumped because I see the namespace and the associated clj files in the jar file: https://www.youtube.com/watch?v=CeG98aqgoaA
"../rules_java~5.4.0~toolchains~local_jdk/bin/java" -Dclojure.main.report=stderr -cp "../rules_clojure_clojurescript/jar/downloaded.jar:../rules_clojure_com_bhauman_rebel_readline_cljs/rebel-readline-cljs-0.1.4.jar:../rules_clojure_cljfmt_cljfmt/cljfmt-0.9.0.jar:../rules_clojure_rewrite_clj_rewrite_clj/rewrite-clj-1.1.45.jar:../rules_clojure_nrepl_nrepl/nrepl-1.0.0.jar:../rules_clojure_cider_cider_nrepl/cider-nrepl-0.28.7.jar:../rules_clojure_cider_piggieback/piggieback-0.5.3.jar:../rules_clojure_refactor_nrepl_refactor_nrepl/refactor-nrepl-3.6.0.jar" cljs.main -m rebel-readline.cljs.main
Thank you!

thheller06:01:59

rebel readline is implemented in clojure. it cannot be launched via cljs.main

👍 2