add vm uncache command to clear the package cache
This commit is contained in:
parent
417bb666b2
commit
cfe8eab054
|
|
@ -71,4 +71,12 @@ export function register(program: Command) {
|
|||
await vm.destroy()
|
||||
console.log("✔ VM destroyed")
|
||||
})
|
||||
|
||||
vmCmd
|
||||
.command("uncache")
|
||||
.description("Clear the package cache (next create will re-download)")
|
||||
.action(async () => {
|
||||
const had = await vm.clearCache()
|
||||
console.log(had ? "✔ Package cache cleared" : "No cache to clear")
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -337,3 +337,10 @@ export async function destroy(): Promise<void> {
|
|||
await stop()
|
||||
await $`container delete ${CONTAINER_NAME}`.nothrow().quiet()
|
||||
}
|
||||
|
||||
/** Clear the package cache so the next create re-downloads everything. */
|
||||
export async function clearCache(): Promise<boolean> {
|
||||
const exists = await Bun.file(join(CACHE_DIR, 'bun')).exists()
|
||||
await $`rm -rf ${CACHE_DIR}`.nothrow().quiet()
|
||||
return exists
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user