From 3b32b09c8982d5e5a802d495facd050f9558a14c Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Wed, 21 Feb 2018 13:45:39 -0600 Subject: [PATCH] Add List Top-Level NPM Dependencies as a javascript til --- README.md | 3 ++- javascript/list-top-level-npm-dependencies.md | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 javascript/list-top-level-npm-dependencies.md diff --git a/README.md b/README.md index a24c410..dbb39a2 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/). For a steady stream of TILs from a variety of rocketeers, checkout [til.hashrocket.com](https://til.hashrocket.com/). -_622 TILs and counting..._ +_623 TILs and counting..._ --- @@ -232,6 +232,7 @@ _622 TILs and counting..._ - [Initialize A New JavaScript Project With Yarn](javascript/initialize-a-new-javascript-project-with-yarn.md) - [Install The Latest Version Of Node With Nvm](javascript/install-the-latest-version-of-node-with-nvm.md) - [ISO-8601 Formatted Dates Are Interpreted As UTC](javascript/iso-8601-formatted-dates-are-interpreted-as-utc.md) +- [List Top-Level NPM Dependencies](javascript/list-top-level-npm-dependencies.md) - [Matching Multiple Values In A Switch Statement](javascript/matching-multiple-values-in-a-switch-statement.md) - [New Dates Can Take Out Of Bounds Values](javascript/new-dates-can-take-out-of-bounds-values.md) - [Numbers Are Empty](javascript/numbers-are-empty.md) diff --git a/javascript/list-top-level-npm-dependencies.md b/javascript/list-top-level-npm-dependencies.md new file mode 100644 index 0000000..f3ca6bc --- /dev/null +++ b/javascript/list-top-level-npm-dependencies.md @@ -0,0 +1,17 @@ +# List Top-Level NPM Dependencies + +The `npm ls` command can be used to list all dependencies for a project. +This will, however, produce an exhaustive list of all dependencies including +dependencies of dependencies. A list this large probably isn't going to be +of much use. + +The `--depth` flag allows you to restrict the depth of the dependency tree +that is generated. + +```bash +$ npm ls --depth=0 +``` + +This will produce a list of only the top-level dependencies. + +See `man npm-ls` for more details.