diff --git a/apps/lightcraft-web/src/lib.rs b/apps/lightcraft-web/src/lib.rs index 04ec89b5493..58966e6e8f0 100644 --- a/apps/lightcraft-web/src/lib.rs +++ b/apps/lightcraft-web/src/lib.rs @@ -1,6 +1,6 @@ //! LightCraft in the browser: the same egui UI as the desktop app, compiled to WASM. //! -//! Build with `cargo xtask web` (→ `target/web/`), then serve that folder over HTTP (see +//! Build with `cargo xtask web` (→ `target/web-site/`), then serve that folder over HTTP (see //! `docs/web.md`). Differences from the desktop host: //! - the library lives in browser storage (OPFS, or IndexedDB where OPFS can't be written from the //! main thread): catalog journal, presets, view state and prefs are mirrored in memory and diff --git a/docs/localization-zh-hans.md b/docs/localization-zh-hans.md index 4b9d887ab57..e8743158278 100644 --- a/docs/localization-zh-hans.md +++ b/docs/localization-zh-hans.md @@ -14,7 +14,7 @@ LightCraft 的界面支持英语、简体中文、繁体中文(台湾)和日 - 尚未翻译的技术性错误、补充说明和发行说明仍以英文显示。 - 网页版将 Noto Sans CJK SC 作为独立的 `lightcraft_zh_hans.otf` 文件随站点分发,页面启动时加载; 这样可显示简体中文,也避免把约 16 MB 字体放进受单文件大小限制的 WASM。部署时需上传整个 - `target/web/` 目录。未指定 `CRAFT_FONTS_DIR` 的开发构建仍缺少中文字体。 + `target/web-site/` 目录。未指定 `CRAFT_FONTS_DIR` 的开发构建仍缺少中文字体。 - 日期分组标题与拍摄时间按中文格式显示(如 `2026年9月20日 星期日`)。 ## 翻译的维护 diff --git a/docs/web.md b/docs/web.md index 2e26f749bc6..ca0d984342a 100644 --- a/docs/web.md +++ b/docs/web.md @@ -18,7 +18,7 @@ it's missing or a different version. Build, then serve: ```sh -cargo xtask web # → /web/{index.html, worker.js, lightcraft_web.js, lightcraft_web_bg.wasm} +cargo xtask web # → /web-site/{index.html, worker.js, lightcraft_web.js, lightcraft_web_bg.wasm} cargo xtask web --serve # build, then serve on http://127.0.0.1:8080/ (or `--serve 9000`) cargo xtask web --dev # unoptimized build with debug info (faster to compile, slow to run) ``` diff --git a/packaging/web/package.sh b/packaging/web/package.sh index 8e8f0cf08a0..8b645e78a8d 100755 --- a/packaging/web/package.sh +++ b/packaging/web/package.sh @@ -15,7 +15,7 @@ if [ "${1:-}" != "--skip-build" ]; then (cd "$ROOT" && cargo xtask web) fi -SITE="$CARGO_TARGET_DIR/web" +SITE="$CARGO_TARGET_DIR/web-site" [ -f "$SITE/index.html" ] || { echo "error: $SITE/index.html missing; run without --skip-build" >&2; exit 1; } # Paths must be relative so the site works under any prefix. if grep -Eq '(src|href)="/[^/]' "$SITE/index.html"; then diff --git a/xtask/src/main.rs b/xtask/src/main.rs index cd226d6f21e..0d74f93b8a8 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -31,7 +31,7 @@ commands: Lightroom parity summary; --write refreshes the summary table in the document wasm cargo check --target wasm32-unknown-unknown for the wasm-safe crates (+ the web app) web [--serve [port]] [--dev] - build the browser app (apps/lightcraft-web) into /web/; + build the browser app (apps/lightcraft-web) into /web-site/; --serve serves it on http://127.0.0.1: (default 8080) ci fmt --check, clippy -D warnings, heif, test, parity refs, layers, assets, wasm (stops at first failure) corpus [--download] diff --git a/xtask/src/web.rs b/xtask/src/web.rs index 4e690d6341f..1cab411f102 100644 --- a/xtask/src/web.rs +++ b/xtask/src/web.rs @@ -1,5 +1,5 @@ //! `cargo xtask web`: build `apps/lightcraft-web` for wasm32 and bundle it with `wasm-bindgen` -//! into `/web/` (index.html + worker.js + lightcraft_web.js + lightcraft_web_bg.wasm), +//! into `/web-site/` (index.html + worker.js + lightcraft_web.js + lightcraft_web_bg.wasm), //! with gzip and brotli precompressed copies (`*.gz`, `*.br`) next to each file. //! `--serve [port]` then serves that folder with a tiny static HTTP server (std only) that sends //! the cross-origin isolation headers (COOP/COEP) and the precompressed files when the browser @@ -107,7 +107,9 @@ pub fn run(args: &[&str]) -> Result<(), String> { step(c, &format!("cargo build -p lightcraft-web --target {TARGET} --profile {profile}"))?; let wasm = target_dir.join(TARGET).join(if dev { "debug" } else { profile }).join("lightcraft_web.wasm"); - let out = target_dir.join("web"); + // Not "web": that is cargo's own host-artifact directory for the web profile, and a zip of + // the site would carry its deps/ and build/ out to the release (#793). + let out = target_dir.join("web-site"); std::fs::create_dir_all(&out).map_err(|e| format!("{}: {e}", out.display()))?; let mut b = Command::new("wasm-bindgen"); b.arg(&wasm).args(["--target", "web", "--no-typescript", "--out-name", "lightcraft_web", "--out-dir"]).arg(&out);