From 6fd3d2c850bb52a093ca142194c66f4dfe8a6d4c Mon Sep 17 00:00:00 2001 From: Brian Richter Date: Fri, 1 Mar 2024 10:06:26 -0800 Subject: [PATCH] Cache external references. --- .gitignore | 2 ++ index.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 36d62685..3546bd58 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +fonts + # Logs logs *.log diff --git a/index.js b/index.js index 00155756..1e23882f 100644 --- a/index.js +++ b/index.js @@ -13,6 +13,7 @@ module.exports = function(options = {}) { const modulePath = findPkgDir(__dirname); let config = fs.readJsonSync('./specs.json'); let assets = fs.readJsonSync(modulePath + '/src/asset-map.json'); + let externalReferences; let references = []; let definitions = []; @@ -197,8 +198,7 @@ module.exports = function(options = {}) { return fs.readFile(spec.spec_directory + _path, 'utf8').catch(e => reject(e)) })).then(async docs => { const features = (({ source, logo }) => ({ source, logo }))(spec); - let externalReferences; - if (spec.external_specs) { + if (spec.external_specs && !externalReferences) { externalReferences = await fetchExternalSpecs(spec); } let doc = docs.join("\n");