-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A few more improvements before we go live (#2)
* these we for example and we do not support yet * Support 1d array property and params * only render when empty * Remove go stuff, setup test * remove output dir * cleanup comment * move tests to directory * whitespace, fix ghaction * move dummy file * update readme * change test schema * move more to xtp-bindgen
- Loading branch information
Showing
30 changed files
with
217 additions
and
1,119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Run Tests | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Extism and XTP | ||
run: | | ||
curl -O https://raw.githubusercontent.com/extism/js-pdk/main/install.sh | ||
sh install.sh | ||
curl https://static.dylibso.com/cli/install.sh | sh | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '21' | ||
|
||
- name: Build | ||
run: | | ||
npm i | ||
npm run build | ||
- name: Run test script | ||
run: | | ||
cd tests && ./test.sh | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
node_modules | ||
dist | ||
bundle.zip | ||
bundle | ||
tests/output | ||
output | ||
myplugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,29 @@ | ||
# XTP Plugin Bindgen | ||
|
||
> *Warning*: This is very experimental and is still in the prototyping phase. | ||
> *Warning*: This is experimental and is still in the alpha phase. | ||
> Changes will be made without warning. Please wait before you start writing new bindgens. | ||
This repository houses the prototype for bingden for typescript plug-ins in XTP. | ||
It's based on the [XTP Schema](https://docs.xtp.dylibso.com/docs/host-usage/xtp-schema) | ||
as the driving document. This document will be used to generate code and documentation | ||
for plug-in systems and is specifically tailored to [Extism](https://extism.org/) at the moment. | ||
|
||
When this is integrated into CLI, usage will look something like: | ||
## Building | ||
|
||
```bash | ||
xtp gen --template @dylibso/xtp-typescript-bindgen --path ~/my-plugin | ||
An XTP gen template is distributed as a zip file with a `plugin.wasm`, `config.yaml`, and a `templates` | ||
directory of template files. To build this "bundle" run the `bundle.sh` command: | ||
|
||
``` | ||
./bundle.sh | ||
``` | ||
|
||
This will grab the `bundle.zip` which contains the plugin and templates from the [latest release](https://github.com/dylibso/xtp-typescript-bindgen/releases/latest). | ||
To test you can use the XTP CLI and `plugin init`. You just need to point it at | ||
a valid [XTP Schema](https://docs.xtp.dylibso.com/docs/host-usage/xtp-schema) file: | ||
|
||
``` | ||
xtp plugin init --schema-file ./tests/schemas/fruit.yaml --template ./bundle --path myplugin -y | ||
``` | ||
|
||
[Here is my initial document](DESIGN.md) stating the design of the system. However things are changing as I'm implementing. | ||
This codebase contains a mix of go code and typescript code in order to bootstrap the system. But | ||
eventually all Go code will be genericized and moved into the XTP CLI. A generator will only be | ||
an Extism (usually TypeScript) plugin with some templates and a config file. | ||
> *Note*: If you have not installed the xtp cli: | ||
> curl https://static.dylibso.com/cli/install.sh | sudo sh | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
npm run build | ||
|
||
rm -rf bundle | ||
mkdir bundle | ||
cp -R template/ bundle/template | ||
cp dist/plugin.wasm bundle | ||
cp config.yaml bundle | ||
|
||
zip -r bundle.zip bundle/ | ||
rm -rf bundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.