why not use https://www.npmjs.org/package/findup-sync ?