Skip to content

Boot repl interface interacting a Figwheel system for ClojureScript development.

License

Notifications You must be signed in to change notification settings

ajchemist/boot-figwheel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

boot-figwheel

https://img.shields.io/clojars/v/ajchemist/boot-figwheel.svg https://circleci.com/gh/aJchemist/boot-figwheel.svg?style=shield https://img.shields.io/badge/example-build.boot-ff69b4.svg

Figwheel interface for Boot repl.

boot-figwheel currently intend to provide same api that exist in figwheel-sidecar.repl-api.

Dependencies

[ajchemist/boot-figwheel "0.5.4-6"] ;; latest release
[org.clojure/tools.nrepl "0.2.12" :scope "test"]
[com.cemerick/piggieback "0.2.1" :scope "test"]
[figwheel-sidecar "0.5.7" :scope "test"]

figwheel-sidecar whose version is above 0.5.x would be well accepted.

NOTE: After version 0.5.0, boot-figwheel changed how the REPL dependencies are handled. For now user is required to add dependencies to one’s project which are necessary libraries. figwheel task will print the required dependecies when run. This change related to this.

Usage

(require 'boot-figwheel)
(refer 'boot-figwheel :rename '{cljs-repl fw-cljs-repl}) ; avoid some symbols
(task-options!
 figwheel
 {:build-ids  ["dev"]
  :all-builds [{:id "dev"
                :source-paths ["src"]   ; cljs(cljc) directories
                :compiler {:main 'app.core
                           :output-to "app.js"}
                :figwheel {:build-id  "dev"
                           :on-jsload 'app.core/main
                           :heads-up-display true
                           :autoload true
                           :debug false}}]
  :figwheel-options {:open-file-command "emacsclient"
                     :repl true}})

When users need to change their cljsbuild config on live, just eval (task-options! :figwheel {...}) at the time, and restart the figwheel.

If a user doesn’t supply build-ids options, figwheel-system will build all build configurations.

Now start a boot repl.

boot figwheel repl

figwheel task updates :output-to compiler option so that the build output locate in :target-path (default is “target”).

After the repl is started, ordinary dev routines follow.

boot.user> (start-figwheel!)
boot.user> (start-autobuild)
boot.user> (stop-autobuild)
boot.user> (fw-cljs-repl)
cljs.core> (fig-status)
cljs.core> :cljs/quit
...
boot.user> (task-options! :figwheel {...})
...
boot.user> (stop-figwheel!)
boot.user> (start-figwheel!)

when (fw-cljs-repl) is an issue, then see #7.

Other examples

try with

boot demo

or

boot demo-figwheel repl

Change

0.5.4-6

  • When :optimizations is not :none, then :output-dir will not be configured by default.

0.5.4-5

  • Separate figwheel task into two parts, one is a preamble and another is a middleware.

0.5.4-4

  • [ BREAKING ] Integrate boot-figwheel and fw-build-once task functionalities into figwheel task.
  • Add a new figwheel task-option, called once-ids to specify configurations which are going to be built once.

So now, please change following composed task

(comp
 (figwheel)
 (boot-figwheel :ids ["main"])
 (fw-build-once :ids ["advanced"]))

to this oneliner

(figwheel :build-ids ["main"] :once-ids ["advanced"])

0.5.4-3

  • [ BREAKING ] Now users should configure their :source-paths in :all-builds task option. (get-env :source-paths) is no longer injected into user build configurations :source-paths.
  • Add new boot-figwheel task to run figwheel-system. Users can apply this task to cljs building on startup time.
  • Add new fw-build-once task to build supplied ids once. Users can also apply this task on startup time.
(comp
 (figwheel)
 (boot-figwheel :ids ["main"])          ; -> "advanced" configuration is out of autobuilder
 (fw-build-once :ids ["advanced"]))
  • [:figwheel-options :css-dirs] should have explicit configuration if a user want to figwheel css watcher feature.

0.5.4

figwheel has now new task-option target-path for specifying explicit target-path.

And when

  • [:figwheel-options :http-server-root]
  • [:figwheel-options :css-dirs]

are not specifed, boot-figwheel uses =”target”= for those.

NOTE: Boot has recently had built-in target task for explicit emitting target, so now boot-figwheel can be cooperated with built-in watch task with (target :no-clean true). #4

0.5.0-2

  • Both :output-to and :output-dir would be prefixed with :target-path whether they are specified or not.
  • Parent of :output-dir would be the same as the parent of :output-to unless :output-dir is specifed.
  • :asset-path would be prefixed with :target-path only if it’s not specified. (thx Antonis Kalou PR #2)

0.5.0

  • [ BREAKING ] Figwheel has changed a lot since 0.5.0 release. So boot-figwheel have had to adapt to it. Now boot-figwheel doesn’t make another pod for figwheel and figwheel runs on the same pod where your app runs. But figwheel-sidecar is only required when current boot task is compose of figwheel task.

License

Copyright © 2015-2016 aJchemist

Licensed under Eclipse Public License.

About

Boot repl interface interacting a Figwheel system for ClojureScript development.

Resources

License

Stars

Watchers

Forks

Packages