text: const { exec } = require("child_process");
  const { technologies } = require("../constants/technologies");
  
  const sharedConfigDependencies = [
    "@typescript-eslint/eslint-plugin",
    "@typescript-eslint/parser",
    "eslint",
    "eslint-config-airbnb-typescript",
    "eslint-config-airbnb",
    "eslint-config-prettier",
    "eslint-formatter-pretty",
    "eslint-plugin-eslint-comments",
    "eslint-plugin-import",
    "eslint-plugin-prettier",
    "eslint-plugin-promise",
    "eslint-plugin-unicorn",
    "prettier",
    "prettier-eslint",
    "typescript",
    "eslint-plugin-jest",
    "jest",
  ];
  const expressConfigDependencies = ["ts-jest", "ts-node", "@types/node", "tsc", "nodemon"];
  const reactNextConfigDependencies = [
    "@testing-library/jest-dom",
    "@testing-library/react",
    "eslint-plugin-jsx-a11y",
    "eslint-plugin-react",
    "eslint-plugin-react-hooks",
  ];
  
  async function initPackageJson() {
    exec("yarn init -y", (error, stdout, stderr) => {
      if (error) {
        console.log(error.message);
        return;
      }
      if (stderr) {
        console.log(stderr);
        return;
      }
      console.log(stdout);
    });
  }
  
  async function installConfigDependencies(technology) {
    const sharedDependencies = sharedConfigDependencies.join(" ");
  
    if (technology === technologies.Express) {
      const depens = `${sharedDependencies} ${expressConfigDependencies.join(" ")}`;
  
      exec(`yarn add -D ${depens}`, (error, stdout, stderr) => {
        if (error) {
          console.log(error.message);
          return;
        }
        if (stderr) {
          console.log(stderr);
          return;
        }
        console.log(stdout);
      });
    } else if (technology === technologies.NextJS || technology === technologies.React) {
      const depens = `${sharedDependencies} ${reactNextConfigDependencies.join(" ")}`;
  
      exec(`yarn add -D ${depens}`, (error, stdout, stderr) => {
        if (error) {
          console.log(error.message);
          return;
        }
        if (stderr) {
          console.log(stderr);
          return;
        }
        console.log(stdout);
      });
    }
  }
  
  async function installDependencies(technology) {
    await initPackageJson();
    await installConfigDependencies(technology);
  }
  
  module.exports = { installDependencies };
  