From dd66c9103773564e71794f72857a235e414949b1 Mon Sep 17 00:00:00 2001 From: magic-akari Date: Mon, 14 Aug 2023 15:21:13 +0800 Subject: [PATCH] chore: update README --- README.md | 23 +++++++++++++++++++++++ crates/ruff_fmt/scripts/build.sh | 1 + 2 files changed, 24 insertions(+) diff --git a/README.md b/README.md index fd1dc9f..ad4c950 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,21 @@ const formatted = format(input); console.log(formatted); ``` +with custom options: + +```javascript +import init, { format_with_config } from "@wasm-fmt/ruff_fmt"; + +// ... +const formatted = format_with_config(input, { + indent_style: 4, + line_width: 88, + quote_style: "double", + magic_trailing_comma: "respect", +}); +console.log(formatted); +``` + For Vite users: ```JavaScript @@ -46,3 +61,11 @@ import init, { format } from "@wasm-fmt/ruff_fmt/vite"; ```bash dprint config add wasm-fmt/ruff_fmt ``` + +# How does it work? + +[Ruff] is an extremely fast Python linter, written in Rust. + +This package is a WebAssembly build of Ruff formatter, with a JavaScript wrapper. + +[Ruff]: https://github.com/astral-sh/ruff diff --git a/crates/ruff_fmt/scripts/build.sh b/crates/ruff_fmt/scripts/build.sh index 58bf725..824f94c 100755 --- a/crates/ruff_fmt/scripts/build.sh +++ b/crates/ruff_fmt/scripts/build.sh @@ -3,6 +3,7 @@ crates_dir=$(pwd) cd ../.. wasm-pack build --target=web --scope=wasm-fmt crates/ruff_fmt +cp README.md crates/ruff_fmt/pkg/ cd $crates_dir # backup ruff_fmt.js