Giter Club home page Giter Club logo

now-shadow-cljs's Introduction

now-shadow-cljs

A ▲ Vercel Now 2.0 builder for ClojureScript projects using shadow-clj. The builder will build your shadow-cljs targets and deploy them to ▲ Vercel Now.

Usage

  1. Create a shadow-cljs project. This builder supports building :browser and :node-library targets. If the target is :browser it will be deployed as a static page and if it is :node-library it will be deployed as a lambda function.

  2. Create a now.json file that uses @jntn/now-shadow-cljs using version 2 (This builder does not currently work with the latest version 3). Note: If you do not specify a routes section, the build output will be available under the specified output folder. For :node-library it is the :output-to path and for :browser it is the :output-dir path.

For an example using both browser and node builds, see github.com/jntn/haiku

Example now.json

{
    "version": 2,
    "name": "haiku",
    "builds": [
        {
            "src": "shadow-cljs.edn",
            "use": "@jntn/now-shadow-cljs"
        }
    ],
    "routes": [
        {
            "src": "/(.*)",
            "dest": "/public/$1"
        },
        {
            "src": "/api/(.*)",
            "dest": "/api/$1"
        }
    ]
}

Example shadow-cljs.edn

{:builds {:haikus {:target :node-library
                   ;; Will be available at "/api/haikus"
                   :output-to "api/haikus/index.js"
                   :exports-var jntn.api.haikus/handler}
          :app {:target :browser
                ;; Will by default be available at "/public" but
                ;; using the now.json above it is reached at "/"
                :output-dir "public/js"
                :asset-path "js"
                :modules {:main {:entries [jntn.app.core]}}
                :devtools {:http-root "public"
                           :proxy-url "http://localhost:3000"
                           :http-port 8000}}}}

Caveats

  • Right now the only supported build targets are :browser and :node-library.
  • The builder does not currently work with :deps true in shadow-cljs.edn.

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.