pantry/scripts/utils/misc.ts
2022-10-27 18:23:32 -04:00

18 lines
552 B
TypeScript

import { usePrefix } from "hooks"
export async function overlay_this_pantry() {
const pantry_prefix = usePrefix().join("tea.xyz/var/pantry")
const self = new URL(import.meta.url).path().parent().parent().parent().join("projects")
// noop, but also THIS FUCKS SHIT UP
if (self.parent().eq(pantry_prefix)) return
const to = pantry_prefix.join("projects")
for await (const [path, {isFile}] of self.walk()) {
if (isFile) {
const dst = to.join(path.relative({ to: self }))
path.cp({ into: dst.parent().mkpath() })
}
}
}