Skip to content

Commit

Permalink
chore: update ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari committed Feb 1, 2024
1 parent 92afc75 commit a631fc7
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 66 deletions.
47 changes: 34 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,24 @@ jobs:
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Build wasm
run: ./crates/biome_fmt/scripts/build.sh
run: |
./crates/biome_fmt/scripts/build.sh
./crates/web_fmt/scripts/build.sh
- uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
registry-url: "https://registry.npmjs.org"

- run: |
cd crates/biome_fmt/pkg
npm publish --provenance
- name: Publish biome_fmt
working-directory: crates/biome_fmt/pkg
run: npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish web_fmt
working-directory: crates/web_fmt/pkg
run: npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand All @@ -48,16 +56,24 @@ jobs:
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Build wasm
run: ./crates/biome_fmt/scripts/build.sh
run: |
./crates/biome_fmt/scripts/build.sh
./crates/web_fmt/scripts/build.sh
- uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
registry-url: "https://npm.pkg.github.com"

- run: |
cd crates/biome_fmt/pkg
npm publish
- name: Publish biome_fmt
working-directory: crates/biome_fmt/pkg
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish web_fmt
working-directory: crates/web_fmt/pkg
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -74,15 +90,20 @@ jobs:

- name: Build wasm
run: |
# build for JS API
./crates/biome_fmt/scripts/build.sh
./crates/web_fmt/scripts/build.sh
- name: Package biome_fmt
working-directory: crates/biome_fmt/pkg
run: npm pack

- name: Package
run: cd crates/biome_fmt/pkg && npm pack
- name: Package web_fmt
working-directory: crates/web_fmt/pkg
run: npm pack

- name: Release
uses: softprops/action-gh-release@c9b46fe7aad9f02afd89b12450b780f52dacfb2d
with:
files: |
crates/biome_fmt/pkg/wasm-fmt-biome_fmt-*.tgz
crates/biome_fmt/pkg/biome_fmt_bg.wasm
crates/*/pkg/*.tgz
crates/*/pkg/*.wasm
27 changes: 16 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,24 @@ jobs:
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Build wasm
run: ./crates/biome_fmt/scripts/build.sh
run: |
./crates/biome_fmt/scripts/build.sh
./crates/web_fmt/scripts/build.sh
- name: npm pack
run: cd crates/biome_fmt/pkg && npm pack
- name: Package biome_fmt
working-directory: crates/biome_fmt/pkg
run: npm pack

- name: Package web_fmt
working-directory: crates/web_fmt/pkg
run: npm pack

- name: Upload
uses: actions/upload-artifact@v4
with:
name: build
path: crates/biome_fmt/pkg
path: |
crates/biome_fmt/pkg
crates/web_fmt/pkg
node-test:
runs-on: ubuntu-latest
Expand All @@ -59,8 +67,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build
path: crates/biome_fmt/pkg/
path: crates/

- uses: actions/setup-node@v4
with:
Expand All @@ -75,8 +82,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build
path: crates/biome_fmt/pkg/
path: crates/

- uses: denoland/setup-deno@v1
with:
Expand All @@ -91,8 +97,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build
path: crates/biome_fmt/pkg/
path: crates/

- uses: oven-sh/setup-bun@v1
name: Install bun
Expand Down
21 changes: 6 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,13 @@ members = ["crates/*"]
resolver = "2"

[workspace.package]
authors = ["magic-akari <[email protected]>"]
edition = "2021"
homepage = "https://github.com/wasm-fmt/biome_fmt"
keywords = [
"wasm",
"JavaScript",
"TypeScript",
"JSX",
"TSX",
"formatter",
"Biome",
]
license = "MIT"
readme = "README.md"
authors = ["magic-akari <[email protected]>"]
edition = "2021"
homepage = "https://github.com/wasm-fmt/biome_fmt"
license = "MIT"
readme = "README.md"
repository = "https://github.com/wasm-fmt/biome_fmt"
version = "0.1.3"
version = "0.1.3"


[workspace.dependencies]
Expand Down
26 changes: 5 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
[![Test](https://github.com/wasm-fmt/biome_fmt/actions/workflows/test.yml/badge.svg)](https://github.com/wasm-fmt/biome_fmt/actions/workflows/test.yml)
[![npm](https://img.shields.io/npm/v/@wasm-fmt/biome_fmt)](https://www.npmjs.com/package/@wasm-fmt/biome_fmt)
[![npm](https://img.shields.io/npm/v/@wasm-fmt/web_fmt)](https://www.npmjs.com/package/@wasm-fmt/web_fmt)

# Install

## biome_fmt
```bash
npm install @wasm-fmt/biome_fmt
```

# Usage

```javascript
import init, { format } from "@wasm-fmt/biome_fmt";

await init();

const input = `function foo() {console.log("Hello, world!")}`;

const formatted = format(input);
console.log(formatted);
```

For Vite users:

```JavaScript
import init, { format } from "@wasm-fmt/biome_fmt/vite";

// ...
## web_fmt
```bash
npm install @wasm-fmt/web_fmt
```
8 changes: 5 additions & 3 deletions crates/biome_fmt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
[package]
description = "JavaScript/TypeScript formatter powered by wasm ported from Biome"
keywords = ["wasm", "formatter", "javascript", "typescript", "biome"]
name = "biome_fmt"

authors.workspace = true
description = "JavaScript/TypeScript formatter powered by wasm ported from Biome"
edition.workspace = true
homepage.workspace = true
keywords.workspace = true
license.workspace = true
name = "biome_fmt"
publish = true
repository.workspace = true
version.workspace = true


[features]
default = ["wasm-bindgen"]
wasm-bindgen = []
Expand Down
28 changes: 28 additions & 0 deletions crates/biome_fmt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[![npm](https://img.shields.io/npm/v/@wasm-fmt/biome_fmt)](https://www.npmjs.com/package/@wasm-fmt/biome_fmt)

# Install

```bash
npm install @wasm-fmt/biome_fmt
```

# Usage

```javascript
import init, { format } from "@wasm-fmt/biome_fmt";

await init();

const input = `function foo() {console.log("Hello, world!")}`;

const formatted = format(input);
console.log(formatted);
```

For Vite users:

```JavaScript
import init, { format } from "@wasm-fmt/biome_fmt/vite";

// ...
```
7 changes: 4 additions & 3 deletions crates/web_fmt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[package]
description = "a formatter for web development powered by wasm"
keywords = ["wasm", "formatter", "html", "css", "javascript"]
name = "web_fmt"

authors.workspace = true
description = "a formatter for web development powered by wasm"
edition.workspace = true
homepage.workspace = true
keywords.workspace = true
license.workspace = true
name = "web_fmt"
publish = true
repository.workspace = true
version.workspace = true
Expand Down
28 changes: 28 additions & 0 deletions crates/web_fmt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[![npm](https://img.shields.io/npm/v/@wasm-fmt/web_fmt)](https://www.npmjs.com/package/@wasm-fmt/web_fmt)

# Install

```bash
npm install @wasm-fmt/web_fmt
```

# Usage

```javascript
import init, { format } from "@wasm-fmt/web_fmt";

await init();

const input = `function foo() {console.log("Hello, world!")}`;

const formatted = format(input, "index.js");
console.log(formatted);
```

For Vite users:

```JavaScript
import init, { format } from "@wasm-fmt/web_fmt/vite";

// ...
```

0 comments on commit a631fc7

Please sign in to comment.