const fs = require('fs');
const path = require('path');
const componentDir = 'es';
const cModuleNames = fs.readdirSync(path.resolve(componentDir));

cModuleNames.forEach((name) => {
  if (name !== 'index' && fs.statSync(path.resolve(`${componentDir}/${name}`)).isDirectory()) {
    const dir = `${componentDir}/${name}/style/css.js`;
    fs.writeFileSync(path.resolve(dir), `require("./index.css")`);
  }
});

