mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
chore: ensure clean removes directories sequentially
This commit is contained in:
parent
1d66831395
commit
ed1e5480bb
@ -1,4 +1,4 @@
|
||||
import { rm, existsSync } from 'fs';
|
||||
import { promises as fs, existsSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
import { execSync } from 'child_process';
|
||||
import { fileURLToPath } from 'url';
|
||||
@ -11,24 +11,24 @@ const dirsToRemove = ['node_modules/.vite', 'node_modules/.cache', '.cache', 'di
|
||||
|
||||
console.log('🧹 Cleaning project...');
|
||||
|
||||
// Remove directories
|
||||
for (const dir of dirsToRemove) {
|
||||
const fullPath = join(__dirname, '..', dir);
|
||||
// Remove directories sequentially
|
||||
async function removeDirectories() {
|
||||
for (const dir of dirsToRemove) {
|
||||
const fullPath = join(__dirname, '..', dir);
|
||||
|
||||
try {
|
||||
if (existsSync(fullPath)) {
|
||||
console.log(`Removing ${dir}...`);
|
||||
rm(fullPath, { recursive: true, force: true }, (err) => {
|
||||
if (err) {
|
||||
console.error(`Error removing ${dir}:`, err.message);
|
||||
}
|
||||
});
|
||||
try {
|
||||
if (existsSync(fullPath)) {
|
||||
console.log(`Removing ${dir}...`);
|
||||
await fs.rm(fullPath, { recursive: true, force: true });
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(`Error removing ${dir}:`, err.message);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(`Error removing ${dir}:`, err.message);
|
||||
}
|
||||
}
|
||||
|
||||
await removeDirectories();
|
||||
|
||||
// Run pnpm commands
|
||||
console.log('\n📦 Reinstalling dependencies...');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user