GithubHelp home page GithubHelp logo

eginez / calvin Goto Github PK

View Code? Open in Web Editor NEW
186.0 7.0 9.0 120 KB

A minimalistic build tool for clojurescript projects that does not require the jvm

Shell 1.24% Clojure 98.76%
repl clojurescript planck lumo lein build-tool bootstrap

calvin's Introduction

calvin npm package

A minimalistic build tool for clojurescript in clojurescript that does not require the jvm.

Why?

In conjunction with boostrapped clojurescript calvin aims to enable a clojurescript jvm-less development environment

Current status

  1. Repls: calvin boostraps planck or lumo repls with the proper "classpath" as described in a lein project file
  2. Dependencies: calvin resolves and prints dependencies specified in lein project files
  3. Building: Calvin can now build your cljs project using the lumo build api and your lein-cljsbuild configuration. For more information look at the lumo build api

Installation

  1. Install lumo or planck

  2. Download and install via npm

Getting started

Once calvin is installed you can do this in your terminal

calvin -h

This will print out the help for calvin

Repls

To start one of the boostrapped repls you can

start a lumo repl

calvin repl

start a planck repl

calvin -p planck repl

Any remaining arguments are passed on to lumo/planck, so you can do things like

calvin repl my_script.cljs
calvin repl --dumb-terminal
calvin repl -c src -m my-project.main
calvin repl --socket-repl 3333

Dependencies

To discover the dependecies of a project

calvin deps

Calvin assumes there is a lein project file in the current directory. It will read such file and resolve transitive dependencies

Building

Build will read the cljsbuild :compiler options of yout project.clj file. Please note that some compiler options are not supported by the lumo.build.api

calvin build dev

Using node modules

Assuming npm is installed, here is an example of using an artifact from npm:

  1. Installation
npm install shelljs --save
  1. Invoking
(require '[cljs.nodejs :as node])
(def s (node/require "shelljs"))
(.echo s "foo")
  1. Latest node_modules inference in ClojureScript

ClojureScript versions 1.9.854 and after can treat node modules as namespaces.

Example cljsbuild configuration in the project.clj:

:cljsbuild {:builds
            {:dev {:source-paths ["src"]
                   :compiler {:output-to "out/main.js"
                              :main some-ns.main
                              :target :nodejs
                              ;; :npm-deps causes to treat node
                              ;; modules as proper name spaces
                              :npm-deps {:shelljs "0.7.8"}}}}}

Now the specified node module can be required like a ClojureScript namespace.

(require 'shelljs)
(shelljs/echo "foo")

Hacking

Calvin uses Figwheel for interactive development:

 lein figwheel
 node out/dev/figwheel-server.js

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.