This repository has been archived on 2024-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
fediversity.eu/scripts/clearModules.js

15 lines
396 B
JavaScript
Raw Normal View History

2024-03-26 16:28:28 +01:00
const fs = require("fs");
const clearModules = (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.");
}
};
clearModules("go.mod");
clearModules("exampleSite/go.mod");