Skip to content

Commit

Permalink
feat: expose dependency versions
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleytodd committed Oct 19, 2023
1 parent e07c8c5 commit dc42613
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 11 deletions.
51 changes: 41 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
]
*/
Expand Down
7 changes: 7 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<VersionInfo[]>;
Expand Down
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'], {
Expand Down
7 changes: 7 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit dc42613

Please sign in to comment.