function resolveRealSymlinkPaths(appDir) {
    console.log("---> Resolving symlinks");
    const dirs = [
      'internal_packages',
      'src',
      'spec',
      'node_modules',
    ];

    dirs.forEach((dir) => {
      const absoluteDir = path.join(appDir, dir);
      fs.readdirSync(absoluteDir).forEach((packageName) => {
        const relativePackageDir = path.join(dir, packageName)
        const absolutePackageDir = path.join(absoluteDir, packageName)
        const realPackagePath = fs.realpathSync(absolutePackageDir).replace('/private/', '/')
        if (realPackagePath !== absolutePackageDir) {
          console.log(`  ---> Resolving '${relativePackageDir}' to '${realPackagePath}'`)
          symlinkedPackages.push({realPackagePath, relativePackageDir})
        }
      });
    });
  }
We have to resolve the symlink paths (and cache the results) before
copying over the files since some symlinks may be relative paths (like
those created by lerna). We'll keep absolute references of those paths
for the symlink copy function to use after the packaging is complete.