remove stale drops on build
This commit is contained in:
parent
da4517ed43
commit
f0af90fd50
1 changed files with 23 additions and 6 deletions
|
|
@ -47,17 +47,31 @@ const buildDrop = (dropName) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
console.log(`Building drop: ${dropName}`)
|
console.log(`Building drop: ${dropName}`)
|
||||||
|
|
||||||
const child = spawn('npm', ['run', 'build', '-w', `drops/${dropName}`], {
|
// Remove old build to prevent stale output from being used
|
||||||
stdio: 'inherit',
|
const buildDir = path.join(__dirname, `../app/public/drops/${dropName}`)
|
||||||
shell: true,
|
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) => {
|
child.on('close', (code) => {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
console.log(`✓ Successfully built: ${dropName}`)
|
console.log(`✓ Successfully built: ${dropName}`)
|
||||||
resolve()
|
resolve()
|
||||||
} else {
|
} 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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Found ${publishedDrops.length} published drop(s):`, publishedDrops)
|
console.log(
|
||||||
|
`Found ${publishedDrops.length} published drop(s):`,
|
||||||
|
publishedDrops,
|
||||||
|
)
|
||||||
console.log('Starting builds...\n')
|
console.log('Starting builds...\n')
|
||||||
|
|
||||||
for (const dropName of publishedDrops) {
|
for (const dropName of publishedDrops) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue