80 lines
3.9 KiB
Markdown
80 lines
3.9 KiB
Markdown
# Application scripts
|
|
|
|
This directory contains scripts coupled to RustProxy application/build/deployment behavior.
|
|
External development and QA helpers live under `tools/`; external platform integrations live under `integrations/`.
|
|
|
|
- `runtime/` - application-owned helpers embedded or invoked by RustProxy (`acme_provider.py`).
|
|
- `build/` - build-time asset preparation used by `build.rs`.
|
|
- `deploy/` - install/update and stopped source-tree upgrade implementation.
|
|
- `migration/` - application migration utilities, currently the Nginx Proxy Manager importer.
|
|
|
|
Keep these paths stable because Rust source, `build.rs` and shell entry points reference them directly.
|
|
|
|
## Source check
|
|
|
|
`python3 scripts/preflight.py` checks that `Cargo.toml`, `build.rs`, `src/lib.rs`
|
|
and `src/main.rs` exist as files. Use `--root PATH` to check another source tree.
|
|
It does not modify files. Cargo and the build helpers validate Rust modules,
|
|
embedded documentation and generated assets during compilation.
|
|
|
|
`bash dev.sh doctor` runs this check and shows the available build tools.
|
|
|
|
## Panel stylesheet sources
|
|
|
|
The dashboard stylesheet lives in `src/admin/web/css/`, with its complete cascade
|
|
order declared in `manifest.json`. Edit those modules, not a generated bundle.
|
|
`build.rs` invokes `build/panel_css.py` using Python 3.10+ (or
|
|
`RUST_PROXY_PYTHON`) and embeds the compact `OUT_DIR/panel-style.css`. Login and
|
|
the dashboard continue to load one fingerprinted stylesheet, using the existing
|
|
panel compression and access rules; no npm install or runtime CSS imports are
|
|
needed. The documentation page retains its separate `src/admin/web/docs.css`.
|
|
|
|
```bash
|
|
python3 scripts/build/panel_css.py --check
|
|
python3 scripts/audit_css_usage.py --strict
|
|
```
|
|
|
|
The stylesheet check uses only the Python standard library. The optional
|
|
selector/structure audit needs `tinycss2` and `cssselect2`; it checks all manifest
|
|
modules together and reviews the documentation stylesheet separately. Use
|
|
`--json PATH` for selector references and `--structure-json PATH` for repeated
|
|
selectors, conditional blocks, properties and identical declaration blocks.
|
|
Missing class tokens are review candidates: classes assembled by JavaScript
|
|
must be checked before deleting their styles. Strict mode also rejects identical
|
|
declaration bodies within a compatible selector family. It permits separate
|
|
standard/WebKit/Gecko rules only when joining them would create an incompatible
|
|
vendor selector list. Choose shared-rule placement by checking the cascade,
|
|
not by mechanically moving every matching block to the beginning of a module.
|
|
|
|
The stylesheet helper rejects missing, repeated or unlisted CSS modules.
|
|
Rebuild the Rust binary after changing CSS.
|
|
|
|
Keep `scripts/__init__.py` and `scripts/build/__init__.py` in the source package.
|
|
They keep audit and packaging imports local even when unrelated Python packages
|
|
named `scripts` or `build` are installed.
|
|
|
|
### Missing generated CSS during Rust compilation
|
|
|
|
`panel-style.css` is generated inside Cargo's `OUT_DIR` by `build.rs`.
|
|
|
|
After overlaying a source ZIP onto a previously built checkout, a compiler error
|
|
for a missing `OUT_DIR/panel-style.css` can indicate an old cached build script
|
|
or a `build.rs` from another source version. Restore the complete matching
|
|
archive, including the root `build.rs`, then run from the project root:
|
|
|
|
```bash
|
|
python3 scripts/build/panel_css.py --check
|
|
touch build.rs
|
|
bash dev.sh build
|
|
```
|
|
|
|
The source ZIP uses reproducible timestamps. Cargo's
|
|
[build-script change detection](https://doc.rust-lang.org/cargo/reference/build-scripts.html#change-detection)
|
|
uses file modification times, so refreshing `build.rs` forces regeneration after
|
|
an archive overlay. This works with the target directory selected by `dev.sh`.
|
|
The generator also registers its output as a watched Cargo dependency and
|
|
recreates a removed bundle. An identical bundle keeps its modification time.
|
|
The Rust build script rejects a missing, empty or non-file output immediately
|
|
after the helper returns.
|
|
|