Skip to content

yoav-lavi/deno-deploy-rust-template

deno-deploy-rust-template

A template for creating Deno Deploy projects in Rust

Prerequisites

Prerequisites for usage without cargo-make

Usage

Note

If using cargo make, any commands requiring deno will attempt to install deno via cargo, if it is not already installed and in your $PATH. If you want to install deno via other means and haven't already, do so before running any cargo make commands.

Using this template

cargo generate gh:yoav-lavi/deno-deploy-rust-template

Building your project

cargo make build-wasm
Manual command
rustup target add wasm32-unknown-unknown
&& cargo build --release --target wasm32-unknown-unknown
&& wasm-bindgen target/wasm32-unknown-unknown/release/{{crate_name}}.wasm --target deno --out-dir build/

Deploying to Deno Deploy

Note

Create a new token in the Deno Deploy (under "Access Tokens") and use it in place of ... in DENO_DEPLOY_TOKEN=...

If ~/.deno/bin is not in your $PATH, you will need to add it for this command to work

DENO_DEPLOY_TOKEN=... cargo make deploy
Manual command
deployctl deploy --token=... --project={{deno-deploy-project-name}} src/index.ts --exclude "target/"

Running your project with Deno

cargo make run
Manual command
deno run --allow-read --allow-net --allow-env src/index.ts

Running tests

cargo make test-rust
cargo make test-integration
Manual command
cargo test --target wasm32-unknown-unknown
deno test --allow-read --allow-net --allow-env tests/integration.ts

About

A template for creating Deno Deploy projects in Rust

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Stars

Watchers

Forks