def package_dir

near-v-framework@0.4.0.0 · domain/architecture/system/container/effects.bend:15

import near-v-framework@0.4.0.0/domain/architecture/system/container/effects.bend as Effects
import Base
import near-v-framework@0.4.0.0/domain/architecture/system/effs/io.bend as X

15# The first of these folders with a package.json, or "" (the root).
16def package_dir(dirs: List<&2, String>, +root: String) -> IO(String):
17  match dirs:
18    case []:
19      IO.pure(String, "")
20    case +d <> rest:
21      do IO<String>:
22        text : String <- X.read(under(root, d, "package.json"))
23        later : String <- package_dir(rest, root)
24        return Bool.pick(String, String.is_empty(String.trim(text)), later, d)

Uses (10)

Used by (1)