Update README

This commit is contained in:
Tony Garnock-Jones 2022-04-22 14:15:09 +02:00
parent 6cb509ff2e
commit c25f42b30c
1 changed files with 38 additions and 4 deletions

View File

@ -4,7 +4,41 @@
To create a new program/library using Syndicate/js, use `yarn create @syndicate-lang DIRECTORY`:
yarn create @syndicate-lang myprogram
cd myprogram
yarn
node lib/index.js
```shell
yarn create @syndicate-lang myprogram
cd myprogram
yarn
yarn serve
```
Then visit <http://localhost:8000/>. By default, the generated app expects a
[syndicate-server](https://git.syndicate-lang.org/syndicate-lang/syndicate-rs/) to be running
on port 9001 exposing a dummy capability to a dataspace entity. Suitable configuration can be
found in the [`syndicate-server.config.pr`](template/syndicate-server.config.pr) file. Start
the server like this:
```shell
syndicate-server -c ./syndicate-server.config.pr
```
If you aren't writing a web app in Syndicate, you can remove the following files from the
generated module as well as the `serve` script from package.json:
- `index.html`
- `style.css`
- `rollup.config.js`
- `syndicate-server.config.pr`
In that case, your `index.ts` can be as simple as
```typescript
import { Dataspace } from "@syndicate-lang/core";
Dataspace.boot(ds => {
/* your app goes here */
});
```
If you don't need to define any Preserves
[schemas](https://preserves.gitlab.io/preserves/preserves-schema.html) in your application,
remove the `protocols/` directory as well as the various `regenerate` scripts and any mention
of the `src/gen/` directory from `package.json`.