This is a template to quickly start web development with Clojurescript & Firebase. It uses figwheel.main for live development and cljs-test-runner for live testing. It uses firemore to interact with Firebase. It also includes a small script allowing you to change the name of this project to something other than firemore-start-template.
Use this template by clicking on the big green button that says "Use this template" in the upper right corner.
If you are new to Clojure, installation has become very easy. Follow instructions here.
This project uses figwheel.main for development. The figwheel.main server can either be started directly from the console or emacs.
>> cd <this-project>
>> clj -m figwheel.main -b dev
emacs src/firemore-start-template/core.cljs
From within emacs, type M-x cider-jack-in-cljs and then Enter. figwheel-main is your environment and dev is your build.
After a little time a browser will open with this app loaded within it. Editing any of the files under /src or the resources/public/css/style.css file should cause those files to be live-reloaded upon save. For more information please read the figwheel.main docs (they are quite good).
Since this is a browser based application, you will need a integration test suit that runs against a real browser. We will use Chrome (in headless mode) as our testing environment. We will use Karma to manage Chrome. We will do our actual testing with cljs-test-runner.
You need chrome, npm, and node for the Karma testing. This depends on your system (Unix, Mac, Windows), follow the instructions on each.
We can install the remaining dependencies using npm. Note that you are installing the karma-cli globally (everything else is locally installed).
> npm install -g karma-cli> cd <this-directory>> npm install karma karma-chrome-launcher karma-cljs-test --save-dev
Now run the following in <this-directory>.
clojure -Atest -x chrome-headless --watch src --watch test
It will run the test once. It will re-run the test whenever any file is edited under either /src or /test. Feel free to add (or remove) locations under watch using the --watch argument.
**Warning: DO NOT SHARE YOU SECRETS WITH OTHERS. Your FIREBASE_TOKEN environment variable allows anyone to act as you with regard to firebase! **
A "Push on Master" workflow has been included in .github\workflows\master-push.yml that will attempt to push your project to firebase hosting. This workflow requires that two secret variables be set within Github. Secrets can be set in the Github page for your project under Project > Settings > Secrets.
You will need to add two environment variables named FIREBASE_PROJECT and FIREBASE_TOKEN within Secrets.
FIREBASE_PROJECTis the name of the firebase project that you want to deploy this project to.FIREBASE_TOKENis your token that was generated from running> firebase login:cifrom your terminal.
Once these two environment variables are set then Github will automatically deploy your code to firebase on every push to master. The code is compiled with advanced compilation.
Pull Request are very welcome.