Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: build
on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
check:
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: Pistonight/mono-dev/actions/setup@new_setup
with:
mono-dev: false
ecma-pnpm: true
rust: stable
- run: pnpm install
- run: task build-client
- run: task check
- run: task test
build:
strategy:
fail-fast: false
matrix:
include:
- image: ubuntu-latest
target: x64
- image: ubuntu-24.04-arm
target: arm64
- image: macos-latest
target: arm64
- image: windows-latest
target: x64
runs-on: ${{ matrix.image }}
steps:
- uses: Pistonight/mono-dev/actions/setup@new_setup
with:
mono-dev: false
ecma-pnpm: true
rust: stable
rust-native: ${{ matrix.target }}
- run: pnpm install
- run: task build-client
- uses: Pistonight/mono-dev/actions/rust-xplat@main
with:
arch: ${{ matrix.target }}
binary: shwoop


19 changes: 19 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: release
on:
push:
tags:
- v*.*.*

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- if: startsWith(github.ref, 'refs/tags/v')
uses: Pistonight/mono-dev/actions/release@main
with:
artifacts-workflow: build.yml
artifacts-path: release
pack: shwoop-*
minisign-key: ${{ secrets.MINISIGN_KEY }}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# shwoop

![Build Badge](https://img.shields.io/github/actions/workflow/status/Pistonite/shwoop/build.yml)
![Version Badge](https://img.shields.io/crates/v/shwoop)
![License Badge](https://img.shields.io/github/license/Pistonite/shwoop)
![Issue Badge](https://img.shields.io/github/issues/Pistonite/shwoop)

A development server for static web content with hot reload and optional build integration.
Perfect for developing static-content and documentation generator like `rustdoc`, `mdbook`, `typedoc`, etc.

Expand Down
7 changes: 4 additions & 3 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ tasks:

build:
- task: ecma:app-build
- cargo build
- cargo build {{.CLI_ARGS}}

build-client:
- task: ecma:app-build

run:
- task: ecma:app-build
Expand Down Expand Up @@ -55,8 +58,6 @@ tasks:
- task: git:check-modification
vars:
CHECK_MESSAGE: clean work tree is required before publishing
- git checkout dist
- git pull
- task: install
- task: check
- task: build
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/server/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub async fn websocket(

// see comment in vite.config.ts
#[path = "../../dist/metadata.rs"]
#[rustfmt::skip]
mod js_metadata;
pub fn js_source_path() -> &'static str {
js_metadata::JS_SOURCEMAP_PATH.strip_suffix(".map").unwrap()
Expand Down
8 changes: 7 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ const postProcess = (): Plugin => {
closeBundle: async () => {
const srcDir = path.resolve(import.meta.dirname, "src");
const distDir = path.resolve(import.meta.dirname, "dist");
const files = (await fs.readdir(distDir)).filter((f) => f.endsWith(".js.map"));
let files: string[] = [];
try {
files = (await fs.readdir(distDir)).filter((f) => f.endsWith(".js.map"));
} catch {
console.error("failed to read dist, not post processing");
return;
}
if (files.length === 0) {
throw new Error("No .js.map file found in dist");
}
Expand Down
Loading