From 09bb84be128bbeecf0b1700dde934a19ebc27620 Mon Sep 17 00:00:00 2001 From: Myriad-Dreamin Date: Sat, 23 Sep 2023 00:49:00 +0800 Subject: [PATCH] chore: update build script --- README.md | 25 ++++++++++++++++++++++--- package.json | 1 + 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f0c7a452..b3408117 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,13 @@ Visualized Feature: ### Installation -Download the latest release from [GitHub Releases](https://github.com/Myriad-Dreamin/typst.ts/releases). +Install latest precompiler via cargo: + +```shell +cargo install --locked --git https://github.com/Myriad-Dreamin/typst.ts typst-ts-cli +``` + +Or Download the latest release from [GitHub Releases](https://github.com/Myriad-Dreamin/typst.ts/releases). ### CLI @@ -120,7 +126,8 @@ $ cargo run --bin typst-ts-dev-server -- run http --corpus ./fuzzers/corpora/ And open your browser to `http://localhost:20810/`. -You can also run `yarn run build-wrapper` instead of `yarn run build && yarn run link:local` to avoid building the WASM modules from source. +You can also run `yarn run build:core` instead of `npx turbo run build` to build +core library (`@myriaddreamin/typst.ts`) and avoid building the WASM modules from source. ### Example: generate documentation site for packages developers. @@ -130,7 +137,15 @@ You can also run `yarn run build-wrapper` instead of `yarn run build && yarn run ### Concept: Precompiler -The compiler is capable of producing artifact outputs from a Typst project. Thet artifact outputs can be easily distributed to remote endpoints. +The precompiler is capable of producing artifact outputs from a Typst project. Thet artifact outputs can be easily distributed to remote endpoints. + +Install latest precompiler via cargo: + +```shell +cargo install --locked --git https://github.com/Myriad-Dreamin/typst.ts typst-ts-cli +``` + +Or Download the latest release from [GitHub Releases](https://github.com/Myriad-Dreamin/typst.ts/releases). ### Concept: Renderer @@ -143,6 +158,10 @@ Import `typst.ts` in your project: ```typescript import { createTypstRenderer } from '@myriaddreamin/typst.ts'; const renderer = createTypstRenderer(); + await renderer.init(); + const svg = await renderer.runWithSession(async session => { + // do something with session + }); ``` - Using [@myriaddreamin/typst.react][npm::typst.react] diff --git a/package.json b/package.json index 14b7427c..8bd9f3bc 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "packages/templates/*" ], "scripts": { + "build:core": "yarn workspace @myriaddreamin/typst.ts build", "bump-packages": "python scripts/bump_version.py", "prepublish-packages": "turbo run prepublish", "publish:dry": "turbo run prepublish publish:dry",