Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions src/providers/javascript_npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,20 @@ function provideStack(manifest, opts = {}) {
}
}

function getComponent(data, opts) {
let tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'exhort_'))
let tmpPackageJson = path.join(tmpDir, 'package.json')
fs.writeFileSync(tmpPackageJson, data)
let sbom = getSBOM(tmpPackageJson,opts,false);
fs.rmSync(tmpDir, {recursive: true, force: true})
function getComponent(data, opts,manifestPath) {
let sbom
if(manifestPath.trim() === '') {
let tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'exhort_'))
let tmpPackageJson = path.join(tmpDir, 'package.json')
fs.writeFileSync(tmpPackageJson, data)
sbom = getSBOM(tmpPackageJson,opts,false);
fs.rmSync(tmpDir, {recursive: true, force: true})
}
else {
sbom = getSBOM(manifestPath,opts,false);
}


return sbom

}
Expand All @@ -85,10 +93,10 @@ function getComponent(data, opts) {
* @param {{}} [opts={}] - optional various options to pass along the application
* @returns {Provided}
*/
function provideComponent(data, opts = {}) {
function provideComponent(data, opts = {}, path = '') {
return {
ecosystem,
content: getComponent(data,opts),
content: getComponent(data,opts,path),
contentType: 'application/vnd.cyclonedx+json'
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/providers/python_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,10 @@ function bringAllDependencies(dependencies, dependencyName, cachedEnvironmentDep
}
let record = cachedEnvironmentDeps[dependencyName.toLowerCase()]
if(record === null || record === undefined) {
throw new Error(`Package name=>${dependencyName} is not installed on your python environment,
throw new Error(`Package name=>${dependencyName} is not installed in your python environment,
either install it ( better to install requirements.txt altogether) or set
setting EXHORT_PYTHON_VIRTUAL_ENV=true to automatically installs
it on virtual environment ( will slow down the analysis) `)
the setting EXHORT_PYTHON_VIRTUAL_ENV to true to automatically install
it in virtual environment (please note that this may slow down the analysis) `)
}
let depName
let version;
Expand Down