code: function findPackage(dir, packageName) {
      let d = dir || '.';
      do {
          let f = path.join(d, 'package.json');
          if ( fs.existsSync(f) ) {
              // require(f) would look for paths relative to this module,
              // but we need it to be relative to process.cwd()
              if ( !path.isAbsolute(f) ) {
                  f = fs.realpathSync(f);
              }
              const p = requireJSON(f);
              // Look for a specific project name
              if ( packageName ) {
                  if ( p ) {
                      if ( p.name == packageName ) {
                          return f;
                      }
                  }
              }
              // Look for any project except this one (verup)
              else {
                  if ( p ) {
                      if ( (p.extra && p.extra.verup || p.verup) && p.name != 'verup' ) {
                          return f;
                      }
                  }
              }
          }
          dir = d;
          d = path.join(d, '..');
      } while (d != dir && dir.slice(0,2) != '..');
      return false;
  }
docs: / Find package.json file in closest folder from `dir` and up.