Engraft is an API that brings rich interactive tools into open-ended programming environments. Welcome!
The easiest way to start using Engraft is Graft Garden, a hosted web-app where you can create and share programs.
Engraft also has a range of embeddings so that live & rich tools can be brought to where you are already working:
A few other demos can be found at engraft.dev.
Do you want to build a tool that can be embedded inside Engraft programs? See [TODO: component dev guide].
Do you want to make your application or programming environment extensible with Engraft tools? See [TODO: host dev guide].
This section is about how to work in this repository.
First, install external prerequisites:
brew install yarn
will take care of this.Next, from the base of the repository, run:
yarn
to install dependencies,yarn testbed:dev
to start a testbed development server (after building necessary packages).Code is divided into separate packages located in the packages
directory. Each will be (TODO!) hosted on the npm registry as @engraft/PACKAGE-NAME
. Here's a quick (non-exhaustive) overview:
EngraftPromise
).@engraft
.@engraft
.EngraftContext
) with all the tools built by the Engraft team. This is probably not the way things will work long-term.FancyCodeEditor
(which powers slot
, text
, python
, etc.).Most packages (including those defining Engraft components) are libraries.
In their package.json
files, they provide build-lib
scripts which compile TypeScript from src
into JavaScript in lib
(with TypeScript declaration files and various source maps).
For a package to be compiled correctly, its dependencies must be compiled, and their dependencies, and so on. We use Lerna/nx to manage all of this automatically. To build a library and all its n-fold dependencies, run:
yarn lerna run build-lib --scope @engraft/PACKAGE-NAME
(This is admittedly a mouthful and we may make some shortcuts.)
Some packages define applications.
For these, use build-app
rather than build-lib
.
This will call Vite to bundle all our interdependent modules into JavaScript that can be loaded by the browser.
We have tests (run by Vitest) and a few other ways of checking that things are working (TypeScript, ESLint, depcheck). These should all be documented more (TODO!), but for now, just run
yarn all:checks
and make sure there aren't any errors.
Engraft has primarily been developed with VS Code, with the ESLint extension. With this setup, TypeScript language services and inline linting feedback work nicely.