[Back-compat] Make old modules.json too for backwards compatibility

This commit is contained in:
Ducko 2021-02-16 21:18:05 +00:00
parent e03ca92bd9
commit 05fc0e79b1
1 changed files with 7 additions and 1 deletions

View File

@ -69,6 +69,8 @@ const getGithubInfo = async (repo) => {
return info; return info;
}; };
let oldTotalModulesJson = [];
for (const parentRepo of ModuleRepos) { for (const parentRepo of ModuleRepos) {
let moduleJson = { let moduleJson = {
modules: [], modules: [],
@ -90,7 +92,7 @@ for (const parentRepo of ModuleRepos) {
const jsHash = createHash('sha512').update(readFileSync(`${modulesDir}/${manifest.name}.js`)).digest('hex'); const jsHash = createHash('sha512').update(readFileSync(`${modulesDir}/${manifest.name}.js`)).digest('hex');
moduleJson.push({ moduleJson.modules.push({
name: manifest.name, name: manifest.name,
description: manifest.description, description: manifest.description,
version: manifest.version, version: manifest.version,
@ -189,6 +191,10 @@ for (const parentRepo of ModuleRepos) {
} }
writeFileSync(`${distDir}/${parentRepo.filename}.json`, JSON.stringify(moduleJson)); writeFileSync(`${distDir}/${parentRepo.filename}.json`, JSON.stringify(moduleJson));
oldTotalModulesJson = oldTotalModulesJson.concat(moduleJson.modules);
} }
writeFileSync(`${distDir}/modules.json`, JSON.stringify(oldTotalModulesJson));
copyFileSync(`${__dirname.replace('/src', '')}/_headers`, `${distDir}/_headers`); copyFileSync(`${__dirname.replace('/src', '')}/_headers`, `${distDir}/_headers`);