tinymist/scripts/build.mjs
Myriad-Dreamin 06c2240caa
Some checks failed
tinymist::auto_tag / auto-tag (push) Has been cancelled
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / announce (push) Has been cancelled
tinymist::ci / build (push) Has been cancelled
feat: customize paste behaviors in vscode (#2238)
Close #1830 and close #2063 

The hook script feature is available since `tinymist` v0.14.2.

Hook Scripts allow you to hook and customize certain behaviors of tinymist by providing code snippets that will be executed at specific events.

The hook scripts are run as typst scripts with some predefined variables. Since typst is sandboxed, the hook scripts cannot access system directly. However, you can still bind lsp commands to perform complex operations.

See https://myriad-dreamin.github.io/tinymist/feature/script-hook.html.

- [x] run a demo
- [x] finish tests
- [x] add docs
2025-11-11 20:26:58 +08:00

26 lines
864 B
JavaScript

import * as build from "./builders.mjs";
const kind = process.argv[2];
const vector = {
"build:l10n": build.buildL10n,
"build:syntax": build.buildSyntax,
"build:preview": build.buildPreview,
"build:editor-tools": build.buildEditorTools,
"build:vscode:web": build.buildTinymistVscodeWeb,
"build:vscode:system": build.buildTinymistVscodeSystem,
"build:lsp:debug": () => build.buildLspBinary("debug"),
"prelaunch:vscode": () => build.prelaunchVscode("debug"),
"prelaunch:vscode-release": () => build.prelaunchVscode("release"),
"install:vscode": () => build.installVscode("release"),
"build:web:base": build.buildWebLspBinaryBase,
"build:web": build.buildTinymistVscodeWeb,
"test:vsc": build.testTinymistVscode,
};
const fn = vector[kind];
if (fn) {
await fn();
} else {
console.error(`Unknown command: ${kind}`);
process.exit(1);
}