Yarn already provides a dependency build script allow-listing function using dependienciesMeta.built
https://yarnpkg.com/configuration/manifest#dependenciesMeta.built
Would be worth looking at ways of integrating with this - maybe unifying the config?