From a8d752aa9f96cf92a56a502aa4aa32a446d2bcf9 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Wed, 22 Oct 2025 10:33:11 +0800 Subject: [PATCH] [F] Preserve preset order in codegen --- crates/hyfetch/Cargo.toml | 2 +- crates/hyfetch/build.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/hyfetch/Cargo.toml b/crates/hyfetch/Cargo.toml index 77dddccf..67810177 100644 --- a/crates/hyfetch/Cargo.toml +++ b/crates/hyfetch/Cargo.toml @@ -41,7 +41,7 @@ unicode-segmentation = { workspace = true, features = [] } which = { workspace = true, features = [] } [build-dependencies] -indexmap = { workspace = true, features = ["std"] } +indexmap = { workspace = true, features = ["std", "serde"] } regex = { workspace = true, features = ["perf", "std", "unicode"] } unicode-normalization = { workspace = true, features = ["std"] } fs_extra = "1.3.0" diff --git a/crates/hyfetch/build.rs b/crates/hyfetch/build.rs index bfcac692..54b18a24 100644 --- a/crates/hyfetch/build.rs +++ b/crates/hyfetch/build.rs @@ -1,11 +1,10 @@ -use std::collections::HashMap; use std::env; use std::fmt::Write as _; use std::fs; use std::io::{BufWriter, Write}; use std::path::{Path, PathBuf}; -use fs_extra::dir::{CopyOptions}; +use fs_extra::dir::CopyOptions; use heck::ToUpperCamelCase; use indexmap::IndexMap; use regex::Regex; @@ -282,7 +281,7 @@ enum PresetEntry { Complex { colors: Vec, weights: Option> }, } -type PresetMap = HashMap; +type PresetMap = IndexMap; fn preset_codegen(json_path: &Path, out_path: &Path) -> Result<(), Box> { // 1. Read and parse the JSON file