|
@@ -1,6 +1,7 @@
|
|
|
import fs from "node:fs/promises";
|
|
import fs from "node:fs/promises";
|
|
|
import path from "path";
|
|
import path from "path";
|
|
|
import {constants} from "node:fs";
|
|
import {constants} from "node:fs";
|
|
|
|
|
+import os from "os";
|
|
|
|
|
|
|
|
import parseComponent from "./parseComponent.js";
|
|
import parseComponent from "./parseComponent.js";
|
|
|
|
|
|
|
@@ -15,6 +16,8 @@ export default async (express, options)=>{
|
|
|
|
|
|
|
|
let app = express();
|
|
let app = express();
|
|
|
|
|
|
|
|
|
|
+ removeOldTmpDirs();
|
|
|
|
|
+
|
|
|
console.time("Build time");
|
|
console.time("Build time");
|
|
|
|
|
|
|
|
await fs.rm(path.join(process.cwd(), ".build/"), {recursive: true, force: true});
|
|
await fs.rm(path.join(process.cwd(), ".build/"), {recursive: true, force: true});
|
|
@@ -67,3 +70,12 @@ const findIndexFile = async (dir)=>{
|
|
|
if(html.status === "fulfilled") return htmlPath;
|
|
if(html.status === "fulfilled") return htmlPath;
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+const removeOldTmpDirs = async ()=>{
|
|
|
|
|
+ const entries = await fs.readdir(os.tmpdir());
|
|
|
|
|
+ for(let i = 0; i < entries.length; i++){
|
|
|
|
|
+ if(entries[i].startsWith("neovan-")){
|
|
|
|
|
+ fs.rm(entries[i].name, {recursive: true, force: true});
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|