remove stale drops on build

This commit is contained in:
nicwands 2026-08-11 10:44:21 -04:00
parent da4517ed43
commit f0af90fd50

View file

@ -47,17 +47,31 @@ const buildDrop = (dropName) => {
return new Promise((resolve, reject) => {
console.log(`Building drop: ${dropName}`)
const child = spawn('npm', ['run', 'build', '-w', `drops/${dropName}`], {
// Remove old build to prevent stale output from being used
const buildDir = path.join(__dirname, `../app/public/drops/${dropName}`)
if (fs.existsSync(buildDir)) {
fs.rmSync(buildDir, { recursive: true })
}
const child = spawn(
'npm',
['run', 'build', '-w', `drops/${dropName}`],
{
stdio: 'inherit',
shell: true,
})
},
)
child.on('close', (code) => {
if (code === 0) {
console.log(`✓ Successfully built: ${dropName}`)
resolve()
} else {
reject(new Error(`Failed to build ${dropName} (exit code ${code})`))
reject(
new Error(
`Failed to build ${dropName} (exit code ${code})`,
),
)
}
})
@ -76,7 +90,10 @@ const buildAllPublishedDrops = async () => {
return
}
console.log(`Found ${publishedDrops.length} published drop(s):`, publishedDrops)
console.log(
`Found ${publishedDrops.length} published drop(s):`,
publishedDrops,
)
console.log('Starting builds...\n')
for (const dropName of publishedDrops) {