Make the web app work offline and update itself (#239)
This commit is contained in:
1 parent
09b5da3e9f
commit
4bea4c7785
14 files changed
+1246
-6
No files matched your search
+17
-2
@@ -1,6 +1,6 @@
|
||||
//! Workspace tooling: `cargo xtask <command>`.
|
||||
//!
|
||||
//! Pure Rust (std + serde_json). External tools (`cargo`) are invoked through
|
||||
//! Pure Rust (std, serde_json and sha2). External tools (`cargo`) are invoked through
|
||||
//! `std::process::Command`.
|
||||
|
||||
mod assets;
|
||||
@@ -10,6 +10,8 @@ mod i18n;
|
||||
mod layers;
|
||||
mod licences;
|
||||
mod test;
|
||||
mod web_offline;
|
||||
mod web_offline_test;
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Command, ExitCode};
|
||||
@@ -45,8 +47,15 @@ commands:
|
||||
build the tests with the ci profile, then run every test binary at once
|
||||
(and the doc tests alongside)
|
||||
wasm cargo check every library crate and the web app for wasm32-unknown-unknown
|
||||
web-offline [DIR]
|
||||
write the web build's service worker (sw.js: offline use, updates); run by
|
||||
Trunk after release builds of apps/solidcraft-web, or on a built site in DIR
|
||||
web-offline-test [--site DIR]
|
||||
check in headless Chrome that the web app works offline and updates to a new
|
||||
build (a stand-in app, or the web build in DIR such as dist/web)
|
||||
ci fmt --check, assets, licences --check, layers, clippy -D warnings, then the tests
|
||||
with the wasm check alongside (stops at the first failing step)
|
||||
with the wasm check alongside, then web-offline-test when Chrome is installed
|
||||
(stops at the first failing step)
|
||||
";
|
||||
|
||||
fn main() -> ExitCode {
|
||||
@@ -69,6 +78,11 @@ fn main() -> ExitCode {
|
||||
}
|
||||
Some("ci") => cmd_ci(),
|
||||
Some("wasm") => cmd_wasm(),
|
||||
Some("web-offline") => web_offline::run(&root(), rest.first().copied()),
|
||||
Some("web-offline-test") => {
|
||||
let site = rest.iter().position(|a| *a == "--site").and_then(|i| rest.get(i + 1)).copied();
|
||||
web_offline_test::run(&root(), site, true)
|
||||
}
|
||||
Some("-h" | "--help" | "help") | None => {
|
||||
print!("{USAGE}");
|
||||
Ok(())
|
||||
@@ -340,6 +354,7 @@ fn cmd_ci() -> Result<(), String> {
|
||||
run(c, "cargo clippy -D warnings")?;
|
||||
let (wasm, n) = wasm_check()?;
|
||||
test::run(&[], &[], vec![(format!("wasm32-unknown-unknown check ({n} crates)"), wasm), test::doc_tests(&[], &[])])?;
|
||||
web_offline_test::run(&root(), None, false)?;
|
||||
eprintln!("ci: all gates passed");
|
||||
Ok(())
|
||||
}
|
||||
Reference in new issue
Block a user