Skip to content

Commit 63f7f81

Browse files
committed
chore: move build artifacts to dedicated build directory
- Add /build directory to .gitignore for temporary build artifacts - Update cleanup-builds.mjs to handle build directory cleanup - Move existing binaries from root to build/ directory
1 parent c4c6794 commit 63f7f81

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ pkg-binaries/
2929
# pkg/yao-pkg built binaries
3030
/socket
3131
/socket-*
32+
33+
# Build directory for temporary artifacts
34+
/build

scripts/cleanup-builds.mjs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const __dirname = dirname(__filename)
1919

2020
const ROOT_DIR = join(__dirname, '..')
2121
const DIST_DIR = join(ROOT_DIR, 'dist')
22+
const BUILD_DIR = join(ROOT_DIR, 'build')
2223
const PKG_BINARIES_DIR = join(ROOT_DIR, 'pkg-binaries')
2324
const CUSTOM_NODE_BUILD_DIR = join(ROOT_DIR, '.custom-node-build')
2425
const NODE_MODULES_DIR = join(ROOT_DIR, 'node_modules')
@@ -93,9 +94,15 @@ async function cleanDist() {
9394
*/
9495
async 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

Comments
 (0)