Skip to content

Commit

Permalink
build: add format script and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
DawChihLiou committed Dec 13, 2022
1 parent f0b4ae1 commit f7f7877
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
42 changes: 32 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,54 @@
<strong>Full-text search built with Rust and WebAssemblyπŸ¦€πŸ•Έ</strong>
</div>

## Quick Start

**Step 1: Install Rustup**

Install [Rustup](https://rustup.rs). We'll use it to install dependencies. If you already installed Rustup, you can update to the latest version.

```bash
rustup update
```

**Step 2: Install Development Tools**

```bash
# Install Clippy
rustup component add clippy

# Install rustfmt
rustup component add rustfmt
```

## Available Scripts

### πŸ› οΈ Build with `yarn build`

It runs [`wasm-pack build`](https://rustwasm.github.io/wasm-pack/book/commands/build.html) to create necessary files for publishing a npm package.

### πŸ”¬ Test in Headless Browsers with `yarn test`
### πŸ§ͺ Test in Headless Browsers with `yarn test`

It runs the [end-to-end test](https://rustwasm.github.io/wasm-pack/book/commands/test.html) with headless browsers and Node.js.
It runs the [end-to-end test](https://rustwasm.github.io/wasm-pack/book/commands/test.html) with headless browsers and Node.js. The browsers are:

```
wasm-pack test --node --firefox --chrome --safari --headless
```
- Chrome
- Firefox
- Safari

You'll need to have the browsers installed in your machine to run the test script.

### 🎁 Publish to npm with `yarn publish`

It [creates a tarball and publishes on npm](https://rustwasm.github.io/wasm-pack/book/commands/pack-and-publish.html).

```
wasm-pack pack & wasm-pack publish
```

### Lint with `yarn lint`
### πŸ”¬ Lint with `yarn lint`

It runs [Clippy](https://github.com/rust-lang/rust-clippy) to lint and fix the source code.

### πŸ“ Format with `yarn format`

It runs [rustfmt](https://github.com/rust-lang/rustfmt) to format Rust code according to community style guidelines.

## πŸ”‹ Batteries Included

- [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) for communicating
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"build": "wasm-pack build",
"test": "wasm-pack test --node --firefox --chrome --safari --headless",
"publish": "wasm-pack pack && wasm-publish",
"lint": "cargo clippy --fix"
"lint": "cargo clippy --fix",
"format": "cargo fmt"
},
"config": {
"commitizen": {
Expand Down

0 comments on commit f7f7877

Please sign in to comment.