From 06db6f6afb79a721b59be04be5c42e74862877e9 Mon Sep 17 00:00:00 2001 From: Wes Todd Date: Thu, 19 Oct 2023 08:30:17 -0500 Subject: [PATCH] feat: expose dependency versions --- README.md | 51 +++++++++++++++++++++++++++++++++++++++---------- index.d.ts | 7 +++++++ index.js | 9 ++++++++- index.test-d.ts | 6 ++++++ test/index.js | 7 +++++++ 5 files changed, 69 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 63d7bad..1d76664 100644 --- a/README.md +++ b/README.md @@ -24,16 +24,47 @@ const nv = require('@pkgjs/nv') /* [ { - version: '10.16.3', - major: 10, - minor: 16, - patch: 3, - codename: 'dubnium', - versionName: 'v10', - start: 2018-04-24T00:00:00.000Z, - lts: 2018-10-30T00:00:00.000Z, - maintenance: 2020-04-01T00:00:00.000Z, - end: 2021-04-01T00:00:00.000Z + "version": "18.18.2", + "major": 18, + "minor": 18, + "patch": 2, + "tag": "", + "codename": "hydrogen", + "versionName": "v18", + "start": "2022-04-19T00:00:00.000Z", + "lts": "2022-10-25T00:00:00.000Z", + "maintenance": "2023-10-18T00:00:00.000Z", + "end": "2025-04-30T00:00:00.000Z", + "releaseDate": "2023-10-13T00:00:00.000Z", + "isLts": true, + "files": [ + "aix-ppc64", + "headers", + "linux-arm64", + "linux-armv7l", + "linux-ppc64le", + "linux-s390x", + "linux-x64", + "osx-arm64-tar", + "osx-x64-pkg", + "osx-x64-tar", + "src", + "win-x64-7z", + "win-x64-exe", + "win-x64-msi", + "win-x64-zip", + "win-x86-7z", + "win-x86-exe", + "win-x86-msi", + "win-x86-zip" + ], + "dependencies": { + "npm": "9.8.1", + "v8": "10.2.154.26", + "uv": "1.44.2", + "zlib": "1.2.13.1-motley", + "openssl": "3.0.10+quic" + } } ] */ diff --git a/index.d.ts b/index.d.ts index 75a67e4..4ebaaff 100644 --- a/index.d.ts +++ b/index.d.ts @@ -20,6 +20,13 @@ interface VersionInfo { releaseDate: Date; isLts: boolean; files: string[]; + dependencies: { + npm: string, + v8: string, + uv: string, + zlib: string, + openssl: string + }; } declare function nv(alias?: string|string[], opts?: Options): Promise; diff --git a/index.js b/index.js index ffc401e..453ffdf 100644 --- a/index.js +++ b/index.js @@ -102,7 +102,14 @@ async function getLatestVersionsByCodename (now, cache, mirror) { end: s && s.end && new Date(s.end), releaseDate: new Date(ver.date), isLts: false, - files: ver.files || [] + files: ver.files || [], + dependencies: { + npm: ver.npm, + v8: ver.v8, + uv: ver.uv, + zlib: ver.zlib, + openssl: ver.openssl + } } // All versions get added to all diff --git a/index.test-d.ts b/index.test-d.ts index f9cd7dc..f6d2b39 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -17,6 +17,12 @@ import assert from 'node:assert' assert(versions[0].releaseDate) assert(versions[0].isLts) assert(versions[0].files) + assert(versions[0].dependencies) + assert(versions[0].dependencies.npm) + assert(versions[0].dependencies.v8) + assert(versions[0].dependencies.uv) + assert(versions[0].dependencies.zlib) + assert(versions[0].dependencies.openssl) await nv('lts_active') await nv(['lts_active', 'supported']) await nv(['lts_active'], { diff --git a/test/index.js b/test/index.js index 3efcb2b..cba2ab0 100644 --- a/test/index.js +++ b/test/index.js @@ -44,6 +44,13 @@ suite('nv', () => { 'win-x86-msi', 'win-x86-zip' ]) + assert.deepStrictEqual(versions[0].dependencies, { + npm: '6.14.12', + openssl: '1.1.1k', + uv: '1.34.2', + v8: '6.8.275.32', + zlib: '1.2.11' + }) }) test('lts', async () => {