GithubHelp home page GithubHelp logo

bebo's Introduction

bebo

Deno is a modern runtime for JavaScript and TypeScript. Go to the deno website to learn more.

This is a tool to run Clojure scripts on deno using SCI.

Install from CDN

To preserve fine-grained control per script invocation, you can use the run.ts script to invoke a ClojureScript (.cljs) file:

deno run --allow-net \
     https://cdn.jsdelivr.net/npm/[email protected]/run.ts \
     https://raw.githubusercontent.com/PlumpMath/bebo/main/examples/server/example.cljs

and install this invocation as a named tool:

deno install --name server-example --allow-net \
     https://cdn.jsdelivr.net/npm/[email protected]/run.ts \
     https://raw.githubusercontent.com/PlumpMath/bebo/main/examples/server/example.cljs

To install bebo as a script runner with full access:

$ deno install --allow-all --name bebo https://cdn.jsdelivr.net/npm/[email protected]/lib/bebo_main.js

Then run bebo on a local or remote .cljs file:

$ bebo run https://raw.githubusercontent.com/PlumpMath/bebo/main/examples/server/example.cljs
Listening on http://localhost:8080/

Compile

Deno supports a compile option which lets you create a standalone executable. This has the benefit of faster startup time. One disadvantage is that you have to specify all used dependencies up front. See it as an optimization when you're done developing your application.

To do this, create a runner.js:

import { runScript } from 'https://cdn.jsdelivr.net/npm/[email protected]/lib/bebo_core.js'

// Add all modules you are going to use within .cljs scripts. They will be bundled into the executable.
import "https://deno.land/[email protected]/http/server.ts"

// The .cljs script to be invoked:
await runScript(Deno.args[0]);

Then:

$ deno compile --allow-all -o runner runner.js

Then:

./runner examples/server/example.cljs

Build and run

$ npx shadow-cljs release bebo
$ deno run --allow-read --allow-net lib/bebo_main.js examples/server/example.cljs
Listening on http://localhost:8080/

bebo's People

Contributors

borkdude avatar plumpmath avatar

Stargazers

 avatar  avatar

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.