/** * Wipe Nest emit output + stale TypeScript incremental caches. * Incremental caches can skip emit after dist/ is deleted (empty dist, exit 0). */ const { rmSync, existsSync } = require('fs'); const path = require('path'); const root = path.join(__dirname, '..'); const targets = [ path.join(root, 'dist'), path.join(root, 'tsconfig.tsbuildinfo'), path.join(root, 'tsconfig.build.tsbuildinfo'), ]; for (const target of targets) { if (existsSync(target)) { rmSync(target, { recursive: true, force: true }); console.log('removed', path.relative(root, target) || 'dist'); } }