Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rubiojr/rsx
Package your Risor scripts into a standalone Go binary
https://github.com/rubiojr/rsx
risor
Last synced: about 2 months ago
JSON representation
Package your Risor scripts into a standalone Go binary
- Host: GitHub
- URL: https://github.com/rubiojr/rsx
- Owner: rubiojr
- License: mit
- Created: 2024-09-05T11:02:12.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-10-24T11:14:52.000Z (3 months ago)
- Last Synced: 2024-10-25T10:05:23.721Z (3 months ago)
- Topics: risor
- Language: Go
- Homepage:
- Size: 380 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![logo](logo.png)
# RSX: Package Risor Scripts into Go Binaries
`rsx` is a tool that packages your [Risor](https://risor.io) scripts into a standalone Go binary, allowing for easy distribution of your applications without dependencies.
> [!NOTE]
> RSX is currently in beta.## Features
- Package Risor scripts into a single executable
- Built-in Risor modules for additional functionality
- [Worker pool](https://github.com/rubiojr/risor-libs/blob/main/docs/pool.md)
- [RSX](https://github.com/rubiojr/risor-libs/blob/main/docs/rsx.md)
- Easy project initialization and management
- Built-in SQLite support with FTS5
- Ability to external Risor native modules:```risor
import rsxrsx.load("gh:rubiojr/risor-libs/lib/test", { branch: "main" })
```
- Additional Risor Go modules included:
- [sched](https://github.com/rubiojr/risor-modules/tree/main/sched/sched.md): Schedule tasks## Pre-requisites
You need to have Go installed on your system. If you don't have it, you can download it from the [official website](https://golang.org/dl/).
## Installation
Install RSX using Go:
```bash
go install --tags fts5 github.com/rubiojr/rsx@latest
```Ensure that your Go bin directory is in your PATH.
## Quick Start
1. Create a new Risor project:
```bash
rsx new myapp
cd myapp
```2. Edit the main script (`main.risor`) to add your code:
```risor
import rsxrsx.log("Hello from Risor!")
```3. Build the Go binary:
```bash
rsx build
```> [!NOTE]
> rbx runs `go build` under the hood, so you can pass any additional environment variables to it, like `GOOS`, `GOARCH`, etc.4. Run your application:
```bash
./myapp
# Output: Hello from Risor!
```## Project Structure
- `main.risor`: The entry point of your application.
- `lib/`: Directory for additional Risor modules.## Adding custom Risor modules
Place any additional `.risor` files in the `lib` directory. They will be automatically available at runtime.
## Adding custom Risor Go modules
External Risor Go modules are supported. To add a custom Go module, follow these steps:
Add a `.modules` file in the root of your project with the following format:
```plaintext
github.com/rubiojr/risor-modules/hello
github.com/rubiojr/risor-modules/onemore
```Where each line is the Go module path used in a Go import statement.
Then, run `rsx build` to build the binary with the custom module.
Risor Go modules are regular Go modules that extend Risor functionality with new built-ins, like https://github.com/rubiojr/risor-modules/hello.
See related official documentation at https://risor.io/docs/contributing_modules.
## The RSX Module
RSX comes with a built-in `rsx` module providing basic functionality. For available functions, refer to [rsx.risor](lib/rsx.risor).
## Development Workflow
During development, you can run your Risor scripts directly:
```bash
# needs main.risor as the main entry point
rsx run
```Or you can use `eval` also:
```bash
rsx eval main.risor
```This allows for faster iteration without needing to rebuild the binary.
> [!NOTE]
> Custom native Go modules not built into RSX are not avaible with `rsx run`.
> If you are using a custom module, you will need to build the binary with `rsx build` to test it.## Projects using RSX
- [Verba](https://github.com/rubiojr/verba-go): API server to store and index Spanish RTVE news transcripts.
- [Firefox history exporter](https://github.com/rubiojr/history-exporter) - Firefox history to JSON exports.## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## Support
For issues, questions, or contributions, please [open an issue](https://github.com/rubiojr/rsx/issues) on GitHub.