@@ -19,6 +19,7 @@ const __dirname = dirname(__filename)
1919
2020const ROOT_DIR = join ( __dirname , '..' )
2121const DIST_DIR = join ( ROOT_DIR , 'dist' )
22+ const BUILD_DIR = join ( ROOT_DIR , 'build' )
2223const PKG_BINARIES_DIR = join ( ROOT_DIR , 'pkg-binaries' )
2324const CUSTOM_NODE_BUILD_DIR = join ( ROOT_DIR , '.custom-node-build' )
2425const NODE_MODULES_DIR = join ( ROOT_DIR , 'node_modules' )
@@ -93,9 +94,15 @@ async function cleanDist() {
9394 */
9495async function cleanPkg ( ) {
9596 console . log ( '🧹 Cleaning pkg binaries...' )
96- const removed = await removeDir ( PKG_BINARIES_DIR , 'pkg-binaries/' )
97+ let totalRemoved = 0
98+
99+ // Clean pkg-binaries directory
100+ totalRemoved += await removeDir ( PKG_BINARIES_DIR , 'pkg-binaries/' )
101+
102+ // Clean build directory
103+ totalRemoved += await removeDir ( BUILD_DIR , 'build/' )
97104
98- // Also remove any binaries in root
105+ // Also remove any binaries in root (legacy cleanup)
99106 const rootBinaries = [
100107 'socket' ,
101108 'socket-macos-arm64' ,
@@ -111,12 +118,12 @@ async function cleanPkg() {
111118 if ( existsSync ( binaryPath ) ) {
112119 // eslint-disable-next-line no-await-in-loop
113120 await rm ( binaryPath , { force : true } )
114- console . log ( ` ✅ Removed ${ binary } ` )
121+ console . log ( ` ✅ Removed ${ binary } from root (legacy) ` )
115122 }
116123 }
117124
118- if ( removed === 0 ) {
119- console . log ( ' ℹ️ pkg-binaries/ not found (already clean)' )
125+ if ( totalRemoved === 0 ) {
126+ console . log ( ' ℹ️ No pkg binaries found (already clean)' )
120127 }
121128 console . log ( )
122129}
@@ -211,7 +218,7 @@ function showHelp() {
211218 console . log ( )
212219 console . log ( 'Modes:' )
213220 console . log ( ' dist Clean rollup output (dist/)' )
214- console . log ( ' pkg Clean pkg binaries (pkg-binaries/)' )
221+ console . log ( ' pkg Clean pkg binaries (pkg-binaries/, build/ )' )
215222 console . log ( ' node Clean old Node.js builds (keep current)' )
216223 console . log ( ' caches Clean build caches' )
217224 console . log ( ' all Clean dist, pkg, old node, caches' )
0 commit comments