Skip to content

Commit

Permalink
Call arborist.loadActual with forceActual: true
Browse files Browse the repository at this point in the history
  • Loading branch information
kemitchell committed Aug 22, 2022
1 parent 44a9993 commit 9ea181c
Showing 1 changed file with 12 additions and 25 deletions.
37 changes: 12 additions & 25 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ module.exports = licensee
var Arborist = require('@npmcli/arborist')
var blueOakList = require('@blueoak/list')
var correctLicenseMetadata = require('correct-license-metadata')
var fs = require('fs')
var has = require('has')
var npmLicenseCorrections = require('npm-license-corrections')
var osi = require('spdx-osi')
var parse = require('spdx-expression-parse')
var joinPath = require('path').join
var satisfies = require('semver').satisfies
var spdxAllowed = require('spdx-whitelisted')

Expand All @@ -35,29 +33,18 @@ function licensee (configuration, path, callback) {
) {
callback(new Error('No licenses or packages allowed.'))
} else {
// Delete node_modules/.package-lock.json, Arborist/npm's
// on-disk cache of the resolved package tree, if
// present. When this is present, it may or may
// not include license metadata for packages. See
// https://github.com/jslicense/licensee.js/issues/64#issuecomment-1145256328=
fs.rm(
joinPath(path, 'node_modules', '.package-lock.json'),
{ force: true },
function (/* ignore errors */) {
var arborist = new Arborist({ path })
arborist.loadActual()
.catch(function (error) {
return callback(error)
})
.then(function (tree) {
var children = Array.from(tree.children.values())
if (configuration.filterPackages) {
children = configuration.filterPackages(children)
}
callback(null, findIssues(configuration, children, []))
})
}
)
var arborist = new Arborist({ path })
arborist.loadActual({ forceActual: true })
.catch(function (error) {
return callback(error)
})
.then(function (tree) {
var children = Array.from(tree.children.values())
if (configuration.filterPackages) {
children = configuration.filterPackages(children)
}
callback(null, findIssues(configuration, children, []))
})
}
}

Expand Down

0 comments on commit 9ea181c

Please sign in to comment.