Skip to content

This Elixir library allows you to run JS/TS code via Deno in a Port

License

Notifications You must be signed in to change notification settings

thomasif98/deno_ex

 
 

Repository files navigation

DenoEx Logo

Easily run TypeScript and Javascript using Deno right from Elixir!

Hex.pm GitHub Workflow Status (master) Coveralls master branch Support the project


Contents

Introduction

DenoEx is designed to make it simple to run scripts using Deno from your Elixir applications. Deno is a modern runtime for JavaScript and TypeScript that uses V8 and built-in Rust. It is secure by default, so you must opt into each level of access your scripts need when running. This includes reading environment variables.

Installation

The package can be installed by adding deno_ex to your list of dependencies in mix.exs:

def deps do
  [
    {:deno_ex, "~> 0.1.0"}
  ]
end

Installing the Runtime

By default Deno will automatically be installed in the package's priv directory as part of the compilation process. If you would like the build to place Deno in a different directory you may configure it. See the "Configuration" section of DenoEx.

Using DenoEx to Install Copies of the Runtime

Once you have DenoEx, you will need the Deno runtime. We have created a mix task that you can use to install Deno. By default, Deno will be installed in the priv directory for the deno_ex dependency. my_project/_build/dev/lib/deno_ex/priv/bin

mix deno_ex.install

The installation path may be changed using --path <path>. Permissions may also be changed on the deno executable using --chmod <octal>. The default permissions are 0x770.

Supporting DenoEx

If you rely on this library to run TypeScript and Javascript within your application, it would much appreciated if you can give back to the project in order to help ensure its continued development.

Checkout my GitHub Sponsorship page if you want to help out!

Gold Sponsors

Support the project

Silver Sponsors

Support the project

Bronze Sponsors

Support the project

Using DenoEx

Create a Typescript file with the following contents.

console.log("Hello, world.")

Open iex using iex -S mix and then run the TypeScript file:

iex > DenoEx.run({:file, "path/to/file.ts"})

About

This Elixir library allows you to run JS/TS code via Deno in a Port

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Elixir 96.3%
  • TypeScript 3.7%