气旋DX SBOM 生成器 兴建 财务报告和审定财务报表 阿宝
创建 旋风DX 软件 材料单(SBOM) 兴建 或者说 阿宝。 。 。 .
本套件提供:
- (单位:千美元) 用于 兴建- 兼容的捆绑机 - 与 兴建 财务报告和审定财务报表 阿宝
- (单位:千美元) CLI 工具 从相容的建筑生成SBOMS 元文件
工具使用捆绑过程中产生的依赖关系信息创建目录
和依赖图(即为什么将一个组件纳入最后捆绑).
只有实际包含在最后捆绑中的依赖性(在 树摇页:1.
生成的 SBOM 文件如下 正式规格和标准, (中文(简体) ),
并可能具有属性 cdx:esbuild 命名空间分类学
财务报告和审定财务报表 cdx 命名空间分类学。 。 。 .
特征
- 🔌 用于相容捆绑器的插件 (单位:千美元)兴建, (中文(简体) ), 阿宝(中文(简体) )
- 🖥️ CLI 工具 从相容元文件生成 SBOMS
- QQ 支持多个 旋风DX光谱版本 (1.2、1.3、1.4、1.5、1.6、1.7)
- 从捆绑的项目中提取组件和依赖性
- 📝 许可证证据的收集
- ✅ 验证 生成 SBOMS 对抗气旋DX 计划
- 🔄 可复制产出 选项,用于一致的 SBOM 生成
- 与 类型脚本, (中文(简体) ), 角质和其他现代框架
所需资源
下列运行时间之一:
- 节点.js
>= 20.18 - 阿宝
>= 1.3.6
某些特征需要可选(同级)依赖性——见 package.json 用于版本限制.
- 兴建 —— 使用有 esbuilt 的插件时需要
- 页:1, (中文(简体) ), ajv 格式 打开 ajv-formats-草案2019 ——SBOM JSON结果验证所需
安装
使用您首选的软件包管理器并安装为 dev- dependency :
npm install --save-dev @cyclonedx/cyclonedx-esbuild
pnpm add --save-dev @cyclonedx/cyclonedx-esbuild
yarn add --dev @cyclonedx/cyclonedx-esbuild
bun add --dev @cyclonedx/cyclonedx-esbuild
使用量
插件使用( 构建和组件)
该插件与 相容的捆绑机。 。 。 .
由于 Bun 提供了与 esbuild 兼容的插件 API,因此同一插件可以在两种环境中使用.
插件选项配置( C)
| 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|
specVersion | {string}其中一个: "1.2", (中文(简体) ), "1.3", (中文(简体) ), "1.4", (中文(简体) ), "1.5", (中文(简体) ), "1.6", (中文(简体) ), "1.7" | "1.6" | [CycloneDX- spec] 的哪个版本要使用. 支持的值取决于安装的依赖性 旋风DX-javascript-图书馆。 。 。 . |
| 输出文件 | {string} | "bom.json" | 输出文件路径 . |
| 组图文集 | {boolean} | false | 搜索组件中的许可证文件,并将其作为许可证证据. 这个特征是实验性的. |
| 可复制 | {boolean} | false | 是否要多走一英里, 使输出可复制 . 这需要更多的资源,并可能导致时间价值和随机价值的损失. |
| mc 类型 | {string} | "application" | 设置主组件类型 . 见 有效数值列表。 。 。 . |
| 验证 | {boolean | undefined} | undefined | 输出前验证生成的 BOM . 如果不符合要求,则取消验证. |
| 日志级别 | {string | undefined} | undefined | 控制插件的动词。 接受由 兴起的 logLevel 或 Bun 中的相应设置.如果没有设定,插件将继承 logLevel 从构建配置。 如果该值也是未定义的,它会回到 "warning"。 。 。 . |
插件示例: 新建
// build.js
const esbuild = require('esbuild');
const { cyclonedxEsbuildPlugin } = require('@cyclonedx/cyclonedx-esbuild');
/** @type {import('@cyclonedx/cyclonedx-esbuild').CycloneDxEsbuildPluginOptions} */
const cyclonedxEsbuildPluginOptions = {
specVersion: '1.7',
outputFile: 'bom.json'
}
esbuild.build({
// ...
plugins: [
cyclonedxEsbuildPlugin(cyclonedxEsbuildPluginOptions),
]
});
参见实例: 与建设一体化。 。 。 .
插件示例: Bun
自兹 阿宝插件 API 简约基于 兴建's, 此插件也可以用于 阿宝 使用内置捆绑器(Bun v1.3.6+)的项目.
// build.ts
import { cyclonedxEsbuildPlugin } from "@cyclonedx/cyclonedx-esbuild"
await Bun.build({
// ...
metafile: true, // required for `cyclonedxEsbuildPlugin` to work with Bun
plugins: [
cyclonedxEsbuildPlugin({
outputFile: "bom.json",
// ...
}),
],
})
export {}
参见实例: 与 Bun 合并。 。 。 .
CLI 工具
用于生成 SBOMS 的命令行接口 建立元文件。 。 。 .
CLI 调用
调用 CLI 取决于所使用的安装方法 .
以下是各种软件包管理器和设置的例子:
npm exec -- cyclonedx-esbuild --help
pnpm exec cyclonedx-esbuild --help
yarn exec cyclonedx-esbuild --help
CLI 帮助页面
Usage: cyclonedx-esbuild [options] <metafile>
Create CycloneDX Software Bill of Materials (SBOM) from esbuild-compatible metafile.
Arguments:
metafile Path to esbuild-compatible metafile
Options:
--bwd, --build-working-dir <dir> Working dir used in the build process.
(default: current working dir)
--gather-license-texts Search for license files in components and include them as license evidence.
This feature is experimental.
(default: false)
--sv, --spec-version <version> Which version of CycloneDX spec to use.
(choices: "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", default: "1.6")
--output-reproducible Whether to go the extra mile and make the output reproducible.
This requires more resources, and might result in loss of time- and random-based-values.
(env: BOM_REPRODUCIBLE)
-o, --output-file <file> Path to the output file.
Set to "-" to write to STDOUT.
(default: write to STDOUT)
--validate Validate resulting BOM before outputting.
Validation is skipped, if requirements not met.
--no-validate Disable validation of resulting BOM.
--mc-type <type> Type of the main component.
(choices: "application", "firmware", "library", default: "application")
-v, --verbose Increase the verbosity of messages.
Use multiple times to increase the verbosity even more.
-V, --version output the version number
-h, --help display help for command
以角为单位使用
对于 角质 使用 兴建 (Angular 17+),您可以从构建数据生成SBOMS.
// package.json
{
"scripts": {
"build:app": "ng build --stats-json",
"build:sbom": "cyclonedx-esbuild --gather-license-texts --output-reproducible -o dist/bom.json dist/stats.json",
"build": "npm run build:app && npm run build:sbom"
}
}
例如: 与Angular20的融合。 。 。 .
内部
这种工具利用 旋风DX库 生成实际数据结构.
除了班级 CycloneDxEsbuildPlugin 和接口 CycloneDxEsbuildPluginOptions, (中文(简体) ),
这个 兴建 插件和此工具确实 没有 披露任何额外的 公开 API或类 - 所有代码都是为了内部的,在版本升级时可能会不经任何通知而更改.
但是,CLI是稳定的,你可以称之为程序上的:
const { execFileSync } = require('child_process')
const { constants: { MAX_LENGTH: BUFFER_MAX_LENGTH } } = require('buffer')
const sbom = JSON.parse(execFileSync(process.execPath, [
'../path/to/this/package/bin/cyclonedx-esbuild-cli.js',
'--spec-version', '1.7',
'--output-file', '-'
// additional CLI args
], { stdio: ['ignore', 'pipe', 'ignore'], encoding: 'buffer', maxBuffer: BUFFER_MAX_LENGTH }))
发展和贡献
随意打开问题,错误报告或调取请求.
见 捐款 详细文件.
许可证
根据Apache 2.0许可证的规定,允许修改和再分配.
见 自由主义 完整许可证存档.