mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 11:35:13 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
function removeAllChildren(targetDir) {
|
||||
if (!fs.existsSync(targetDir)) return;
|
||||
for (const item of fs.readdirSync(targetDir)) {
|
||||
const itemPath = path.join(targetDir, item);
|
||||
fs.rmSync(itemPath, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
|
||||
function cleanBuildOutput() {
|
||||
const projectRoot = path.resolve("..");
|
||||
const auroraDir = path.join(projectRoot, "htdocs", "luci-static", "aurora");
|
||||
const resourcesDir = path.join(
|
||||
projectRoot,
|
||||
"htdocs",
|
||||
"luci-static",
|
||||
"resources",
|
||||
);
|
||||
|
||||
console.log("🧹 start clean build output...");
|
||||
|
||||
if (fs.existsSync(auroraDir)) {
|
||||
for (const item of fs.readdirSync(auroraDir)) {
|
||||
if (item !== "public") {
|
||||
const itemPath = path.join(auroraDir, item);
|
||||
console.log(` remove: ${itemPath}`);
|
||||
fs.rmSync(itemPath, { recursive: true, force: true });
|
||||
} else {
|
||||
console.log(` keep: ${path.join(auroraDir, "public")}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!fs.existsSync(resourcesDir)) {
|
||||
fs.mkdirSync(resourcesDir, { recursive: true });
|
||||
} else {
|
||||
console.log(` clean: ${resourcesDir}/*`);
|
||||
removeAllChildren(resourcesDir);
|
||||
}
|
||||
|
||||
console.log("✅ clean build output done!");
|
||||
}
|
||||
|
||||
cleanBuildOutput();
|
||||
Reference in new issue
Block a user