From 7584946e40810141d6d5be04ff4cb21457ed4ecd Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Sun, 7 May 2017 22:47:10 +0200 Subject: [PATCH] More documentation --- .thought/partials/overview.md.hbs | 10 ++++++++++ README.md | 14 +++++++++++++- bin/analyze-module-size.js | 2 ++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 .thought/partials/overview.md.hbs diff --git a/.thought/partials/overview.md.hbs b/.thought/partials/overview.md.hbs new file mode 100644 index 0000000..bab52ad --- /dev/null +++ b/.thought/partials/overview.md.hbs @@ -0,0 +1,10 @@ +`{{package.name}}` shows you, why your package is so large. The reason for the size +of your package often lies in the dependencies you are using. For example {{npm 'request'}}@2.81.0` +is 7080kb large (including its 53 dependencies) and it comes with a lot of libraries that you may not even need. If you are aware of that, you may choose to use a different library +(e.g. {{npm 'popsicle'}}). + +The module {{npm 'cost-of-modules'}} does the same, but it only shows one level of the +dependency tree. It was an inspiration, but I took no code from it. + +Finally, this program still has a lot of opportunities for enhancement. If you have +wishes, ideas or questions, please open an issue. diff --git a/README.md b/README.md index 359b115..64e0722 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,16 @@ > Analyze the size of your module dependencies +`analyze-module-size` shows you, why your package is so large. The reason for the size +of your package often lies in the dependencies you are using. For example [request](https://npmjs.com/package/request)@2.81.0` +is 7080kb large (including its 53 dependencies) and it comes with a lot of libraries that you may not even need. If you are aware of that, you may choose to use a different library +(e.g. [popsicle](https://npmjs.com/package/popsicle)). + +The module [cost-of-modules](https://npmjs.com/package/cost-of-modules) does the same, but it only shows one level of the +dependency tree. It was an inspiration, but I took no code from it. + +Finally, this program still has a lot of opportunities for enhancement. If you have +wishes, ideas or questions, please open an issue. # Installation @@ -19,7 +29,7 @@ Run `analyze-module-size` in your project directory. The output will be somethin (Note that the displayed sizes are accumulated from the each module an its dependencies): ``` -size: 60k... with-dependencies: 1112k +size: 64k... with-dependencies: 1116k ├─┬ globby@6.1.0, 484k, 17 deps │ ├─┬ glob@7.1.1, 340k, 10 deps │ │ ├─┬ minimatch@3.0.4, 132k, 3 deps @@ -81,6 +91,8 @@ size: 60k... with-dependencies: 1112k ``` Usage: analyze-module-size [options] + Analyzes the size of the package in the current directories, including the size of (production) dependencies + Options: -h, --help output usage information diff --git a/bin/analyze-module-size.js b/bin/analyze-module-size.js index 6e08a01..fcb6fb1 100755 --- a/bin/analyze-module-size.js +++ b/bin/analyze-module-size.js @@ -7,6 +7,8 @@ require('graceful-fs').gracefulify(require('fs')) program .version(require('../package').version) + .description('Analyzes the size of the package in the current directories, ' + + 'including the size of (production) dependencies') .usage('[options]') .option('-d, --depth ', 'Show only dependencies up to a given depth of recursion') .parse(process.argv)