Skip to content

Commit

Permalink
add a command for showing what directly requires a given package
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed Feb 19, 2019
1 parent bf9e08b commit 29600fd
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions commands/requires.js
@@ -0,0 +1,23 @@
import getLockfile from "../functions/get-lockfile"
import findDependents from "../functions/recursors/find-dependents"

export let command = "requires <name>"
export let describe = "see what packages directly need a given package"
export let aliases = [
"who-needs",
"whoneeds"
]
export let builder = yargs =>
yargs
.positional("name", {
describe: "the package name",
required: true
})

export async function handler (argv) {
let lockfile = await getLockfile(argv)

let requires = await findDependents(argv.name)(lockfile.dependencies)

console.log(requires.join(" "))
}

0 comments on commit 29600fd

Please sign in to comment.