Ract

Github: https://github.com/Privoce/ract

Releases: https://github.com/Privoce/ract/releases

Ract is a conversational CLI tool written in Rust, designed to simplify the development process by providing an all-in-one solution for:

  • Integrating dependencies
  • Setting up environments
  • Generating project templates
  • Running and packaging projects

With minimal arguments and an intuitive dialog-based interface, Ract supports frameworks like GenUI and Makepad, making your development workflow smooth and efficient. 🚀

TIP

Ract is your first step to start GenUI, please choose the latest version to download

In this document, we only teach the commands and usage of Ract for GenUI projects (although they are only slightly different). For the usage of Makepad projects, please refer to: Ract Makepad

🛠️ Config

WARNING

Your computer may prompt security questions, please select Allow

The current packaging problem of Windows system has not been solved

You can configure ract as a global command in the following way:

Macos | Linux
Windows
1# copy download ract to /usr/local/bin
2sudo cp /path/to/download/ract /usr/local/bin/ract/ract
3
4# add permission
5sudo chmod 755 /usr/local/bin/ract
6sudo chmod 755 /usr/local/bin/ract/ract
7
8# confirm permission
9sudo chown -R $(whoami) /usr/local/bin/ract
10
11# echo to .zshrc
12echo 'export PATH="/usr/local/bin/ract:$PATH"' >> ~/.zshrc
13
14source ~/.zshrc
15# get version
16ract --version

🚀 Usage

init - Initialize Ract

Initialize or reset the CLI. Ract will generate:

  1. .env
  2. chain/
    • chain/env.toml
1ract init

Output:

1🚀 Start to init ract...
2✅ Chain init successfully!
3🎉 Init ract successfully!

check - Check Toolchain

Check if required tools and dependencies are installed. Options include:

  • Basic: [cargo, rustc, git]
  • Underlayer: [makepad (gen_ui, makepad)]
  • All: Combines both basic and underlayer tools.
1ract check

Interactive dialog example:

1🥳 Welcome to use ract checker!
2? Which you need to check?
3> Basic
4  Underlayer
5  All

install - Install Toolchain

Install required tools and dependencies for development. Available options:

  • Rust tools: rustc, cargo
  • Version control: git
  • Makepad-specific tools: Includes components like gen_components, wasm_build, and more.
1ract install

Interactive dialog example:

1🥳 Welcome to use ract Install!
2
3🔸 Select the tools to install:
4  - rustc
5  - cargo
6  - git
7  - makepad tools (default or custom options)
8? What tools you want to (re)install?
9> [ ] rustc|cargo
10  [ ] git
11  [x] makepad

config - Configure CLI

Set or update environment variables and CLI configurations.

TIP

In most cases, you don't need to configure anything unless you already have Ract dependencies that require special pointers.

1ract config

Interactive dialog example:

1🥳 Welcome to use ract config!
2
3🔸 env: Set the `path` for the chain env.toml file
4🔸 chain_env_toml: Set the rust dependency for GenUI toolchain
5
6> Which env file do you want to config? chain_env_toml
7> Get or Set Config? set
8> Which one do you want to config? makepad-widgets
9> Path: /Users/shengyifei/projects/makepad/makepad
10🎉 Config finish!

create - Create a GenUI or Makepad Project

Ract will build a Makepad or GenUI project template based on the configuration entered by the user

create will help you check current env states

1ract create

Interactive dialog example:

1❤️ WELOCME TO GENUI, ract is a build tool for you!
2
3> Which project you want to create? gen_ui
4> Project name: test1
5> Authors name: John
6> ...
7🎉 Your project has been created successfully!

run - Run a Project

Run Makepad or GenUI projects.

1ract run

add - add dev plugin

1ract add gen_makepad_http

wasm - Run WASM Project in Browser

Build and run a WASM project directly from the CLI.

1ract wasm

Interactive dialog example:

1🥳 Welcome to use ract wasm!
2
3🔸 Port for the web studio 8888
4📦 wasm is being packaged
5🚀 wasm is being started...
6Starting webserver on 127.0.0.1:8888

pkg - Package a Project

Package a project using cargo-packager.

1# cd to compiled project package
2cd src_gen_0
3
4ract pkg

Interactive dialog example:

1🥳 Welcome to use ract packager!
2
3🔸 gpiler will check and install `cargo-packager` if not present.
4🔸 Basic packaging configuration is auto-generated.
5? Select how to package the project: init
6🎉 Package resources have been generated!

🎯 Features

Core Features

  • Initialization: Automatically generate .env and environment templates.
  • Toolchain Check: Verify if all dependencies are installed.
  • Interactive Installation: Install only the tools you need.
  • Environment Configuration: Flexible configuration of environment paths.
  • Project Running: Run Makepad or GenUI projects with a single command.
  • WASM Support: Build and serve WASM projects in the browser.
  • Project Packaging: Streamlined packaging for distribution.
  • Watcher: Monitor changes for automatic reload.
  • Logger: Advanced logging system for debugging.

Future Features

  • Better Terminal UI: Use ratatui to optimize terminal ui.
  • Cross-platform Packaging: Simplify builds for multiple platforms.
  • Documentation: Include a comprehensive book for learning Makepad and GenUI.
  • Remote Services: Enable Ract to call some remote services.
  • Auto Update: Automatic updates to new versions.

Ract makes your Rust-based development with Makepad and GenUI easier, faster, and more efficient. 🎉

Feel free to contribute or share feedback to help us improve! 😊