update scripts

This commit is contained in:
Somrat
2025-02-17 10:52:46 +06:00
parent c8a7a2b99f
commit 97a4189ff0
2 changed files with 19 additions and 13 deletions
+3 -11
View File
@@ -10,10 +10,6 @@ const path = require("path");
];
const configFiles = [
{
filePath: "tailwind.config.js",
patterns: ["darkmode:\\s*{[^}]*},", 'darkMode:\\s*"class",'],
},
{ filePath: "src/config/theme.json", patterns: ["colors.darkmode"] },
];
@@ -71,13 +67,9 @@ const path = require("path");
function removeDarkMode(configFile) {
const { filePath, patterns } = configFile;
if (filePath === "tailwind.config.js") {
removeDarkModeFromFiles(filePath, patterns);
} else {
const contentFile = JSON.parse(fs.readFileSync(filePath, "utf8"));
patterns.forEach((pattern) => deleteNestedProperty(contentFile, pattern));
fs.writeFileSync(filePath, JSON.stringify(contentFile));
}
const contentFile = JSON.parse(fs.readFileSync(filePath, "utf8"));
patterns.forEach((pattern) => deleteNestedProperty(contentFile, pattern));
fs.writeFileSync(filePath, JSON.stringify(contentFile));
}
function deleteNestedProperty(obj, propertyPath) {