# serverless-cljs-plugin

> A Serverless plugin for deploying Clojurescript functions

Latest version **0.2.2** (published 2018-01-24) · Unlicense license · 0 weekly downloads

## Install

```sh
npm install serverless-cljs-plugin
pnpm add serverless-cljs-plugin
yarn add serverless-cljs-plugin
bun add serverless-cljs-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2018-01-24 |
| First published | 2017-02-04 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0 |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+16 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 75 |
| Author | Moe Aboulkheir |
| Maintainers | moea |
| Keywords | serverless, plugin, clojure, clojurescript, aws, lambda, amazon, jvm, api gateway |

## Links

- npm: https://www.npmjs.com/package/serverless-cljs-plugin
- Repository: https://github.com/nervous-systems/serverless-cljs-plugin
- Homepage: https://github.com/nervous-systems/serverless-cljs-plugin#readme
- Issues: https://github.com/nervous-systems/serverless-cljs-plugin/issues
- npm.io page: https://npm.io/package/serverless-cljs-plugin

## Dependencies (6)

- [jszip](https://npm.io/package/jszip.md) 3.1.4
- [lodash](https://npm.io/package/lodash.md) 4.17.2
- [mkdirp](https://npm.io/package/mkdirp.md) 0.5.1
- [bluebird](https://npm.io/package/bluebird.md) 3.4.6
- [mustache](https://npm.io/package/mustache.md) 2.3.0
- [minimatch](https://npm.io/package/minimatch.md) 3.0.4

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.2.2 (latest) — 2018-01-24
- 0.2.0 — 2017-08-24
- 0.2.0-alpha.2 — 2017-08-24
- 0.2.0-alpha.1 — 2017-08-24
- 0.2.0-alpha — 2017-08-23
- 0.1.2 — 2017-02-04
- 0.1.1 — 2017-02-04
- 0.1.0 — 2017-02-04

## README

# serverless-cljs-plugin

[![npm version](https://badge.fury.io/js/serverless-cljs-plugin.svg)](https://badge.fury.io/js/serverless-cljs-plugin)

A [Serverless](https://github.com/serverless/serverless) plugin which
uses lein/[cljs-lambda](https://github.com/nervous-systems/cljs-lambda) (or,
optionally [Lumo](https://github.com/anmonteiro/lumo)) to package services
written in [Clojurescript](https://clojurescript.org/).

## JVM Template

``` shell
$ lein new serverless-cljs example
example$ lein deps
```

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.](https://nervous.io/clojurescript/lambda/2017/02/06/serverless-cljs/)

## Usage

```yaml
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](https://github.com/anmonteiro/lumo)
[compiler](https://anmonteiro.com/2017/02/compiling-clojurescript-projects-without-the-jvm/).

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

```shell
$ serverless deploy --lumo
```

Or add the following to your `serverless.yml`:

```yaml
custom:
  cljsCompiler: lumo
```

 -  _Compiler options_

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

    ```clojure
    {:source-paths ["src"]
     :compiler     {:output-to     "out/lambda.js"
                    :output-dir    "out"
                    :source-map    false ;; because of a bug in lumo <= 1.8.0
                    :target        :nodejs
                    :optimizations :none}}
    ```

 -  _Lumo Configuration_

    As an alternative to `cljsCompiler: lumo`, `cljsCompiler.lumo` may be specified
    as a map of options.  These options are passed directly to the `lumo` process.
    Currently supported:

    ```yaml
    custom:
      cljsCompiler:
        lumo:
          dependencies:
            - andare:0.7.0
          classpath:
            - /tmp/
          localRepo: /xyz
          cache: /cache | none
          index: true | false
          exitOnWarning: true | false
    ```

    _Note_: caching is always on unless you specify "none" in the config.

 -  _The index.js file_

    The `index` option will materialize a custom `index.js` in `:output-dir`'s parent folder. This
    file should be thought as managed by `serverless-cljs-plugin` and it is necessary for some plugin (e.g.: [`serverless-offline`](https://github.com/dherault/serverless-offline)) to work properly.

    _Note_: with the default compiler options, `index.js` will be saved in the project root, overwriting without warning.

 -  _Exit on compilation warnings_

    Lumo generates warnings such as `WARNING: Use of undeclared Var` to signal
    failures. You can tune the ones you want to see by using the
    [`:warnings` compiler option](https://clojurescript.org/reference/compiler-options#warnings)
    in `serverless-lumo.edn`, but by default the `lumo` process emits the warnings,
    does not throw and returns `0`. This means that `serverless` will keep going in
    presence of warnings.

## License

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

---
_Source: https://npm.io/package/serverless-cljs-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
