automation/medusa-upstream-review
| 1 | import fs from "fs/promises" |
| 2 | import { generateHash } from "../utils" |
| 3 | import { getI18nIndexFilesFromSources } from "./helpers" |
| 4 | |
| 5 | export async function generateI18nHash(sources: Set<string>): Promise<string> { |
| 6 | const indexFiles = await getI18nIndexFilesFromSources(sources) |
| 7 | |
| 8 | const contents = await Promise.all( |
| 9 | indexFiles.map(file => fs.readFile(file, "utf-8")) |
| 10 | ) |
| 11 | |
| 12 | const totalContent = contents.join("") |
| 13 | |
| 14 | return generateHash(totalContent) |
| 15 | } |