mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-03-10 06:00:19 +00:00
test
This commit is contained in:
parent
2c991e42da
commit
cf909431f2
@ -24,7 +24,8 @@
|
|||||||
"typecheck": "tsc",
|
"typecheck": "tsc",
|
||||||
"typegen": "wrangler types",
|
"typegen": "wrangler types",
|
||||||
"preview": "pnpm run build && pnpm run start",
|
"preview": "pnpm run build && pnpm run start",
|
||||||
"prepare": "husky"
|
"prepare": "husky",
|
||||||
|
"clean": "node scripts/clean.js"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.18.0"
|
"node": ">=18.18.0"
|
||||||
|
45
scripts/clean.js
Normal file
45
scripts/clean.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import { rm, existsSync } from 'fs';
|
||||||
|
import { join } from 'path';
|
||||||
|
import { execSync } from 'child_process';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
import { dirname } from 'path';
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = dirname(__filename);
|
||||||
|
|
||||||
|
const dirsToRemove = ['node_modules/.vite', 'node_modules/.cache', '.cache', 'dist'];
|
||||||
|
|
||||||
|
console.log('🧹 Cleaning project...');
|
||||||
|
|
||||||
|
// Remove directories
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`Error removing ${dir}:`, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run pnpm commands
|
||||||
|
console.log('\n📦 Reinstalling dependencies...');
|
||||||
|
|
||||||
|
try {
|
||||||
|
execSync('pnpm install', { stdio: 'inherit' });
|
||||||
|
console.log('\n🗑️ Clearing pnpm cache...');
|
||||||
|
execSync('pnpm cache clean', { stdio: 'inherit' });
|
||||||
|
console.log('\n🏗️ Rebuilding project...');
|
||||||
|
execSync('pnpm build', { stdio: 'inherit' });
|
||||||
|
console.log('\n✨ Clean completed! You can now run pnpm dev');
|
||||||
|
} catch (err) {
|
||||||
|
console.error('\n❌ Error during cleanup:', err.message);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
BIN
scripts/clean.js.zip
Normal file
BIN
scripts/clean.js.zip
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user