code: async function createModulePackages({ from, to }) {
    const directoryPackages = glob.sync('*/index.js', { cwd: from }).map(path.dirname);
  
    await Promise.all(
      directoryPackages.map(async directoryPackage => {
        const packageJson = {
          sideEffects: false,
          module: path.join('../esm', directoryPackage, 'index.js'),
          typings: './index.d.ts',
        };
        const packageJsonPath = path.join(to, directoryPackage, 'package.json');
  
        const [typingsExist] = await Promise.all([
          fse.exists(path.join(to, directoryPackage, 'index.d.ts')),
          fse.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2)),
        ]);
  
        if (!typingsExist) {
          throw new Error(`index.d.ts for ${directoryPackage} is missing`);
        }
  
        return packageJsonPath;
      }),
    );
  }
docs: Puts a package.json into every immediate child directory of rootDir.
  That package.json contains information about esm for bundlers so that imports
  like import Typography from '@material-ui/core/Typography' are tree-shakeable.
  
  It also tests that an this import can be used in typescript by checking
  if an index.d.ts is present at that path.
  
  @param {string} rootDir