deps.js
function findPackages(packagesPath) {
  return fs.readdirSync(packagesPath).reduce((acc, d) => {
    const fullpath = path.resolve(packagesPath, d);

    if (fs.statSync(fullpath).isDirectory()) {
      try {
        fs.statSync(path.resolve(fullpath, 'package.json'));
        acc.push(fullpath);
      }
      catch (err) {
        if (err.code === 'ENOENT') {
          return acc.concat(findPackages(fullpath));
        }
        throw err;
      }
    }

    return acc;
  }, []);
}
function findPackages(packagesPath) {
  return fs.readdirSync(packagesPath).reduce((acc, d) => {
    const fullpath = path.resolve(packagesPath, d);

    if (fs.statSync(fullpath).isDirectory()) {
      try {
        fs.statSync(path.resolve(fullpath, 'package.json'));
        acc.push(fullpath);
      }
      catch (err) {
        if (err.code === 'ENOENT') {
          return acc.concat(findPackages(fullpath));
        }
        throw err;
      }
    }

    return acc;
  }, []);
}
function findPackages ( packagesPath ) { return fs . readdirSync ( packagesPath ) . reduce ( ( acc , d ) => { const fullpath = path . resolve ( packagesPath , d ) ; if ( fs . statSync ( fullpath ) . isDirectory ( ) ) { try { fs . statSync ( path . resolve ( fullpath , 'package.json' ) ) ; acc . push ( fullpath ) ; } catch ( err ) { if ( err . code === 'ENOENT' ) { return acc . concat ( findPackages ( fullpath ) ) ; } throw err ; } } return acc ; } , [ ] ) ; }
Locates all packages below the specified directory
@param {string} packagesPath
@returns {Array<string>}
Locates all packages below the specified directory