Skip to content

Run Java on Cloudflare Workers with the JSweet Java to TypeScript transpiler.

License

Notifications You must be signed in to change notification settings

jairopaiva/jsweet-quickstart

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloudflare Workers / Java / JSweet quick start

This is a modification of the JSweet quick start demonstrating how to compile Java to JavaScript to run on Cloudflare Workers

Usage

> git clone https://github.com/koeninger/jsweet-quickstart
> cd jsweet-quickstart
> npm run build
> wrangler publish

You can also watch your JSweet (.java) source files for modifications using

mvn clean jsweet:watch

It will transpile automatically when you save a source file. Be sure that there are not transpilation error in your console, though.

Modify

At any time, you can modify the Java files (or add new files) and run npm run build to generate the corresponding JavaScript files.

You can modify the generation options by modifying the plugin section for jsweet-maven-plugin in pom.xml. Check the Maven plugin for the full option list.

If you want to use a JavaScript library, you must add the Maven dependency in the <dependencies> section of the pom.xml. You can copy-paste the Maven dependency description from our Candy browser, or from our online Maven repository. When running mvn generate-sources with a new library, if available in the candy, the JavaScript library will be extracted to the location given by the candiesJsOut option (here in the webapp directory). JavaScript libraries are packaged in the Jar following the WebJars conventions. When not available, you will need to find and download the JavaScript library manually (or using a third-party tool such as Bower).

Prerequisites

About

Run Java on Cloudflare Workers with the JSweet Java to TypeScript transpiler.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 67.2%
  • HTML 32.8%