From b0743491826059af39bf6fbfe9842180f3d4f650 Mon Sep 17 00:00:00 2001 From: Lloyd Brookes Date: Sun, 25 Aug 2024 22:26:32 +0100 Subject: [PATCH] update CI --- .github/workflows/node.js.yml | 5 +++-- index.js | 14 ++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 9f85963..95be9cc 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - node-version: [12, 14, 16, 18, 20, 22] + node-version: [20, 22] steps: - uses: actions/checkout@v4 @@ -26,4 +26,5 @@ jobs: node-version: ${{ matrix.node-version }} cache: 'npm' - run: npm install - - run: npm test + - run: npm i -g @75lb/nature + - run: npm run test:ci diff --git a/index.js b/index.js index 243e233..28c79cd 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,3 @@ -/** - * @module dmd - */ - const path = require('path') const Cache = require('cache-point') const DmdOptions = require('./lib/dmd-options') @@ -20,10 +16,12 @@ async function dmd (templateData, options) { if (skipCache(options)) { return generate(templateData, options) } else { - return dmd.cache.read([templateData, options, dmdVersion]) - .catch(function () { - return generate(templateData, options) - }) + try { + return dmd.cache.read([templateData, options, dmdVersion]) + } catch (err) { + /* cache miss */ + return generate(templateData, options) + } } }