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

app cargo-node

一个 cargo 子命令,用于构建、运行和部署作为浏览器、electron 或 cordova 应用程序的 rust wasm 应用

1 个不稳定版本

0.1.0 2019年10月4日

#408 in Cargo 插件

MIT 许可证

55KB
1.5K SLoC

cargo-node

Build and test MIT licensed

一个 cargo 子命令,用于构建、运行和部署作为浏览器、electron 或 cordova 应用程序的 rust wasm 应用。

功能

目前你可以使用以下命令

  • 构建你的项目
cargo node build
  • 运行你的项目
cargo node run
  • 部署你的项目
cargo node deploy

你可以在命令行上使用额外的标志

  • 定义目标平台(electron | browser | android),默认为 electron
cargo node run --target browser
  • 切换到发布构建
cargo node deploy --release
  • 构建、运行或部署示例
cargo node run --example my_example

安装

cargo install cargo node

在你能使用 cargo node 之前,你必须安装 npm 版本 6.9.0。它包含在 Node.js 版本 10.16.3 中。你可以从 https://node.org.cn/dist/v10.16.3/ 下载。

假设你已经安装了 Rust 的 cargo。cargo node 的所有其他依赖都将自动安装。

Node.toml

cargo node 提供了一个可选的配置文件,你可以将其放在 cargoCargo.toml 旁边。

示例

[[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"

底层的工具

许可证

根据 MIT 许可证授权(LICENSE)。

依赖项

~4.5–6.5MB
~121K SLoC