Giter VIP home page Giter VIP logo

boot-cljs-repl's Introduction

boot-cljs-repl

[adzerk/boot-cljs-repl   "0.4.0"] ;; latest release
[cider/piggieback        "0.3.9"  :scope "test"]
[weasel                  "0.7.0"  :scope "test"]
[nrepl                   "0.4.5"  :scope "test"]

Boot task providing a ClojureScript browser REPL via Weasel and Piggieback.

This task requires Clojure 1.7+ to learn how to pin the Clojure version in a Boot project head to the Boot wiki.

NOTE: Version 0.3.0 changed how the REPL dependencies are handled. For now user is required to add dependencies to necessary libraries to one's project. Cljs-repl task will print the required dependecies when run. [1]

Usage

Add boot-cljs-repl to your build.boot dependencies and require the namespace:

(require '[adzerk.boot-cljs-repl :refer [cljs-repl start-repl]])

cljs-repl is the task to be used in the task pipeline whereas start-repl is how you connect to the ClojureScript REPL once you're in a Clojure REPL.

It's also a good idea to explicitly depend on the specific version of Clojure and ClojureScript needed for your application.

Build

Start a build pipeline with file-watcher, ClojureScript REPL server, and compile ClojureScript with no optimizations:

# note: cljs-repl task must precede cljs task
$ boot watch cljs-repl

or

(deftask dev []
  (comp (watch)
        (cljs-repl) ; order is important!!
        (cljs)))

For optional configuration see boot cljs -h and boot cljs-repl -h.

Important: The cljs-repl task injects things into your build so if you run the compiler before the cljs-repl task is being run your REPL will not work.

REPL

To start evaluating forms in the browser you must first connect to the running Clojure nREPL server (started by the cljs-repl task above) and create a new, browser-connected CLJS REPL.

Terminal

$ boot repl -c
boot.user=> (start-repl)

Emacs Cider

M-x cider-connect
boot.user=> (start-repl)
The cljs-repl-env task

There is a cljs-repl-env task that doesn't start a new nREPL server which you can use via cider-jack-in. An example is shown below.

(require ...
    '[adzerk.boot-cljs-repl :refer [cljs-repl start-repl cljs-repl-env]]
    ...
    )

(deftask dev []
  (comp (watch)
        (cljs-repl-env) ; order is important!!
        (cljs)))
M-x cider-jack-in
boot.user=> (def p (future (boot (dev))))
...
boot.user=> (start-repl)

Vim Fireplace

:Piggieback (adzerk.boot-cljs-repl/repl-env)

Cursive

First specify an nREPL-port in the cljs-repl task:

(cljs-repl :nrepl-opts {:port 9009})

Then create a new nREPL in Cursive: Run -> Edit Configurations -> + -> Clojure REPL -> Remote

Pick "Connect to Server" and fill in

Host: localhost

Port: 9009

Help

You can see the task options available on the command line:

$ boot cljs-repl -h

or in the REPL:

boot.user=> (doc cljs-repl)

Notes

Cljs repl options

You can pass Cljs repl options at the start-repl call:

boot.user=> (start-repl :cljs-repl-opts {:repl-verbose true})

From Fireplace:

FIXME: Not supported...

Direct dependencies

For now user needs to add direct dependencies to REPL libs (piggieback, weasel) to one's project. This is because Boot tasks shouldn't modify the classpath of the application by adding new dependencies, either by calling set-env! or though transitive dependencies. The preferred way for Boot tasks to use additional libraries is through pods but because the REPL is currently run on the main pod (where your application code runs), it's not currently possible to use this.

License

Copyright © 2014-15 Adzerk

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

boot-cljs-repl's People

Contributors

adamfrey avatar alandipert avatar anmonteiro avatar arichiardi avatar deraen avatar estsauver avatar frankiesardo avatar jffry avatar lederstrumpf avatar livtanong avatar manicolosi avatar martinklepsch avatar matttylr avatar mdiin avatar micha avatar myguidingstar avatar nblumoe avatar pandeiro avatar piranha avatar pkobrien avatar vikeri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

boot-cljs-repl's Issues

Starting REPL freezes

So I'm trying to run a boot cljs repl in my browser, but I'm having issues.

I run the command: boot dev watch reload cljs-repl cljs start-server wait in one terminal, then open another terminal and run: repl -c -H localhost -p <nrepl-port>. Inside the repl I call (start-repl), upon which I get the following output:

user=> (adzerk.boot-cljs-repl/start-repl)
<< started Weasel server on ws://127.0.0.1:46366 >>
<< waiting for client to connect ... Connection is ws://localhost:46366
Writing boot_cljs_repl.cljs...

Then the repl freezes indefinitely and will not connect to the cljs repl. What am I doing wrong in this scenario?

remote repl

I am pair programming on a remote server using tmux. when I run (start-repl) , the browser repl tries to connect ws://localhost. It should connect to the remote host not localhost. How can this be changed so that the browser connects to the repl running on the remote server not on my localhost?

thanks!

jsloader GET pprint.js 404, cannot see return in cljs-repl

keep getting this error message in the browser whenever connected to cljs-repl, and after every command from cljs-repl (and I can't see the return value of each command)

here's the error in the browser:

jsloader.js:216 GET http://localhost:3000/js/app.out/cljs/pprint.js net::ERR_ABORTED 404 (Not Found)

and here's the error message in the cljs-repl:

cljs.user=> (js/alert "test")

#object[TypeError TypeError: Cannot read property 'pprint' of undefined]
TypeError: Cannot read property 'pprint' of undefined
    at eval (eval at <anonymous> (http://localhost:3000/js/app.out/weasel/repl.js:30:495), <anonymous>:12:13)
    at http://localhost:3000/js/app.out/weasel/repl.js:30:495
    at http://localhost:3000/js/app.out/weasel/repl.js:39:4
    at Object.G__12572__2 (http://localhost:3000/js/app.out/cljs/core.js:35814:106)
    at Object.G__12572 [as call] (http://localhost:3000/js/app.out/cljs/core.js:36081:20)
    at goog.net.WebSocket.<anonymous> (http://localhost:3000/js/app.out/weasel/repl.js:190:71)
    at goog.net.WebSocket.goog.events.EventTarget.fireListeners (http://localhost:3000/js/app.out/goog/events/eventtarget.js:284:23)
    at Function.goog.events.EventTarget.dispatchEventInternal_ (http://localhost:3000/js/app.out/goog/events/eventtarget.js:381:26)
    at goog.net.WebSocket.goog.events.EventTarget.dispatchEvent (http://localhost:3000/js/app.out/goog/events/eventtarget.js:196:34)
    at goog.net.WebSocket.onMessage_ (http://localhost:3000/js/app.out/goog/net/websocket.js:426:8)

Here are the dependencies I'm using

  :dependencies '[[org.clojure/clojurescript	"1.10.339"]
		              [adzerk/boot-cljs						"2.1.5"	:scope	"test"]
		              [adzerk/boot-reload					"0.6.1" :scope	"test"]
									;; the follow 4 deps are for cljs repl
		              [cider/piggieback		        "0.5.2" :scope	"test"]
		              [weasel					            "0.7.0" :scope	"test"]
		              [adzerk/boot-cljs-repl			"0.4.0" :scope	"test"]
		              [nrepl											"0.8.3" :scope	"test"]
									;; to fix datatypeconverter not found error with some jdk versions
									[javax.xml.bind/jaxb-api "2.4.0-b180830.0359"]
		              [pandeiro/boot-http					"0.8.3"	:scope	"test"]]

Start-repl hangs

From yesterday, our project https://github.com/Lambda-X/cljs-repl-web started to have problems with the Clojurescript repl.

I start it with boot dev, which contains:

(comp (serve)
          (watch)
          (cljs-repl)
          (build :type :dev)
          (reload :on-jsload 'cljs-repl-web.core/main))

Then I connect from another boot repl -c and trigger (start-repl) but the only output I receive is:

<< started Weasel server on ws://127.0.0.1:46207 >>
<< waiting for client to connect ... Connection is ws://localhost:46207
Writing boot_cljs_repl.cljs...

That's it. The app is displayed as usual in the browser so I cannot understand what I am doing wrong and if there is any obvious reason.

A question I guess is, how can I debug it?

.cljs.edn makes cljs-repl not connecting anymore

Here is a couple of repos demonstrating the issue:

The first one is a very minimal repo defining a dev task which implements a kind of immediate feedback principle.

https://github.com/magomimmo/modern-cljs/tree/se-tutorial-03

You can call it with following boot command:

boot dev

Than, after visiting the localhost:3000 URL, if you run the nrepl-client everuthing works as exptexted

boot repl -c
REPL-y 0.3.7, nREPL 0.2.11
Clojure 1.7.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_66-b17
        Exit: Control+D or (exit) or (quit)
    Commands: (user/help)
        Docs: (doc function-name-here)
              (find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
      Source: (source function-name-here)
     Javadoc: (javadoc java-object-or-class-here)
    Examples from clojuredocs.org: [clojuredocs or cdoc]
              (user/clojuredocs name-here)
              (user/clojuredocs "ns-here" "name-here")
boot.user=> (start-repl)
<< started Weasel server on ws://127.0.0.1:53410 >>
<< waiting for client to connect ... Connection is ws://localhost:53410
Writing boot_cljs_repl.cljs...
 connected! >>
To quit, type: :cljs/quit
nil
cljs.user=>

The second repo is the same as the first one with just one exception.

https://github.com/magomimmo/modern-cljs/tree/edn

I changed the name of the generated JS file from main.js to js/main.js. Obviously I changed the src of the script tag as well and added the main.cljs.edn file in the js directory.

boot dev still works as expected, but when I try to connect the nrepl-client, the connection never happens:

boot repl -c
REPL-y 0.3.7, nREPL 0.2.11
Clojure 1.7.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_66-b17
        Exit: Control+D or (exit) or (quit)
    Commands: (user/help)
        Docs: (doc function-name-here)
              (find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
      Source: (source function-name-here)
     Javadoc: (javadoc java-object-or-class-here)
    Examples from clojuredocs.org: [clojuredocs or cdoc]
              (user/clojuredocs name-here)
              (user/clojuredocs "ns-here" "name-here")
boot.user=> (start-repl)
<< started Weasel server on ws://127.0.0.1:53453 >>
<< waiting for client to connect ... Connection is ws://localhost:53453
Writing boot_cljs_repl.cljs...

Please use the above repos to test yourself.

Cheers

How do you connect to an NREPL running in Docker?

My task:

(boot/deftask start-development
  []
  (comp
    (wordroot-util/data-readers)
    (wordroot-ide-integration/cider)
    (boot-task/watch)
    (boot-reload/reload
      :port 33215
      :ws-port 33215
      :asset-path "public"
      :on-jsload 'wordroot.core/go)
    (boot-cljs-repl/cljs-repl
      :nrepl-opts {:ws-host "0.0.0.0"
                   :port    9009}
      :ws-host "0.0.0.0"
      :port 9009
      :ids #{"public/js/main"})
    (build-dev)
    (start-app)))

Excerpt from docker-compose.yml:

.
.
.
services:
  web:
    container_name: wordroot_web
    build: .
    environment:
     - IS_RUNNING_IN_CONTAINER=yes
    volumes:
     - .:/wordroot
    ports:
     - "80:80"            # Production
     - "8000:8000"   # Dev
     - "9009:9009"   # Clojure REPL
     - "33215:33215" # Resource reloading
    links:
     - db
.
.
.

Connecting on the host machine:
boot repl -c -p 9009 -H "0.0.0.0"

Error message:

SocketException The transport's socket appears to have lost its connection to the nREPL server
	clojure.tools.nrepl.transport/bencode/fn--1560/fn--1561 (transport.clj:95)
	clojure.tools.nrepl.transport/bencode/fn--1560 (transport.clj:95)
	clojure.tools.nrepl.transport/fn-transport/fn--1532 (transport.clj:42)
	clojure.core/binding-conveyor-fn/fn--4676 (core.clj:1938)
	java.util.concurrent.FutureTask.run (FutureTask.java:266)
	java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1142)
	java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:617)
	java.lang.Thread.run (Thread.java:745)
Bye for now!

Things I've tried switching up:

  • Changing the -H option for boot repl to the Docker container's IP address
    • Same issue

Apologies if this is not the right place for this. Let me know and I'll take it down.

Thanks for any help.

No such namespace: cljsjs.react at line 1

Using clojurescript 2850.
Here is my build.boot: https://gist.github.com/23min/37f466b75f3e9311f26e
(Result is the same when I don't specify weasel and piggieback dependencies)

macbook:rumtest peterbru$ boot -vv repl -c -p 56557
Retrieving drawbridge-0.0.6.jar from http://clojars.org/repo/
Retrieving pomegranate-0.3.0.jar from http://repo1.maven.org/maven2/
registering src/cljs [:create :modify]
registering src/cljs/rumtest [:create :modify]
sending change event
watch service closed
registering src/cljs [:create :modify]
registering src/cljs/rumtest [:create :modify]
registering resources [:create :modify]
registering resources/js [:create :modify]
sending change event
Retrieving austin-0.1.6.jar from http://clojars.org/repo/
Retrieving piggieback-0.1.5.jar from http://repo1.maven.org/maven2/
REPL-y 0.3.5, nREPL 0.2.6
Clojure 1.6.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_31-b13
        Exit: Control+D or (exit) or (quit)
    Commands: (user/help)
        Docs: (doc function-name-here)
              (find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
      Source: (source function-name-here)
     Javadoc: (javadoc java-object-or-class-here)
    Examples from clojuredocs.org: [clojuredocs or cdoc]
              (user/clojuredocs name-here)
              (user/clojuredocs "ns-here" "name-here")
boot.user=> (start-repl)
WARNING: rum is a single segment namespace at line 1 file:/Users/peterbru/.m2/repository/rum/rum/0.2.4/rum-0.2.4.jar!/rum.cljs

clojure.lang.ExceptionInfo: No such namespace: cljsjs.react at line 1 file:/Users/peterbru/.m2/repository/rum/rum/0.2.4/rum-0.2.4.jar!/rum.cljs
boot.user=>

missing dependencies

By switching from "0.2.0" release to "0.3.0" release I got the fallowing dependencies warning and error:

...
Writing boot_reload.cljs...
You are missing necessary dependencies for boot-cljs-repl.
Please add the following dependencies to your project:
[com.cemerick/piggieback "0.2.1" :scope "test"]
[weasel "0.7.0" :scope "test"]
[org.clojure/tools.nrepl "0.2.12" :scope "test"]
....
Adding :require adzerk.boot-reload to main.cljs.edn...
java.io.FileNotFoundException: Could not locate cemerick/piggieback__init.class or cemerick/piggieback.clj on classpath.
...
Elapsed time: 1.578 sec

It seems that the dependencies' transitivity is lost on the way. Obviously if I explicitly add the missing deps it works.

Takes forever to start up

I'm trying to implement examples from the open source book Modern CLJS

I've already write a runnable boot task to compile, watch and serve my project, here's code for build.boot:

; vim: set ft=clojure:

(set-env!
 :source-paths #{"src/cljs"}
 :resource-paths #{"html"}

 :dependencies '[[org.clojure/clojure "1.10.3"]         ;; add CLJ
                 [org.clojure/clojurescript "1.10.866"] ;; add CLJS
                 [adzerk/boot-cljs "2.1.5"]
                 [pandeiro/boot-http "0.8.3"]
                 [org.clojure/tools.nrepl "0.2.13"]
                 [adzerk/boot-reload "0.6.1"]
                 [adzerk/boot-cljs-repl "0.4.0"]
                 [cider/piggieback "0.3.9"]            ;; needed by bREPL
                 [weasel "0.7.1"]])                    ;; needed by bREPL

(require '[adzerk.boot-cljs :refer [cljs]]
         '[pandeiro.boot-http :refer [serve]]
         '[adzerk.boot-reload :refer [reload]]
         '[adzerk.boot-cljs-repl :refer [cljs-repl start-repl]])

(deftask dev
  "Launch Immediate Feedback Development Environment"
  []
  (comp
    (serve :dir "target")
    (watch)
    (reload)
    (cljs-repl)
    (cljs)
    (target :dir #{"target"})))

I set up my interactive development environment by running the followings in different consoles:

boot dev 
boot repl -c 

In the boot repl, I typed (start-repl), which, however, takes forever to finish and block my input.
Like this:

<< started Weasel server on ws://127.0.0.1:39371 >>
<< waiting for client to connect ... Connection is ws://localhost:39371
Writing boot_cljs_repl.cljs...

However, it's wired since I once successfully start the bREPL, yet now I can't.

Stopping the bREPL once and you can't restart it anymore

It seems to me that after you start a CLJS bREPL on top of a CLJ REPL, if you stop the former and then restart it, you can't connect anymore to the browser.

boot repl -c
...
boot.user=> (start-repl)
<< started Weasel server on ws://127.0.0.1:51712 >>
<< waiting for client to connect ... Connection is ws://localhost:51712
Writing boot_cljs_repl.cljs...
 connected! >>
To quit, type: :cljs/quit
nil
cljs.user=> :cljs/quit
...
boot.user=> (start-repl)
<< started Weasel server on ws://127.0.0.1:51712 >>
<< waiting for client to connect ... Connection is ws://localhost:51712
Writing boot_cljs_repl.cljs...

Thanks

"No such namespace" for ns from foreign-libs libs when eval ns-form at repl

Expected behavior

=> nil

Actual behavior

clojure.lang.ExceptionInfo: No such namespace: chrono, could not locate chrono.cljs, chrono.cljc, or Closure namespace "chrono" in file <cljs repl> {:tag :cljs/analysis-error}
    at clojure.core$ex_info.invoke(core.clj:4593)
    at cljs.analyzer$error.invoke(analyzer.cljc:610)
    at cljs.analyzer$error.invoke(analyzer.cljc:608)
    at cljs.analyzer$analyze_deps.invoke(analyzer.cljc:1708)
    at cljs.analyzer$ns_side_effects.invoke(analyzer.cljc:2559)
    at cljs.analyzer$analyze_STAR_$fn__4491.invoke(analyzer.cljc:2644)
    at clojure.lang.PersistentVector.reduce(PersistentVector.java:333)
    at clojure.core$reduce.invoke(core.clj:6518)
    at cljs.analyzer$analyze_STAR_.invoke(analyzer.cljc:2644)
    at cljs.analyzer$analyze.invoke(analyzer.cljc:2659)
    at cljs.repl$evaluate_form.invoke(repl.cljc:454)
    at cljs.repl$eval_cljs.invoke(repl.cljc:574)
    at cljs.repl$repl_STAR_$read_eval_print__8416.invoke(repl.cljc:880)
    at cljs.repl$repl_STAR_$fn__8422$fn__8431.invoke(repl.cljc:919)
    at cljs.repl$repl_STAR_$fn__8422.invoke(repl.cljc:918)
    at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1154)
    at cljs.repl$repl_STAR_.invoke(repl.cljc:882)
    at cemerick.piggieback$run_cljs_repl.invoke(piggieback.clj:169)
    at clojure.lang.AFn.applyToHelper(AFn.java:171)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.core$apply.invoke(core.clj:634)
    at cemerick.piggieback$evaluate.invoke(piggieback.clj:258)
    at clojure.lang.Var.invoke(Var.java:379)
    at cemerick.piggieback$wrap_cljs_repl$fn__8909$fn__8911$fn__8912.invoke(piggieback.clj:290)
    at cemerick.piggieback$enqueue$fn__8895.invoke(piggieback.clj:246)
    at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__1996.invoke(interruptible_eval.clj:190)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Steps to reproduce the problem

boot dev

cider-connect to nrepl created by boot or boot repl -c

(start-repl)

Switch to source buffer, C-c-v-n to eval namespace declaration
or
pass namespace declaration to repl.

Project compiles fine with no errors. This issue appears confined to the repl.
The namespaces pm and chrono come from two javascript libs included via the foreign-libs compiler option - please see relevant parts of build-boot. If I remove the foreign-libs namespaces everything works as expected.

ns form looks as follows:

(ns app.core
  (:require-macros [hiccups.core :as hiccups :refer [html]])
  (:require [app.validation :as validation]
            [app.data :as data]
            [bouncer.core :as b]
            [pm]
            [chrono]))

build.boot contains:

(deftask dev []
  (comp (serve :dir "target/")
        (watch)
        (speak)
        (reload :on-jsload 'app.core/main)
        (cljs-repl)
        (cljs :source-map true
              :optimizations :none
              :compiler-options {:foreign-libs
                                 [{:file "src/js/prosemirror.js"
                                   :provides ["pm"]}
                                  {:file "src/js/chrono.js"
                                   :provides ["chrono"]}]
                                 :externs ["src/js/externs.js"]})
        (target :dir #{"target/"})))

Environment & Version information

CIDER version information

;; CIDER 0.14.0snapshot (package: 20160830.23)
;; Clojure 1.7.0
;; openjdk version "1.8.0_91"
;; OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14)
;; OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)

Lein/Boot version

;; BOOT_VERSION=2.6.0

Emacs version

GNU Emacs 25.1.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-08-23

Operating system

Ubuntu 16.04

Make `repl` task server port configurable

In addition to specifying the websocket port that weasel communicates over, it would be nice to be able to configure the internally used repl task's port as well.

(start-repl) NullPointerException

I'm getting a NullPointerException (without any stacktrace) when trying to start-repl:

$ boot show -d                                                                      [INS]
adzerk/boot-cljs-repl "0.1.9" :scope "test"
adzerk/boot-cljs "0.0-2814-1" :scope "test"
adzerk/boot-reload "0.2.4" :scope "test"
boot-deps "0.1.4"
cljsjs/react "0.12.2-5"
com.cemerick/piggieback "0.1.6-20150223.163620-3"
org.clojure/clojure "1.6.0"
org.clojure/clojurescript "0.0-3119"
├── com.google.javascript/closure-compiler "v20150126"
│   ├── args4j "2.0.26"
│   ├── com.google.code.findbugs/jsr305 "1.3.9"
│   ├── com.google.code.gson/gson "2.2.4"
│   ├── com.google.guava/guava "18.0"
│   ├── com.google.javascript/closure-compiler-externs "v20150126"
│   ├── com.google.protobuf/protobuf-java "2.5.0"
│   └── com.google.truth/truth "0.24"
│       └── junit "4.10"
│           └── org.hamcrest/hamcrest-core "1.1"
├── org.clojure/data.json "0.2.6"
├── org.clojure/google-closure-library "0.0-20140718-946a7d39"
│   └── org.clojure/google-closure-library-third-party "0.0-20140718-946a7d39"
├── org.clojure/tools.reader "0.8.16"
└── org.mozilla/rhino "1.7R5"
org.clojure/core.async "0.1.346.0-17112a-alpha"
└── org.clojure/tools.analyzer.jvm "0.1.0-beta12"
    ├── org.clojure/core.memoize "0.5.6"
    │   └── org.clojure/core.cache "0.6.3"
    │       └── org.clojure/data.priority-map "0.0.2"
    ├── org.clojure/tools.analyzer "0.1.0-beta12"
    └── org.ow2.asm/asm-all "4.1"
pandeiro/boot-http "0.3.0" :scope "test"
reagent-forms "0.4.4"
reagent-utils "0.1.3"
reagent "0.5.0"
secretary "1.2.1"
weasel "0.6.0"
└── http-kit "2.1.18"

boot repl --client fails with Assert failed: host and/or port not specified for REPL client

This is my build.boot:

(set-env!
  :source-paths   #{"src"}
  :resource-paths #{"html"}
  :dependencies '[
    [adzerk/boot-cljs            "0.0-3308-0"      :scope "test"]
    [adzerk/boot-cljs-repl       "0.1.10-SNAPSHOT" :scope "test"]
    [adzerk/boot-reload          "0.3.1"           :scope "test"]
    [pandeiro/boot-http          "0.6.3"           :scope "test"]
    [crisptrutski/boot-cljs-test "0.1.0-SNAPSHOT"  :scope "test"]
    [org.clojure/clojure         "1.7.0"]
    [org.clojure/clojurescript   "1.7.48"]
    [reagent "0.5.1"]
    [re-frame "0.4.1"]])

(require
  '[adzerk.boot-cljs      :refer [cljs]]
  '[adzerk.boot-cljs-repl :refer [cljs-repl start-repl]]
  '[adzerk.boot-reload    :refer [reload]]
  '[crisptrutski.boot-cljs-test  :refer [test-cljs]]
  '[pandeiro.boot-http    :refer [serve]])

(deftask auto-test []
  (set-env! :source-paths #{"src" "test"})
  (comp (watch)
        (speak)
        (test-cljs)))

(deftask dev []
  (set-env! :source-paths #{"src"})
  (comp (serve :dir "target/")
        (watch)
        (speak)
        (reload :on-jsload 'app.core/mount-root)
        (cljs-repl)
        (cljs :source-map true :optimizations :none)))

(deftask build []
  (set-env! :source-paths #{"src"})
  (comp (cljs :optimizations :advanced)))

my ~/.boot/profile.boot:

(require 'boot.repl)
(swap! boot.repl/*default-dependencies*
       concat '[[cider/cider-nrepl "0.10.0-SNAPSHOT"]
                [refactor-nrepl "1.2.0-SNAPSHOT"]
                [org.clojure/tools.nrepl "0.2.10"]])

(swap! boot.repl/*default-middleware*
       conj 'refactor-nrepl.middleware/wrap-refactor)

And the terminal output:

$ boot repl --client
             clojure.lang.ExceptionInfo: java.lang.AssertionError: Assert failed: host and/or port not specified for REPL client
                                         (and h p)
    data: {:file "/tmp/boot.user245463565904755740.clj", :line 27}
java.util.concurrent.ExecutionException: java.lang.AssertionError: Assert failed: host and/or port not specified for REPL client
                                         (and h p)
               java.lang.AssertionError: Assert failed: host and/or port not specified for REPL client
                                         (and h p)
            boot.repl-client/client  repl_client.clj:   10
                                ...                       
                 clojure.core/apply         core.clj:  630
              boot.pod/eval-fn-call          pod.clj:  184
                  boot.pod/call-in*          pod.clj:  191
                                ...                       
                  boot.pod/call-in*          pod.clj:  194
        boot.task.built-in/fn/fn/fn     built_in.clj:  276
                                ...                       
                 clojure.core/deref         core.clj: 2206
     boot.task.built-in/fn/fn/fn/fn     built_in.clj:  282
     boot.task.built-in/fn/fn/fn/fn     built_in.clj:  278
                boot.core/run-tasks         core.clj:  695
                  boot.core/boot/fn         core.clj:  705
clojure.core/binding-conveyor-fn/fn         core.clj: 1916
                                ...                       

outdated piggieback dependency?

It seems to me that com.cemerick/piggieback has been superseded by cider/piggieback. At least cider itself seems to be of that opinion. Should the dependency be updated?

FileNotFoundException on (start-repl)

Hi,

I'm trying to get a browser repl going with:

boot -- serve -k -d target -- watch -- speak -- reload -- cljs-repl -- cljs -O none

But I get this:

java.io.FileNotFoundException: Could not locate cljs/env__init.class or cljs/env.clj on classpath: , compiling:(cemerick/piggieback.clj:1:1)

I've tried adding the following dependencies, but they don't seem to help:

[com.cemerick/piggieback "0.2.1"]
[org.clojure/tools.nrepl "0.2.10"]

Here is my build.boot file:

(set-env!
  :source-paths   #{"src"}
  :resource-paths #{"resources"}
  :dependencies '[[org.clojure/clojure "1.6.0"]
                  [org.clojure/clojurescript "0.0-3308"]
                  [adzerk/boot-cljs "0.0-3269-2"]
                  [adzerk/boot-cljs-repl "0.1.9"]
                  [adzerk/boot-reload "0.2.6"]
                  [pandeiro/boot-http "0.6.2"]
                  [com.cemerick/piggieback "0.2.1"]
                  [org.clojure/tools.nrepl "0.2.10"]
                  [org.omcljs/om "0.8.8"]
                  [prismatic/om-tools "0.3.10" :exclude [prismatic/schema
                                                         prismatic/plumbing]]
                  [prismatic/schema "0.4.2"]
                  [prismatic/plumbing "0.4.3"]
                  [prismatic/dommy "1.0.0"]])

(require
  '[adzerk.boot-cljs :refer [cljs]]
  '[adzerk.boot-reload :refer [reload]]
  '[adzerk.boot-cljs-repl :refer [cljs-repl start-repl]]
  '[pandeiro.boot-http :refer [serve]])

Any clues on what I'm doing wrong?

Thank you!

can't require a namespace from the repl

It seems that if I do not first require a namespace of a lib in a requirement expression of a another namespace declaration written in cljs source file, the repl, even if see the public symbols of the required namespace, is not able to use the.

e.g.

;;; build.boot
(set-env!
 ...
 :dependencies '[...
                          [domina "1.0.3"]
                         ])
...

Then after having launched a bREPL.

cljs.user=> (require '[domina :as dom] :reload
                                '[domina.events :as evt] :reload)
nil
cljs.user> (doc evt/listen!)
-------------------------
domina.events/listen!
([type listener] [content type listener])
  Add an event listener to each node in a DomContent. Listens for events during the bubble phase. Returns a sequence of listener keys (one for each item in the content). If content is omitted, binds a listener to the document's root element.
nil
#Object[TypeError TypeError: Cannot read property 'listen_BANG_' of undefined]
TypeError: Cannot read property 'listen_BANG_' of undefined
    at eval (eval at <anonymous> (http://localhost:3000/main.out/weasel/repl.js:30:470), <anonymous>:1:102)
    at eval (eval at <anonymous> (http://localhost:3000/main.out/weasel/repl.js:30:470), <anonymous>:9:3)
    at eval (eval at <anonymous> (http://localhost:3000/main.out/weasel/repl.js:30:470), <anonymous>:14:4)
    at http://localhost:3000/main.out/weasel/repl.js:30:465
    at http://localhost:3000/main.out/weasel/repl.js:39:4
    at cljs.core.MultiFn.call.G__9227__2 (http://localhost:3000/main.out/cljs/core.js:31994:106)
    at cljs.core.MultiFn.call.G__9227 [as call] (http://localhost:3000/main.out/cljs/core.js:32261:19)
    at null.<anonymous> (http://localhost:3000/main.out/weasel/repl.js:184:71)
    at goog.events.EventTarget.fireListeners (http://localhost:3000/main.out/goog/events/eventtarget.js:284:23)
    at Function.goog.events.EventTarget.dispatchEventInternal_ (http://localhost:3000/main.out/goog/events/eventtarget.js:381:26)

As soon as I require the same namespaces in a namespace declaration in the file, everything works as expected in the bREPL as well.

0.1.10-SNAPSHOT

I pushed an updated snapshot to clojars with the hope that we can get to a 0.1.10 release that is stable. Please test this snapshot and report any problems here. Thanks. :-)

boot-cljs-repl pollutes project directory

boot-cljs-repl is polluting my project directory by compiling to "out/" instead of "target/*".

(deftask dev []
  (comp
   (watch :verbose true)
   (speak)
   (reload :asset-path "public"
           :on-jsload 'my.project/restart!)
   (cljs-repl)
   (cljs :optimization :none
         :source-map true
         :compiler-options {:verbose true})
   (repl :server true)))

When I connect to the nREPL server and type (start-repl) to start the CLJS REPL, an "out/" directory is created.

No REPL connection (fails to set port in time)

There is something like a race condition affecting the setting of the port with the cljs-repl task:

If no port is specified, the weasel server begins with: << started Weasel server on ws://127.0.0.1:0 >>. (If a port is specified, that port shows up in the output.)

And whether or not a port is specified, the generated ClojureScript file used to connect to the REPL server sets an invalid websocket URL: ws://localhost:null.

The Vim Fireplace Instrucions Do Not Work

When I type :Piggieback (repl-env) I get a stack trace fragment saying repl-env can't be found.
Passing the fully qualifed repl-env (adzerk.boot-cljs-repl/repl-env) does though.

Broken with cljs 1.9.93

Reporting duty 😄

I started a brand new project using tenzing today and changed it to [org.clojure/clojurescript "1.9.93"]. I received a surprising error; 1.9.76 works fine.

clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: No such var: string/index-of, compiling:(cljs/source_map.clj:260:54)
             java.lang.RuntimeException: No such var: string/index-of
                                                      ...                       
                                     clojure.core/load/fn         core.clj: 5866
                                        clojure.core/load         core.clj: 5865
                                                      ...                       
                                    clojure.core/load-one         core.clj: 5671
                                 clojure.core/load-lib/fn         core.clj: 5711
                                    clojure.core/load-lib         core.clj: 5710
                                                      ...                       
                                       clojure.core/apply         core.clj:  632
                                   clojure.core/load-libs         core.clj: 5749
                                                      ...                       
                                       clojure.core/apply         core.clj:  632
                                     clojure.core/require         core.clj: 5832
                                                      ...                       
cljs.compiler$eval2821$loading__5340__auto____2822.invoke    compiler.cljc:    9
                            cljs.compiler$eval2821.invoke    compiler.cljc:    9
                                                      ...                       
                                     clojure.core/load/fn         core.clj: 5866
                                        clojure.core/load         core.clj: 5865
                                                      ...                       
                                    clojure.core/load-one         core.clj: 5671
                                 clojure.core/load-lib/fn         core.clj: 5711
                                    clojure.core/load-lib         core.clj: 5710
                                                      ...                       
                                       clojure.core/apply         core.clj:  632
                                   clojure.core/load-libs         core.clj: 5749
                                                      ...                       
                                       clojure.core/apply         core.clj:  632
                                     clojure.core/require         core.clj: 5832
                                                      ...                       
    cljs.repl$eval1853$loading__5340__auto____1854.invoke        repl.cljc:    9
                                cljs.repl$eval1853.invoke        repl.cljc:    9
                                                      ...                       
                                     clojure.core/load/fn         core.clj: 5866
                                        clojure.core/load         core.clj: 5865
                                                      ...                       
                                    clojure.core/load-one         core.clj: 5671
                                 clojure.core/load-lib/fn         core.clj: 5711
                                    clojure.core/load-lib         core.clj: 5710
                                                      ...                       
                                       clojure.core/apply         core.clj:  632
                                   clojure.core/load-libs         core.clj: 5749
                                                      ...                       
                                       clojure.core/apply         core.clj:  632
                                     clojure.core/require         core.clj: 5832
                                                      ...                       
             cemerick.piggieback/eval1847/loading--auto--   piggieback.clj:    1
                             cemerick.piggieback/eval1847   piggieback.clj:    1
                                                      ...                       
                                     clojure.core/load/fn         core.clj: 5866
                                        clojure.core/load         core.clj: 5865
                                                      ...                       
                                    clojure.core/load-one         core.clj: 5671
                                 clojure.core/load-lib/fn         core.clj: 5711
                                    clojure.core/load-lib         core.clj: 5710
                                                      ...                       
                                       clojure.core/apply         core.clj:  632
                                   clojure.core/load-libs         core.clj: 5749
                                                      ...                       
                                       clojure.core/apply         core.clj:  632
                                     clojure.core/require         core.clj: 5832
                                                      ...                       
                                   boot.repl-server/->var  repl_server.clj:   54
                               boot.repl-server/->mw-list  repl_server.clj:   60
                                      clojure.core/map/fn         core.clj: 2622
                                                      ...                       
                                         clojure.core/seq         core.clj:  137
                                       clojure.core/apply         core.clj:  630
                                      clojure.core/mapcat         core.clj: 2660
                                                      ...                       
                               boot.repl-server/->mw-list  repl_server.clj:   64
                            boot.repl-server/start-server  repl_server.clj:   72
                                   boot.repl/launch-nrepl         repl.clj:   51
                                   boot.core/launch-nrepl         core.clj: 1228
                                                      ...                       
                                       clojure.core/apply         core.clj:  630
                              boot.task.built-in/fn/fn/fn     built_in.clj:  392
                                                      ...                       
                                       clojure.core/deref         core.clj: 2206
                           boot.task.built-in/fn/fn/fn/fn     built_in.clj:  395
                     boot.task.built-in/fn/fn/fn/fn/fn/fn     built_in.clj:  348
                        boot.task.built-in/fn/fn/fn/fn/fn     built_in.clj:  348
                           boot.task.built-in/fn/fn/fn/fn     built_in.clj:  345
                      pandeiro.boot-http/eval671/fn/fn/fn    boot_http.clj:   84
                                      boot.core/run-tasks         core.clj:  938
                                        boot.core/boot/fn         core.clj:  948
                      clojure.core/binding-conveyor-fn/fn         core.clj: 1916
                                                      ...                     

Can't start repl anymore

For some reason I can't start cljs-repl anymore.

whenever I run

 boot repl 

 (start-repl)

it keeps saying:

java.lang.IllegalStateException: Can't change/establish root binding of: *cljs-repl-env* with set

The same thing happening in different projects:

for example this template is failing: boot -d seancorfield/boot-new new -t oriens -n your-app
just a few days ago it was working.
I think this is a problem related to piggiback. I still don't know how to fix it

cider-load-buffer fails with "Cannot open <nil> as a Reader"

Example project: https://github.com/darkleaf/forms/tree/cad4965c5672a011d86f970547ffe8f421e4cbe5

Steps:

  1. run docker-compose up
  2. press M-x cider-connect
  3. enter (start-repl)
  4. open localhost:3000 in browser
  5. cljs repl started and can eval commands
  6. open src/foo.cljs in emacs
  7. press C-c C-k ;; hotkey for cider-load-buffer
  8. see exception in repl buffer

Tested Cider versions: 0.14.0, 0.15.0-SNAPSHOT

Is it a bug or my mistake?

java.lang.IllegalArgumentException: Cannot open <nil> as a Reader.
	at clojure.java.io$fn__9544.invokeStatic(io.clj:288)
	at clojure.java.io$fn__9544.invoke(io.clj:288)
	at clojure.java.io$fn__9446$G__9422__9453.invoke(io.clj:69)
	at clojure.java.io$reader.invokeStatic(io.clj:102)
	at clojure.java.io$reader.doInvoke(io.clj:86)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at cljs.analyzer$parse_ns$fn__4437.invoke(analyzer.cljc:3370)
	at cljs.analyzer$parse_ns.invokeStatic(analyzer.cljc:3353)
	at cljs.analyzer$parse_ns.invoke(analyzer.cljc:3332)
	at cljs.analyzer$parse_ns.invokeStatic(analyzer.cljc:3343)
	at cljs.analyzer$parse_ns.invoke(analyzer.cljc:3332)
	at cljs.closure$src_file__GT_target_file.invokeStatic(closure.clj:2503)
	at cljs.closure$src_file__GT_target_file.invoke(closure.clj:2494)
	at cljs.closure$src_file__GT_target_file.invokeStatic(closure.clj:2496)
	at cljs.closure$src_file__GT_target_file.invoke(closure.clj:2494)
	at cljs.repl$load_file$fn__8485.invoke(repl.cljc:530)
	at cljs.repl$load_file.invokeStatic(repl.cljc:527)
	at cljs.repl$load_file.invoke(repl.cljc:519)
	at cljs.repl$fn__8530$self__8532.invoke(repl.cljc:670)
	at clojure.lang.AFn.applyToHelper(AFn.java:165)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invokeStatic(core.clj:646)
	at clojure.core$apply.invoke(core.clj:641)
	at cljs.repl$wrap_self$g__8509.invoke(repl.cljc:654)
	at cljs.repl$repl_STAR_$read_eval_print__8593.invoke(repl.cljc:857)
	at cljs.repl$repl_STAR_$fn__8599$fn__8608.invoke(repl.cljc:900)
	at cljs.repl$repl_STAR_$fn__8599.invoke(repl.cljc:899)
	at cljs.compiler$with_core_cljs.invokeStatic(compiler.cljc:1178)
	at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1167)
	at cljs.repl$repl_STAR_.invokeStatic(repl.cljc:861)
	at cljs.repl$repl_STAR_.invoke(repl.cljc:737)
	at cemerick.piggieback$run_cljs_repl.invokeStatic(piggieback.clj:169)
	at cemerick.piggieback$run_cljs_repl.invoke(piggieback.clj:155)
	at clojure.lang.AFn.applyToHelper(AFn.java:171)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invokeStatic(core.clj:650)
	at clojure.core$apply.invoke(core.clj:641)
	at cemerick.piggieback$evaluate.invokeStatic(piggieback.clj:258)
	at cemerick.piggieback$evaluate.invoke(piggieback.clj:254)
	at cemerick.piggieback$load_file.invokeStatic(piggieback.clj:284)
	at cemerick.piggieback$load_file.invoke(piggieback.clj:283)
	at clojure.lang.Var.invoke(Var.java:379)
	at cemerick.piggieback$wrap_cljs_repl$fn__9101$fn__9103$fn__9104.invoke(piggieback.clj:290)
	at cemerick.piggieback$enqueue$fn__9087.invoke(piggieback.clj:246)
	at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__1531.invoke(interruptible_eval.clj:190)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
java.lang.IllegalArgumentException: Cannot open <nil> as a Reader.
	at clojure.java.io$fn__9544.invokeStatic(io.clj:288)
	at clojure.java.io$fn__9544.invoke(io.clj:288)
	at clojure.java.io$fn__9446$G__9422__9453.invoke(io.clj:69)
	at clojure.java.io$reader.invokeStatic(io.clj:102)
	at clojure.java.io$reader.doInvoke(io.clj:86)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at cljs.analyzer$parse_ns$fn__4437.invoke(analyzer.cljc:3370)
	at cljs.analyzer$parse_ns.invokeStatic(analyzer.cljc:3353)
	at cljs.analyzer$parse_ns.invoke(analyzer.cljc:3332)
	at cljs.analyzer$parse_ns.invokeStatic(analyzer.cljc:3343)
	at cljs.analyzer$parse_ns.invoke(analyzer.cljc:3332)
	at cljs.closure$src_file__GT_target_file.invokeStatic(closure.clj:2503)
	at cljs.closure$src_file__GT_target_file.invoke(closure.clj:2494)
	at cljs.closure$src_file__GT_target_file.invokeStatic(closure.clj:2496)
	at cljs.closure$src_file__GT_target_file.invoke(closure.clj:2494)
	at cljs.repl$load_file$fn__8485.invoke(repl.cljc:530)
	at cljs.repl$load_file.invokeStatic(repl.cljc:527)
	at cljs.repl$load_file.invoke(repl.cljc:519)
	at cljs.repl$fn__8530$self__8532.invoke(repl.cljc:670)
	at clojure.lang.AFn.applyToHelper(AFn.java:165)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invokeStatic(core.clj:646)
	at clojure.core$apply.invoke(core.clj:641)
	at cljs.repl$wrap_self$g__8509.invoke(repl.cljc:654)
	at cljs.repl$repl_STAR_$read_eval_print__8593.invoke(repl.cljc:857)
	at cljs.repl$repl_STAR_$fn__8599$fn__8608.invoke(repl.cljc:900)
	at cljs.repl$repl_STAR_$fn__8599.invoke(repl.cljc:899)
	at cljs.compiler$with_core_cljs.invokeStatic(compiler.cljc:1178)
	at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1167)
	at cljs.repl$repl_STAR_.invokeStatic(repl.cljc:861)
	at cljs.repl$repl_STAR_.invoke(repl.cljc:737)
	at cemerick.piggieback$run_cljs_repl.invokeStatic(piggieback.clj:169)
	at cemerick.piggieback$run_cljs_repl.invoke(piggieback.clj:155)
	at clojure.lang.AFn.applyToHelper(AFn.java:171)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invokeStatic(core.clj:650)
	at clojure.core$apply.invoke(core.clj:641)
	at cemerick.piggieback$evaluate.invokeStatic(piggieback.clj:258)
	at cemerick.piggieback$evaluate.invoke(piggieback.clj:254)
	at cemerick.piggieback$load_file.invokeStatic(piggieback.clj:284)
	at cemerick.piggieback$load_file.invoke(piggieback.clj:283)
	at clojure.lang.Var.invoke(Var.java:379)
	at cemerick.piggieback$wrap_cljs_repl$fn__9101$fn__9103$fn__9104.invoke(piggieback.clj:290)
	at cemerick.piggieback$enqueue$fn__9087.invoke(piggieback.clj:246)
	at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__1531.invoke(interruptible_eval.clj:190)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

start-repl error

I bootstraped my project as close as the boot-cljs-example project as possible, everything works fine, but when i try to run start-repl in the boot repl -c it throws the error below:

clojure.lang.ArityException: Wrong number of args (1) passed to: closure/get-upstream-deps*

My build.boot:

(set-env!
  :source-paths   #{"src"}
  :resource-paths #{"html"}
  :dependencies '[[adzerk/boot-cljs      "0.0-2814-3" :scope "test"]
                  [adzerk/boot-cljs-repl "0.1.9"   :scope "test"]
                  [adzerk/boot-reload    "0.2.4" :scope "test"]
                  [pandeiro/boot-http    "0.6.3-SNAPSHOT" :scope "test"] ;; latest release
                  [reagent               "0.5.0-alpha3"]])

(require
  '[adzerk.boot-cljs      :refer [cljs]]
  '[adzerk.boot-cljs-repl :refer [cljs-repl start-repl]]
  '[adzerk.boot-reload    :refer [reload]]
  '[pandeiro.boot-http    :refer [serve]])

Browser console prints stop working when socket connects

There should be a way to set weasel's :print value. Currently it is not configured, so defaults to :repl. This leads to vanishing of browser logging (enabled via (enable-console-print!)) when boot-cljs-repl's script is loaded.

Repl-Env

how do you use repl-env to change the host and port you listen and serve on?

Help getting connected to a browser repl in cider

Hi! Thanks for making such awesome libraries :)

This is more of a question than an issue, so I am sorry if this is the wrong forum for it. I am trying to get started using a browser repl in emacs, I have some familiarity using cider on clojure projects, but not much with cljs. I was getting started using this template https://github.com/martinklepsch/tenzing which makes use of the cljs-repl function and many of your other boot tasks. I started by running boot dev in my terminal, which as far as I understand starts a web server, a file-watcher, calls cljs-repl, starts the live reloader and builds the project. Then, I ran cider-connect in emacs. This works and I get a browser repl after running (start-repl) in cider. However, I can't use any of the built in cider functions to send code to the repl, since it doesn't think I have a cljs repl running. Some folks in the clojurians slack channel thought I needed to call cider-jack-in to start the repl instead. This brings me to my main question,

What is the "right way" to do this? Should I cider-jack-in and then follow the steps described here https://github.com/adzerk-oss/boot-cljs-repl#the-cljs-repl-env-task ?

Any advice is greatly appreciated. Thanks!

boot-cljs-repl causes an infinite compile loop

Hello! I've started trying to experiment with boot, but I've run into an issue. My build.boot file is as follows:

(set-env!
 :source-paths #{"src/clj" "src/cljs" "src/scss"}
 :resource-paths #{"resources" "target/resources}
 :dependencies '[[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "1.7.170"]
                 [ring "1.4.0"]
                 [compojure "1.4.0"]
                 [hiccup "1.0.5"]

                                        ; boot extensions
                 [pandeiro/boot-http "0.7.1-SNAPSHOT"]
                 [mathias/boot-sassc "0.1.5"]
                 [adzerk/boot-cljs "1.7.170-3"]
                 [adzerk/boot-cljs-repl "0.3.0"]
                 [com.cemerick/piggieback "0.2.1"]
                 [weasel "0.7.0"]
                 [org.clojure/tools.nrepl "0.2.12"]])

(require '[pandeiro.boot-http :refer :all])
(require '[mathias.boot-sassc :refer :all])
(require '[adzerk.boot-cljs :refer :all])
(require '[adzerk.boot-cljs-repl :refer :all])

(require '[if-you-like-it.core])

(deftask compile-scss
  "Compile all of the scss files to the master file"
  []
  (comp 
   (sass :sass-file "application.scss"
         :output-style "compressed")
   (sift :move {#"^application.css$" "resources/public/application.css"})))

(deftask compile-cljs
  "Compile all of the cljs files to the master file"
  []
  (comp
   (cljs)
   (sift :move {#"^application.([js|out/.*])" "resources/public/application.$1"})))

(deftask run-ring 
  "Run the live-reloading development server"
  []
  (serve :port 3000
         :handler 'if-you-like-it.core/app
         :reload true))

(deftask devserver
  "Run the live-reloading development server (and wait)"
  []
  (comp (run-ring)
        (wait)))

(deftask build
  "Compile all CLJS and SCSS assets and move them to where they can be served from"
  []
  (comp (compile-scss)
        (compile-cljs)))

(deftask dev
  "Start a development environment"
  []
  (comp (run-ring)
        (watch)
        (cljs-repl)
        (build)))

All of the tasks work perfectly, except for boot dev. Everything starts up fine, but then an infinite cycle of

Adding :require adzerk.boot-cljs-repl to application.cljs.edn...
Sifting output files...
Compiling ClojureScript...
ò application.js
Sifting output files...
Elapsed time: 7.228 sec

occurs, without me changing any files. I'm not sure if the issue is due to the fact that I'm moving the files from target/ to target/resources/public/ so that they can be served by ring, but I don't believe this to be the case as it continued to occur even when removing the sift tasks and serving everything on the classpath. I'm running Windows 8.1.

More than happy to provide any additional information. Thank you!

Set port on cljs-repl

How do you set the port on the repl server?

my env is

[adzerk/boot-cljs "1.7.170-3" :scope "test"]
     [adzerk/boot-cljs-repl "0.3.2" :scope "test"]
     [com.cemerick/piggieback "0.2.1" :scope "test"]
     [weasel "0.7.0" :scope "test"]
     [org.clojure/tools.nrepl "0.2.12" :scope "test"]

tried (cljs-repl :port 9000) but doesn't seem to workas i get

nREPL server started on port 54888 on host 127.0.0.1 - nrepl://127.0.0.1:54888

Follow .cljs.edn file conventions

boot-cljs encourages specifying options in .cljs.edn files.

When doing that using boot-cljs-repl involves manually reading these options and passing them on to start-repl. Not doing so can cause all kinds of breakage that can be hard to debug. Instead of boot-cljs-repl would follow this convention things would work out of the box.

See also #49

evaluating function with REPL doesn't produce JS output

Trying to follow modern-cljs tutorial, but found a difference in the output for cljs function evaluation (see output below)

[host@user] boot repl -c
java.lang.Exception: No namespace: reply.eval-modes.nrepl found
REPL-y 0.4.1, nREPL 0.4.5
Clojure 1.10.0
Java HotSpot(TM) 64-Bit Server VM 11.0.1+13-LTS
        Exit: Control+D or (exit) or (quit)
    Commands: (user/help)
        Docs: (doc function-name-here)
              (find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
      Source: (source function-name-here)
     Javadoc: (javadoc java-object-or-class-here)
    Examples from clojuredocs.org: [clojuredocs or cdoc]
              (user/clojuredocs name-here)
              (user/clojuredocs "ns-here" "name-here")
boot.user=> (start-repl)
<< started Weasel server on ws://127.0.0.1:50186 >>
<< waiting for client to connect ... Connection is ws://localhost:50186
Writing boot_cljs_repl.cljs...
 connected! >>
To quit, type: :cljs/quit
nil
cljs.user=> (require '[modern-cljs.shopping :as shop] :reload
       #_=>                     '[domina.core :as dom] :reload
       #_=>                     '[domina.events :as evt] :reload)

cljs.user=> shop/calculate
#object[modern_cljs$shopping$calculate]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.