diff --git a/HISTORY.md b/HISTORY.md index beb3c7e7..14011633 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,13 @@ All notable changes to this project will be documented in this file. +* Refactor + * Add typing to internal function `getBuildtimeInfo` (via [#345]) +* Dependencies + * Upgraded runtime-dependency `@cyclonedx/cyclonedx-library@^8.5.0`, was `@^8.4.0` (via [#345]) + +[#345]: https://github.com/CycloneDX/cyclonedx-node-yarn/pull/345 + ## 3.1.0 - 2025-06-16 * Changed diff --git a/package.json b/package.json index 16435d92..4b55f462 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ } ], "dependencies": { - "@cyclonedx/cyclonedx-library": "^8.4.0", + "@cyclonedx/cyclonedx-library": "^8.5.0", "@yarnpkg/cli": "^4", "@yarnpkg/core": "^4", "@yarnpkg/fslib": "^3", diff --git a/src/_buildtimeInfo.ts b/src/_buildtimeInfo.ts index 13190c83..45fd88e9 100644 --- a/src/_buildtimeInfo.ts +++ b/src/_buildtimeInfo.ts @@ -17,11 +17,14 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -/* eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- dynamic import helper */ -export async function getBuildtimeInfo () { - /* - The included file is generated by `../tools/gather-buildtime-info.cjs`. - Its content is pseudo-dynamic and so is the return type of this function. - */ - return (await import('./__buildtimeInfo.json')).default +import type { NodePackageJson } from "@cyclonedx/cyclonedx-library/Types"; + +interface BuildtimeInfo { + self: NodePackageJson + [key: string]: NodePackageJson +} + +export async function getBuildtimeInfo (): Promise { + /* if this fails, run `yarn run build:gbti` in your dev-env */ + return (await import('./__buildtimeInfo.json')).default satisfies BuildtimeInfo } diff --git a/yarn.lock b/yarn.lock index 7ea62d66..06917cee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -172,9 +172,9 @@ __metadata: languageName: node linkType: hard -"@cyclonedx/cyclonedx-library@npm:^8.4.0": - version: 8.4.0 - resolution: "@cyclonedx/cyclonedx-library@npm:8.4.0" +"@cyclonedx/cyclonedx-library@npm:^8.5.0": + version: 8.5.0 + resolution: "@cyclonedx/cyclonedx-library@npm:8.5.0" dependencies: ajv: "npm:^8.12.0" ajv-formats: "npm:^3.0.1" @@ -194,7 +194,7 @@ __metadata: optional: true xmlbuilder2: optional: true - checksum: 10c0/e9ab0a2112ee3f3c2ab01c1fc8cd3d34b9fdc7b4d663c5c86fb20839020cbf55028c53cb64ae42d033a25247810cadc9180f17d3973a37d0e3c0786f7626db28 + checksum: 10c0/b43732f1a36bdf5e42c321e629b3888e25a03de4954e64516824180dea5e7fc07b1ab235882b44fdad72b35a6be4c59b47ca116e42554420b565e1b167fccbd4 languageName: node linkType: hard @@ -202,7 +202,7 @@ __metadata: version: 0.0.0-use.local resolution: "@cyclonedx/yarn-plugin-cyclonedx@workspace:." dependencies: - "@cyclonedx/cyclonedx-library": "npm:^8.4.0" + "@cyclonedx/cyclonedx-library": "npm:^8.5.0" "@eslint/js": "npm:9.31.0" "@types/hosted-git-info": "npm:^3.0.5" "@types/mocha": "npm:^10.0.6"