node package manager
Easy sharing. Manage teams and permissions with one click. Create a free org »

serverless-cljs-plugin

serverless-cljs-plugin

npm version

A Serverless plugin which uses lein/cljs-lambda (or, optionally Lumo) to package services written in Clojurescript.

JVM Template

$ lein new serverless-cljs example

Will generate an example directory containing a minimal serverless.yml and project.clj demonstrating this plugin's functionality.

Guide to using the plugin on the JVM.

Usage

functions:
  echo:
    cljs: example.core/echo
 
plugins:
 - serverless-cljs-plugin

With the above serverless.yml, serverless deploy will create a zip file containing your functions. Doing this is similar to setting the Serverless packaging.artifact option - cljs-lambda is responsible for the zip contents, and Serverless includes/excludes will be skipped (cljs-lambda offers equivalent functionality).

In the example above, there needn't be a corresponding entry for echo in project.clj.

Lumo

Alternatively you can use the Lumo compiler.

In order to enable it, pass the --lumo switch to either deploy or package:

$ serverless deploy --lumo

Or add the following to your serverless.yml:

custom:
  cljsCompiler: lumo

The source paths and compiler options will be read from the optional file serverless-lumo.edn. Below are the defaults:

{:source-paths ["src"] 
 :compiler     {:output-to     "out/lambda.js" 
                :output-dir    "out" 
                :source-map    false ;; lumo bug #132
                :target        :nodejs 
                :optimizations :none}} 

License

serverless-cljs-plugin is free and unencumbered public domain software. For more information, see http://unlicense.org/ or the accompanying LICENSE file.