Skip to content

Commit

Permalink
Tweaks for node.js ignore list (#1469)
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu authored Nov 25, 2024
1 parent 6020dac commit 53c42d4
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cyclonedx/cdxgen",
"version": "11.0.3",
"version": "11.0.4",
"exports": "./lib/cli/index.js",
"compilerOptions": {
"lib": ["deno.window"],
Expand Down
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cyclonedx/cdxgen",
"version": "11.0.3",
"version": "11.0.4",
"exports": "./lib/cli/index.js",
"include": ["*.js", "lib/**", "bin/**", "data/**", "types/**"],
"exclude": [
Expand Down
12 changes: 9 additions & 3 deletions lib/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,12 @@ const createDefaultParentComponent = (
: dirname(path);
const tmpA = dirNameStr.split(sep);
dirNameStr = tmpA[tmpA.length - 1];
const compName = options.projectName || dirNameStr;
const parentComponent = {
group: options.projectGroup || "",
name: options.projectName || dirNameStr,
name: compName,
version: `${options.projectVersion}` || "latest",
type: "application",
type: compName.endsWith(".tar") ? "container" : "application",
};
const ppurl = new PackageURL(
type,
Expand Down Expand Up @@ -957,7 +958,6 @@ function determinePackageType(pkg) {
// Retain the exact component type in certain cases.
if (
[
"application",
"container",
"platform",
"operating-system",
Expand All @@ -972,6 +972,12 @@ function determinePackageType(pkg) {
) {
return pkg.type;
}
if (pkg.type === "application") {
if (pkg?.name?.endsWith(".tar")) {
return "container";
}
return pkg.type;
}
if (pkg.purl) {
try {
const purl = PackageURL.fromString(pkg.purl);
Expand Down
4 changes: 2 additions & 2 deletions lib/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,15 +538,15 @@ export function getAllFiles(dirPath, pattern, options = {}) {
"**/.hg/**",
"**/.git/**",
"**/venv/**",
"**/docs/**",
"**/examples/**",
"**/site-packages/**",
"**/flow-typed/**",
"**/coverage/**",
];
// Only ignore node_modules if the caller is not looking for package.json
// Only ignore node_modules and docs if the caller is not looking for package.json
if (!pattern.includes("package.json")) {
ignoreList.push("**/node_modules/**");
ignoreList.push("**/docs/**");
}
if (options?.exclude && Array.isArray(options.exclude)) {
ignoreList = ignoreList.concat(options.exclude);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cyclonedx/cdxgen",
"version": "11.0.3",
"version": "11.0.4",
"description": "Creates CycloneDX Software Bill of Materials (SBOM) from source or container image",
"homepage": "http://github.com/cyclonedx/cdxgen",
"author": "Prabhu Subramanian <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion types/lib/cli/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 53c42d4

Please sign in to comment.