| 27 |
27 |
|
&["geometry.css", "layout.css"],
|
| 28 |
28 |
|
REVIEWED_OVERLAPS,
|
| 29 |
29 |
|
);
|
|
30 |
+ |
makeover_build::check_vocabulary_use(
|
|
31 |
+ |
&markup_files(&frontend),
|
|
32 |
+ |
&makeover_build::Emit::default(),
|
|
33 |
+ |
DEAD_VOCABULARY_HIGH_WATER,
|
|
34 |
+ |
);
|
| 30 |
35 |
|
makeover_build::check_touch_density(frontend.join("js"));
|
| 31 |
36 |
|
|
| 32 |
37 |
|
tauri_build::build();
|
| 52 |
57 |
|
/// An entry that stops colliding fails the build, so this list cannot outlive
|
| 53 |
58 |
|
/// what it describes.
|
| 54 |
59 |
|
const REVIEWED_OVERLAPS: &[(&str, &str)] = &[("button", "color"), ("button", "cursor")];
|
|
60 |
+ |
|
|
61 |
+ |
/// How many generated classes may go unused before the build fails.
|
|
62 |
+ |
///
|
|
63 |
+ |
/// One-sided: over this fails, under it warns and asks for the seal to be
|
|
64 |
+ |
/// lowered. A build that broke on deleting dead CSS would teach the wrong
|
|
65 |
+ |
/// lesson, so the number only ever ratchets down.
|
|
66 |
+ |
///
|
|
67 |
+ |
/// Measured against [`markup_files`]: `index.html` and every `frontend/js`
|
|
68 |
+ |
/// file, which is the whole of what this app writes a class from. The `css/`
|
|
69 |
+ |
/// directory is deliberately out -- a class in a stylesheet is that class being
|
|
70 |
+ |
/// styled, not that class being emitted, and counting it would mark the whole
|
|
71 |
+ |
/// vocabulary used by definition.
|
|
72 |
+ |
///
|
|
73 |
+ |
/// This app has no described screens, so unlike goingson and the MNW server the
|
|
74 |
+ |
/// number here is the real one: nothing is emitted by a renderer at runtime
|
|
75 |
+ |
/// that a file in this repo does not name.
|
|
76 |
+ |
const DEAD_VOCABULARY_HIGH_WATER: usize = 26;
|
|
77 |
+ |
|
|
78 |
+ |
/// Every file that can carry a class name.
|
|
79 |
+ |
fn markup_files(frontend: &std::path::Path) -> Vec<std::path::PathBuf> {
|
|
80 |
+ |
let mut files = vec![frontend.join("index.html")];
|
|
81 |
+ |
let mut scripts: Vec<std::path::PathBuf> = std::fs::read_dir(frontend.join("js"))
|
|
82 |
+ |
.expect("read frontend/js")
|
|
83 |
+ |
.map(|entry| entry.expect("read frontend/js entry").path())
|
|
84 |
+ |
.filter(|path| path.extension().is_some_and(|ext| ext == "js"))
|
|
85 |
+ |
.collect();
|
|
86 |
+ |
// Sorted, or the order is the filesystem's and two machines seal against
|
|
87 |
+ |
// the same set in a different order. It makes no difference to the count
|
|
88 |
+ |
// and every difference to reading a diff of the warning.
|
|
89 |
+ |
scripts.sort();
|
|
90 |
+ |
files.extend(scripts);
|
|
91 |
+ |
files
|
|
92 |
+ |
}
|