pantry/scripts/_lib.ts
2022-08-10 14:58:22 -04:00

18 lines
599 B
TypeScript

import usePantry from "hooks/usePantry.ts"
import { PackageRequirement } from "types"
export function get_build_deps(dry: Set<string>) {
const pantry = usePantry()
return async (pkg: PackageRequirement) => {
const deps = await pantry.getDeps(pkg)
if (dry.has(pkg.project)) {
// we hydrate the runtime deps of any build deps since if
// any of `dry` is a runtime dep of any build dep (obv. from another)
// pkg in the set we are building then it needs to be sorted first
return [...deps.runtime, ...deps.build]
} else {
return deps.runtime
}
}
}