code: function findPkg(fspath = process.cwd(), pkgName) {
      const res = readPkgUp.sync({ cwd: fspath, normalize: false })
      const { root } = path.parse(fspath)
      if (
          res.pkg &&
          ((res.pkg.dependencies && res.pkg.dependencies[pkgName]) ||
              (res.pkg.devDependencies && res.pkg.devDependencies[pkgName]))
      ) {
          return resolve.sync(pkgName, { basedir: res.path })
      } else if (res.path) {
          const parent = path.resolve(path.dirname(res.path), "..")
          if (parent !== root) {
              return findPkg(parent, pkgName)
          }
      }
      return
  }
docs: CREDIT: Shamelessly *borrowed* from prettier-vscode 
  Recursively search for a package.json upwards containing given package
  as a dependency or devDependency.
  @param {string} fspath file system path to start searching from
  @param {string} pkgName package's name to search for
  @returns {string} resolved path to prettier