Open History to see the last commit
1import fs from 'fs'
2import path from 'node:path'
3β
4const packagesDir = path.join(import.meta.dirname, '..', 'packages')
5β
6fs.readdir(packagesDir, { withFileTypes: true }, (err, entries) => {
7 if (err) {
8 console.error('Error reading directory:', err)
9 return
10 }
11β
12 entries.forEach((entry) => {
13 if (entry.isDirectory()) {
14 const packageJsonPath = path.join(packagesDir, entry.name, 'package.json')
15 if (!fs.existsSync(packageJsonPath)) {
16 const dirPath = path.join(packagesDir, entry.name)
17 fs.rm(dirPath, { recursive: true }, (err) => {
18 if (err) {
19 console.error(`β Error deleting directory ${dirPath}:`, err)
20 } else {
21 console.log(`β
Deleted directory: ${dirPath}`)
22 }
23 })
24 }
25 }
26 })
27})