❗ This book is WIP ❗
Graviton
Graviton is a cross-platform code editor that aims to be lightweight and fast. It's written in Rust and TypeScript.
Learn More
Developers
This section contains information for Developers who want to build on Graviton.
Extensions
Introduction
Third-party extensions run in a sandboxed JavaScript environment. Powered by a embedded runtime of Deno.
They are loaded pn startup from a specific folder of the user's system:
Name | Description |
---|---|
Windows | $HOME\.graviton\extensions |
Linux | $HOME/.graviton/extensions |
MacOS | $HOME/.graviton/extensions |
Creating a basic extension
Let's create a folder in our .graviton/extensions
and go inside it:
mkdir my_extension
cd my_extension
Then, we need to create a manifest file called Graviton.toml
in TOML, this file contains some identification and description metadata about the extension.
[extension]
name = "My Extension"
id = "my-extension"
author = "Jack Sparrow"
version = "0.1.0"
repository = "https://github.com/JackSparrow/graviton-extension"
main = "main.js"
And finally, we need to create the entrypoint of our extension that will be run by Graviton, let's name it main.js
, as we specified above in the manifest file:
const item = await Graviton.crateStatusbarItem("Click me!");
await item.show();
item.onClick(() => {
item.setLabel("You clicked me!")
})
Graviton.whenUnload().then(() => Graviton.exit())
Now open Graviton and you should see a new statusbar item with the text "Click me!". For each change you make you will need to reload Graviton as it doesn't provide hot reloading, yet.
For Contributors
Building 🧰
Graviton Desktop
Requisites:
- nodejs + npm (
https://nodejs.org
) - cargo (stable channel) (
https://www.rust-lang.org
) - tauri cli (
cargo install tauri-cli --version "^1.0"
) - tauri os-specific dependencies (See this)
- pnpm (
npm i -g pnpm
) - deno (See this)
- (Optional, just for tests): nextest (
cargo install cargo-nextest
)
Installing dependencies:
cd Graviton-App
pnpm install
To develop, run:
pnpm run dev_desktop
To create a binary / installer, run:
pnpm run build_desktop
To run automated tests:
pnpm test
To lint all the code:
pnpm run lint
To format all the code:
pnpm run format