Giter Site home page Giter Site logo

golem-scala's Introduction

sbt-wasm-component

Avoid any boilerplate in your project by using just one annotation to export your Golem worker from Scala to JS.

Setup

Add sbt-wasm-component as a dependency in project/plugins.sbt:

addSbtPlugin("cloud.golem" % "sbt-wasm-component" % "x.y.z")

Usage

The WASM component plugin is automatically loaded, it just needs to be enabled with enablePlugins(WasmComponentPlugin) in your build.sbt:

ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / scalaVersion := "2.13.13"

lazy val root = (project in file("."))
  .enablePlugins(WasmComponentPlugin)

Then you will be able to annotate your Golem worker object with the @cloud.golem.WitExport annotation:

package example

@cloud.golem.WitExport
object ShoppingCart { self =>

  def initializeCart(userId: String): String = {
    println(s"Initializing cart for user $userId")
    if (math.random() > 0.1) userId
    else "Error while initializing cart"
  }
  
  // ...

}

Once done that, it will be enough to run sbt wasmComponent and the plugin will take care of exporting your worker in WASM.

golem-scala's People

Contributors

danieletorelli avatar hearnadam avatar rmmeans avatar

Stargazers

Nikolay Kushin avatar Boris Burdiliak avatar  avatar

Watchers

John A. De Goes avatar Vilmos Fehér avatar Simon Popugaev avatar Daniel Vigovszky avatar  avatar Peter Kotula avatar Afsal Thaj avatar Jorge Vásquez avatar

golem-scala's Issues

Milestones

The goal of this plugin is to enable developers to trivially publish scala code to Golem.

Requirements

  • Automatically run golem-scalajs-wit-bindgen
    • if not found in user's path, output install command
  • Automatically run componentize.js
    • Enable use of any runtime bun/node etc
  • Enable configuration of tasks

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.