@proca/widget
Version:
Proca is an open-source campaign toolkit designed to empower activists and organisations in their digital advocacy efforts. It provides a flexible and customisable platform for creating and managing online petitions, email campaigns, and other forms of di
33 lines (29 loc) • 741 B
JavaScript
const { readdirSync, readFileSync, writeFileSync } = require("fs");
const getDirectories = source =>
readdirSync(source, { withFileTypes: true })
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name);
const aggregate = (nameSpace = "common") => {
const d = {};
const allLang = getDirectories(__dirname);
allLang.map(lang => {
try {
const content = readFileSync(
`${__dirname}/${lang}/${nameSpace}.json`,
"utf8"
);
d[lang] = JSON.parse(content);
} catch (e) {
if (e.code !== "ENOENT") {
throw e;
}
}
});
writeFileSync(
`${__dirname}/${nameSpace}.json`,
JSON.stringify(d, null, 2),
"utf8"
);
};
aggregate();
aggregate("eci");