[F] Preserve preset order in codegen

This commit is contained in:
Azalea 2025-10-22 10:33:11 +08:00
parent c57e8a4a49
commit a8d752aa9f
2 changed files with 3 additions and 4 deletions

View File

@ -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"

View File

@ -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<String>, weights: Option<Vec<u32>> },
}
type PresetMap = HashMap<String, PresetEntry>;
type PresetMap = IndexMap<String, PresetEntry>;
fn preset_codegen(json_path: &Path, out_path: &Path) -> Result<(), Box<dyn std::error::Error>> {
// 1. Read and parse the JSON file