Hey is a decentralized and permissionless social media app built with Lens Protocol 馃尶
at main 32 lines 1.0 kB view raw
1#!/usr/bin/env node 2import { readdir, rm } from "node:fs/promises"; 3import { join } from "node:path"; 4 5async function removeTargets(directory) { 6 const entries = await readdir(directory, { withFileTypes: true }); 7 await Promise.all( 8 entries.map(async (entry) => { 9 const fullPath = join(directory, entry.name); 10 if (entry.isDirectory()) { 11 if (entry.name === "node_modules" || entry.name === ".next") { 12 await rm(fullPath, { force: true, recursive: true }); 13 console.log(`Deleted ${fullPath}`); 14 } else { 15 await removeTargets(fullPath); 16 } 17 } else if ( 18 entry.name === "pnpm-lock.yaml" || 19 entry.name === "tsconfig.tsbuildinfo" 20 ) { 21 await rm(fullPath, { force: true }); 22 console.log(`Deleted ${fullPath}`); 23 } 24 }) 25 ); 26} 27 28console.log( 29 "Deleting all node_modules and pnpm-lock.yaml files recursively \ud83d\uddd1" 30); 31await removeTargets(process.cwd()); 32console.log("node_modules and pnpm-lock.yaml files deleted \ud83c\udf89");