Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2020-10-23 21:15:35 +0300
committerisaacs <i@izs.me>2020-10-23 21:23:15 +0300
commit47640eb2c3cd9891e904e3f6bc705b6618096103 (patch)
tree8b1b635135a5672ed0da4d8e6feade0f9d8fa60d /lib/rebuild.js
parentb737ee99961364827bacf210a3e5ca5d2b7edad2 (diff)
update lint rules to match @npmcli/arborist
Diffstat (limited to 'lib/rebuild.js')
-rw-r--r--lib/rebuild.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/rebuild.js b/lib/rebuild.js
index a2beecc50..076cfc699 100644
--- a/lib/rebuild.js
+++ b/lib/rebuild.js
@@ -17,7 +17,7 @@ const rebuild = async args => {
const where = npm.flatOptions.global ? globalTop : npm.prefix
const arb = new Arborist({
...npm.flatOptions,
- path: where
+ path: where,
})
if (args.length) {
@@ -25,11 +25,10 @@ const rebuild = async args => {
const tree = await arb.loadActual()
const filter = getFilterFn(args)
await arb.rebuild({
- nodes: tree.inventory.filter(filter)
+ nodes: tree.inventory.filter(filter),
})
- } else {
+ } else
await arb.rebuild()
- }
output('rebuilt dependencies successfully')
}
@@ -37,14 +36,18 @@ const rebuild = async args => {
const getFilterFn = args => {
const specs = args.map(arg => {
const spec = npa(arg)
- if (spec.type === 'tag' && spec.rawSpec === '') { return spec }
- if (spec.type !== 'range' && spec.type !== 'version') { throw new Error('`npm rebuild` only supports SemVer version/range specifiers') }
+ if (spec.type === 'tag' && spec.rawSpec === '')
+ return spec
+ if (spec.type !== 'range' && spec.type !== 'version')
+ throw new Error('`npm rebuild` only supports SemVer version/range specifiers')
return spec
})
return node => specs.some(spec => {
const { version } = node.package
- if (spec.name !== node.name) { return false }
- if (spec.rawSpec === '' || spec.rawSpec === '*') { return true }
+ if (spec.name !== node.name)
+ return false
+ if (spec.rawSpec === '' || spec.rawSpec === '*')
+ return true
return semver.satisfies(version, spec.fetchSpec)
})
}