chill_hugoplate/scripts/cleanMod.js
2023-06-26 14:12:20 +06:00

15 lines
387 B
JavaScript

const fs = require("fs");
const clearMode = (filePath) => {
if (fs.existsSync(filePath)) {
let fileContent = fs.readFileSync(filePath, "utf8");
fileContent = fileContent.replace(/require\s*\([\s\S]*?\)/, "");
fs.writeFileSync(filePath, fileContent, "utf8");
} else {
console.log("File does not exist.");
}
};
clearMode("go.mod");
clearMode("exampleSite/go.mod");