const {
  generateMergedTranslations,
  writeTranslationsToDisk,
} = require("../../utils/packageTranslations");

const packageTranslationsPlugin = () => ({
  name: "package-translations",
  setup(build) {
    build.onStart(() => {
      const mergedTranslations = generateMergedTranslations();
      writeTranslationsToDisk(mergedTranslations);
    });
  },
});

module.exports = { packageTranslationsPlugin };
