From fba54ac450ad4d2b4e4bdb2aa9f46fce82e4dada Mon Sep 17 00:00:00 2001 From: Dan Livings Date: Fri, 13 Sep 2024 15:20:02 +0100 Subject: [PATCH] Update dependency list to display information about new versions When available, dependencies in the list will be colour-coded using Tailwind colour names: - `sky` for up-to-date dependencies - `amber` for dependencies with minor version updates - `orange` for dependencies with major version updates - `red` for dependencies that are no longer supported - `stone` for dependencies for which no information is available The capsules containing the dependency information will use these colours. Additionally, for out-of-date dependencies, the latest version is displayed in a separate, prominently coloured capsule, with an icon as a secondary indicator of the outdatedness of the dependency. These icons are class names for [Boxicons](https://boxicons.com/) icons: - `bx-up-arrow-circle` for minor updates - `bxs-up-arrow-circle` for major updates - `bxs-x-circle` for end-of-life --- index.js | 9 +++-- index.njk | 21 ++++++++++-- utils/index.js | 80 +++++++++++++++++++++++++++++++++++++++++++-- utils/index.test.js | 5 +++ 4 files changed, 107 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 8d89854..7fb0c40 100644 --- a/index.js +++ b/index.js @@ -9,11 +9,16 @@ nunjucks.configure({ const httpServer = createServer(async (request, response) => { const pathToRepos = "./data/repos.json"; - const persistedData = await readFromJsonFile(pathToRepos); + const pathToLifetimes = "./data/lifetimes.json"; + + const [ persistedRepoData, persistedLifetimeData ] = await Promise.all([ + readFromJsonFile(pathToRepos), + readFromJsonFile(pathToLifetimes), + ]); const template = nunjucks.render( "index.njk", - mapRepoFromStorageToUi(persistedData) + mapRepoFromStorageToUi(persistedRepoData, persistedLifetimeData) ); return response.end(template); diff --git a/index.njk b/index.njk index e351c48..1d6192b 100644 --- a/index.njk +++ b/index.njk @@ -6,6 +6,7 @@ Towtruck + @@ -68,9 +69,23 @@