From 802e9e7fd4545e4d1adf09755727e78643a91081 Mon Sep 17 00:00:00 2001 From: Fawaz Ahmed Date: Fri, 1 Mar 2024 10:18:07 +0530 Subject: [PATCH] don't generate /currencies/{currencyCode}/{currencyCode} --- currscript.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/currscript.js b/currscript.js index c460d1b..b8c3422 100644 --- a/currscript.js +++ b/currscript.js @@ -189,19 +189,10 @@ async function generateFiles(googBingCurrJSON) { const tempObj = {} tempObj['date'] = dateToday; tempObj[fromKey] = {} - const fromKeyDir = path.join(rootDir, 'currencies', fromKey) - fs.mkdirSync(fromKeyDir, { - recursive: true - }) - for (const [toKey, toValue] of Object.entries(googBingCurrJSON)) { - const tempSingleObj = {} + for (const [toKey, toValue] of Object.entries(googBingCurrJSON)) tempObj[fromKey][toKey] = currencyValue(fromValue, toValue) - tempSingleObj['date'] = dateToday; - tempSingleObj[toKey] = tempObj[fromKey][toKey] - fs.writeFileSync(path.join(fromKeyDir, toKey + '.min.json'), JSON.stringify(tempSingleObj)) - fs.writeFileSync(path.join(fromKeyDir, toKey + '.json'), JSON.stringify(tempSingleObj, null, indent)) - } + fs.writeFileSync(path.join(currenciesDir, fromKey + '.min.json'), JSON.stringify(tempObj)) fs.writeFileSync(path.join(currenciesDir, fromKey + '.json'), JSON.stringify(tempObj, null, indent)) }