From 05fc0e79b162ba5a7718146be84885fd8c9ea752 Mon Sep 17 00:00:00 2001 From: Oj Date: Tue, 16 Feb 2021 21:18:05 +0000 Subject: [PATCH] [Back-compat] Make old modules.json too for backwards compatibility --- src/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 92e91e5..f70a6f4 100644 --- a/src/index.js +++ b/src/index.js @@ -69,6 +69,8 @@ const getGithubInfo = async (repo) => { return info; }; +let oldTotalModulesJson = []; + for (const parentRepo of ModuleRepos) { let moduleJson = { modules: [], @@ -90,7 +92,7 @@ for (const parentRepo of ModuleRepos) { const jsHash = createHash('sha512').update(readFileSync(`${modulesDir}/${manifest.name}.js`)).digest('hex'); - moduleJson.push({ + moduleJson.modules.push({ name: manifest.name, description: manifest.description, version: manifest.version, @@ -189,6 +191,10 @@ for (const parentRepo of ModuleRepos) { } 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`); \ No newline at end of file