const fs = require("fs");
const path = require("path");

(() => {
  const dirname = path.resolve(__dirname);
  try {
    const directory = fs.readdirSync(dirname, {});

    if (directory.length) {
      for (const fileName of directory) {
        if (fileName.includes(".jsx")) {
          const fileContent = fs.readFileSync(fileName, "utf-8");

          const newContent = `
          export default () => {
            return \`${fileContent}
          \`}
          `;
          fs.writeFileSync(fileName, newContent);
        }
      }
    }
  } catch (error) {
    console.log("error.message", error.message);
  }
})();
