#cargo #node #deployment #cargo-subcommand #run #electron #applications

app cargo-node

A cargo sub command to build, run and deploy rust wasm applications as browser, electron or cordova app

1 unstable release

0.1.0 Oct 4, 2019

#408 in Cargo plugins

MIT license

55KB
1.5K SLoC

cargo-node

Build and test MIT licensed

A cargo sub command to build, run and deploy rust wasm applications as browser, electron or cordova app.

Features

Currently you could use the following commands:

  • Build your project:
cargo node build
  • Run your project:
cargo node run
  • Deploy your project:
cargo node deploy

You could use the additional flags on the command line:

  • Define the target platform (electron | browser | android) default is electron:
cargo node run --target browser
  • Switch to release build:
cargo node deploy --release
  • Build, run or deploy an example:
cargo node run --example my_example

Installation

cargo install cargo node

Before you could use cargo node you have to install npm version 6.9.0. It is included in the Node.js version 10.16.3. You could download it from https://nodejs.org/dist/v10.16.3/.

Rust's cargo is presumed. All other dependencies of cargo node will be installed automatic.

Node.toml

cargo node provides an optional configuration file which you can put next to cargo's Cargo.toml.

Example:

[[apps]]
# Name of the executable
name = "my app"
# Defines the window width of the electron window
width = 300
# Defines the height of the electron window
height = 100
# Path of the assets folder with images, fonts, ...
assets = "assets/"
# Add custom fonts to your project
 [[apps.fonts]]
    font_family = "My Font"
    src = "fonts/MyFont.ttf"

Tools under the hood

License

Licensed under MIT license (LICENSE).

Dependencies

~4.5–6.5MB
~121K SLoC