avajs / ava

Node.js test runner that lets you develop with confidence πŸš€
MIT License
20.73k stars 1.41k forks source link

Reduce installed package size #369

Closed sindresorhus closed 7 years ago

sindresorhus commented 8 years ago

Latest master (b79fdfd8b0e5632eae338b563af1c3be29fecbca), when installed with npm@3.5.2, is 68 MB. Most of that is Babel stuff.

We should look into ways we can reduce the size.

screen shot 2015-12-26 at 00 20 16

(Output from DaisyDisk)

Turns out every single Babel package includes a dependency on babel-runtime and for some reason it's not deduped by npm@3, not even with npm dedupe:

~/dev/ava/node_modules master*
❯ find . -type d -name "babel-runtime" -print 
./babel-code-frame/node_modules/babel-runtime
./babel-core/node_modules/babel-runtime
./babel-generator/node_modules/babel-runtime
./babel-helper-builder-binary-assignment-operator-visitor/node_modules/babel-runtime
./babel-helper-call-delegate/node_modules/babel-runtime
./babel-helper-define-map/node_modules/babel-runtime
./babel-helper-explode-assignable-expression/node_modules/babel-runtime
./babel-helper-function-name/node_modules/babel-runtime
./babel-helper-get-function-arity/node_modules/babel-runtime
./babel-helper-hoist-variables/node_modules/babel-runtime
./babel-helper-optimise-call-expression/node_modules/babel-runtime
./babel-helper-regex/node_modules/babel-runtime
./babel-helper-remap-async-to-generator/node_modules/babel-runtime
./babel-helper-replace-supers/node_modules/babel-runtime
./babel-helpers/node_modules/babel-runtime
./babel-messages/node_modules/babel-runtime
./babel-plugin-check-es2015-constants/node_modules/babel-runtime
./babel-plugin-syntax-async-functions/node_modules/babel-runtime
./babel-plugin-syntax-exponentiation-operator/node_modules/babel-runtime
./babel-plugin-syntax-object-rest-spread/node_modules/babel-runtime
./babel-plugin-transform-async-to-generator/node_modules/babel-runtime
./babel-plugin-transform-es2015-arrow-functions/node_modules/babel-runtime
./babel-plugin-transform-es2015-block-scoped-functions/node_modules/babel-runtime
./babel-plugin-transform-es2015-block-scoping/node_modules/babel-runtime
./babel-plugin-transform-es2015-classes/node_modules/babel-runtime
./babel-plugin-transform-es2015-computed-properties/node_modules/babel-runtime
./babel-plugin-transform-es2015-destructuring/node_modules/babel-runtime
./babel-plugin-transform-es2015-for-of/node_modules/babel-runtime
./babel-plugin-transform-es2015-function-name/node_modules/babel-runtime
./babel-plugin-transform-es2015-literals/node_modules/babel-runtime
./babel-plugin-transform-es2015-modules-commonjs/node_modules/babel-runtime
./babel-plugin-transform-es2015-object-super/node_modules/babel-runtime
./babel-plugin-transform-es2015-parameters/node_modules/babel-runtime
./babel-plugin-transform-es2015-shorthand-properties/node_modules/babel-runtime
./babel-plugin-transform-es2015-spread/node_modules/babel-runtime
./babel-plugin-transform-es2015-sticky-regex/node_modules/babel-runtime
./babel-plugin-transform-es2015-template-literals/node_modules/babel-runtime
./babel-plugin-transform-es2015-typeof-symbol/node_modules/babel-runtime
./babel-plugin-transform-es2015-unicode-regex/node_modules/babel-runtime
./babel-plugin-transform-exponentiation-operator/node_modules/babel-runtime
./babel-plugin-transform-object-rest-spread/node_modules/babel-runtime
./babel-plugin-transform-regenerator/node_modules/babel-runtime
./babel-plugin-transform-runtime/node_modules/babel-runtime
./babel-plugin-transform-strict-mode/node_modules/babel-runtime
./babel-register/node_modules/babel-runtime
./babel-runtime
./babel-template/node_modules/babel-runtime
./babel-traverse/node_modules/babel-runtime
./babel-types/node_modules/babel-runtime
./babylon/node_modules/babel-runtime
ariporad commented 8 years ago

@sindresorhus: That appears to be a bug on your machine. On mine it works fine: Screenshot ls spits out the size kind of weird (in raw bytes, floored), it's actually 33.2MB: Screenshot npm ls:

/Users/Ari/Developer/.tmp
└─┬ ava@0.8.0
  β”œβ”€β”€ arr-flatten@1.0.1
  β”œβ”€β”€ arrify@1.0.1
  β”œβ”€β”¬ ava-init@0.1.3
  β”‚ β”œβ”€β”€ arr-exclude@1.0.0
  β”‚ β”œβ”€β”€ pify@2.3.0
  β”‚ β”œβ”€β”¬ pinkie-promise@2.0.0
  β”‚ β”‚ └── pinkie@2.0.1
  β”‚ β”œβ”€β”¬ read-pkg-up@1.0.1
  β”‚ β”‚ β”œβ”€β”¬ find-up@1.1.0
  β”‚ β”‚ β”‚ └── path-exists@2.1.0
  β”‚ β”‚ └─┬ read-pkg@1.1.0
  β”‚ β”‚   β”œβ”€β”¬ load-json-file@1.1.0
  β”‚ β”‚   β”‚ β”œβ”€β”¬ parse-json@2.2.0
  β”‚ β”‚   β”‚ β”‚ └─┬ error-ex@1.3.0
  β”‚ β”‚   β”‚ β”‚   └── is-arrayish@0.2.1
  β”‚ β”‚   β”‚ └─┬ strip-bom@2.0.0
  β”‚ β”‚   β”‚   └── is-utf8@0.2.1
  β”‚ β”‚   └── path-type@1.1.0
  β”‚ β”œβ”€β”€ the-argv@1.0.0
  β”‚ └─┬ write-pkg@1.0.0
  β”‚   └─┬ write-json-file@1.2.0
  β”‚     └─┬ sort-keys@1.1.1
  β”‚       └── is-plain-obj@1.1.0
  β”œβ”€β”¬ babel-core@5.8.34
  β”‚ β”œβ”€β”€ babel-plugin-constant-folding@1.0.1
  β”‚ β”œβ”€β”€ babel-plugin-dead-code-elimination@1.0.2
  β”‚ β”œβ”€β”€ babel-plugin-eval@1.0.1
  β”‚ β”œβ”€β”€ babel-plugin-inline-environment-variables@1.0.1
  β”‚ β”œβ”€β”€ babel-plugin-jscript@1.0.4
  β”‚ β”œβ”€β”€ babel-plugin-member-expression-literals@1.0.1
  β”‚ β”œβ”€β”€ babel-plugin-property-literals@1.0.1
  β”‚ β”œβ”€β”€ babel-plugin-proto-to-assign@1.0.4
  β”‚ β”œβ”€β”€ babel-plugin-react-constant-elements@1.0.3
  β”‚ β”œβ”€β”€ babel-plugin-react-display-name@1.0.3
  β”‚ β”œβ”€β”€ babel-plugin-remove-console@1.0.1
  β”‚ β”œβ”€β”€ babel-plugin-remove-debugger@1.0.1
  β”‚ β”œβ”€β”€ babel-plugin-runtime@1.0.7
  β”‚ β”œβ”€β”¬ babel-plugin-undeclared-variables-check@1.0.2
  β”‚ β”‚ └── leven@1.0.2
  β”‚ β”œβ”€β”€ babel-plugin-undefined-to-void@1.1.6
  β”‚ β”œβ”€β”€ babylon@5.8.34
  β”‚ β”œβ”€β”€ bluebird@2.10.2
  β”‚ β”œβ”€β”€ convert-source-map@1.1.2
  β”‚ β”œβ”€β”€ core-js@1.2.6
  β”‚ β”œβ”€β”¬ detect-indent@3.0.1
  β”‚ β”‚ β”œβ”€β”€ get-stdin@4.0.1
  β”‚ β”‚ └── minimist@1.2.0
  β”‚ β”œβ”€β”€ esutils@2.0.2
  β”‚ β”œβ”€β”€ fs-readdir-recursive@0.1.2
  β”‚ β”œβ”€β”€ globals@6.4.1
  β”‚ β”œβ”€β”¬ home-or-tmp@1.0.0
  β”‚ β”‚ β”œβ”€β”€ os-tmpdir@1.0.1
  β”‚ β”‚ └── user-home@1.1.1
  β”‚ β”œβ”€β”€ is-integer@1.0.6
  β”‚ β”œβ”€β”€ js-tokens@1.0.1
  β”‚ β”œβ”€β”€ json5@0.4.0
  β”‚ β”œβ”€β”¬ line-numbers@0.2.0
  β”‚ β”‚ └── left-pad@0.0.3
  β”‚ β”œβ”€β”€ lodash@3.10.1
  β”‚ β”œβ”€β”¬ minimatch@2.0.10
  β”‚ β”‚ └─┬ brace-expansion@1.1.2
  β”‚ β”‚   β”œβ”€β”€ balanced-match@0.3.0
  β”‚ β”‚   └── concat-map@0.0.1
  β”‚ β”œβ”€β”¬ output-file-sync@1.1.1
  β”‚ β”‚ └─┬ mkdirp@0.5.1
  β”‚ β”‚   └── minimist@0.0.8
  β”‚ β”œβ”€β”€ path-exists@1.0.0
  β”‚ β”œβ”€β”€ path-is-absolute@1.0.0
  β”‚ β”œβ”€β”€ private@0.1.6
  β”‚ β”œβ”€β”¬ regenerator@0.8.40
  β”‚ β”‚ β”œβ”€β”¬ commoner@0.10.4
  β”‚ β”‚ β”‚ β”œβ”€β”¬ commander@2.9.0
  β”‚ β”‚ β”‚ β”‚ └── graceful-readlink@1.0.1
  β”‚ β”‚ β”‚ β”œβ”€β”¬ detective@4.3.1
  β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ acorn@1.2.2
  β”‚ β”‚ β”‚ β”‚ └── defined@1.0.0
  β”‚ β”‚ β”‚ β”œβ”€β”€ glob@5.0.15
  β”‚ β”‚ β”‚ β”œβ”€β”€ iconv-lite@0.4.13
  β”‚ β”‚ β”‚ └── q@1.4.1
  β”‚ β”‚ β”œβ”€β”¬ defs@1.1.1
  β”‚ β”‚ β”‚ β”œβ”€β”¬ alter@0.2.0
  β”‚ β”‚ β”‚ β”‚ └── stable@0.1.5
  β”‚ β”‚ β”‚ β”œβ”€β”€ ast-traverse@0.1.1
  β”‚ β”‚ β”‚ β”œβ”€β”€ breakable@1.0.0
  β”‚ β”‚ β”‚ β”œβ”€β”€ simple-fmt@0.1.0
  β”‚ β”‚ β”‚ β”œβ”€β”€ simple-is@0.2.0
  β”‚ β”‚ β”‚ β”œβ”€β”€ stringmap@0.2.2
  β”‚ β”‚ β”‚ β”œβ”€β”€ stringset@0.2.1
  β”‚ β”‚ β”‚ β”œβ”€β”€ tryor@0.1.2
  β”‚ β”‚ β”‚ └─┬ yargs@3.27.0
  β”‚ β”‚ β”‚   β”œβ”€β”€ camelcase@1.2.1
  β”‚ β”‚ β”‚   β”œβ”€β”¬ cliui@2.1.0
  β”‚ β”‚ β”‚   β”‚ β”œβ”€β”¬ center-align@0.1.2
  β”‚ β”‚ β”‚   β”‚ β”‚ β”œβ”€β”¬ align-text@0.1.3
  β”‚ β”‚ β”‚   β”‚ β”‚ β”‚ β”œβ”€β”¬ kind-of@2.0.1
  β”‚ β”‚ β”‚   β”‚ β”‚ β”‚ β”‚ └── is-buffer@1.1.0
  β”‚ β”‚ β”‚   β”‚ β”‚ β”‚ └── repeat-string@1.5.2
  β”‚ β”‚ β”‚   β”‚ β”‚ └── lazy-cache@0.2.7
  β”‚ β”‚ β”‚   β”‚ └── right-align@0.1.3
  β”‚ β”‚ β”‚   β”œβ”€β”€ decamelize@1.1.2
  β”‚ β”‚ β”‚   β”œβ”€β”¬ os-locale@1.4.0
  β”‚ β”‚ β”‚   β”‚ └─┬ lcid@1.0.0
  β”‚ β”‚ β”‚   β”‚   └── invert-kv@1.0.0
  β”‚ β”‚ β”‚   β”œβ”€β”€ window-size@0.1.4
  β”‚ β”‚ β”‚   └── y18n@3.2.0
  β”‚ β”‚ β”œβ”€β”€ esprima-fb@15001.1001.0-dev-harmony-fb
  β”‚ β”‚ β”œβ”€β”¬ recast@0.10.33
  β”‚ β”‚ β”‚ └── ast-types@0.8.12
  β”‚ β”‚ └── through@2.3.8
  β”‚ β”œβ”€β”¬ regexpu@1.3.0
  β”‚ β”‚ β”œβ”€β”€ esprima@2.7.1
  β”‚ β”‚ β”œβ”€β”€ regenerate@1.2.1
  β”‚ β”‚ β”œβ”€β”€ regjsgen@0.2.0
  β”‚ β”‚ └─┬ regjsparser@0.1.5
  β”‚ β”‚   └── jsesc@0.5.0
  β”‚ β”œβ”€β”€ repeating@1.1.3
  β”‚ β”œβ”€β”€ resolve@1.1.6
  β”‚ β”œβ”€β”€ shebang-regex@1.0.0
  β”‚ β”œβ”€β”€ slash@1.0.0
  β”‚ β”œβ”€β”€ source-map@0.5.3
  β”‚ β”œβ”€β”¬ source-map-support@0.2.10
  β”‚ β”‚ └── source-map@0.1.32
  β”‚ β”œβ”€β”€ to-fast-properties@1.0.1
  β”‚ β”œβ”€β”€ trim-right@1.0.1
  β”‚ └── try-resolve@1.0.1
  β”œβ”€β”¬ babel-plugin-espower@1.1.0
  β”‚ β”œβ”€β”€ array-find@1.0.0
  β”‚ β”œβ”€β”¬ escallmatch@1.4.2
  β”‚ β”‚ β”œβ”€β”€ deep-equal@1.0.1
  β”‚ β”‚ β”œβ”€β”€ esprima@2.7.1
  β”‚ β”‚ β”œβ”€β”¬ espurify@1.5.0
  β”‚ β”‚ β”‚ └── isarray@1.0.0
  β”‚ β”‚ └── indexof@0.0.1
  β”‚ β”œβ”€β”¬ espower@1.2.1
  β”‚ β”‚ β”œβ”€β”¬ escodegen@1.7.1
  β”‚ β”‚ β”‚ β”œβ”€β”€ esprima@1.2.5
  β”‚ β”‚ β”‚ β”œβ”€β”€ estraverse@1.9.3
  β”‚ β”‚ β”‚ β”œβ”€β”¬ optionator@0.5.0
  β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ deep-is@0.1.3
  β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ fast-levenshtein@1.0.7
  β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ levn@0.2.5
  β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ prelude-ls@1.1.2
  β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ type-check@0.3.1
  β”‚ β”‚ β”‚ β”‚ └── wordwrap@0.0.2
  β”‚ β”‚ β”‚ └── source-map@0.2.0
  β”‚ β”‚ β”œβ”€β”€ is-url@1.2.1
  β”‚ β”‚ └── isarray@0.0.1
  β”‚ └── xtend@4.0.1
  β”œβ”€β”€ babel-runtime@5.8.34
  β”œβ”€β”€ bluebird@3.1.1
  β”œβ”€β”¬ chalk@1.1.1
  β”‚ β”œβ”€β”€ ansi-styles@2.1.0
  β”‚ β”œβ”€β”€ escape-string-regexp@1.0.4
  β”‚ β”œβ”€β”¬ has-ansi@2.0.0
  β”‚ β”‚ └── ansi-regex@2.0.0
  β”‚ β”œβ”€β”€ strip-ansi@3.0.0
  β”‚ └── supports-color@2.0.0
  β”œβ”€β”¬ co-with-promise@4.6.0
  β”‚ └─┬ pinkie-promise@1.0.0
  β”‚   └── pinkie@1.0.0
  β”œβ”€β”¬ core-assert@0.1.3
  β”‚ └── buf-compare@1.0.0
  β”œβ”€β”¬ debug@2.2.0
  β”‚ └── ms@0.7.1
  β”œβ”€β”€ deeper@2.1.0
  β”œβ”€β”¬ empower@1.1.0
  β”‚ β”œβ”€β”€ array-filter@1.0.0
  β”‚ β”œβ”€β”€ array-foreach@1.0.1
  β”‚ β”œβ”€β”€ array-map@0.0.0
  β”‚ β”œβ”€β”€ array-some@1.0.0
  β”‚ β”œβ”€β”¬ define-properties@1.1.2
  β”‚ β”‚ └── foreach@2.0.5
  β”‚ └─┬ object-create@0.1.0
  β”‚   └─┬ object-define-property@0.1.0
  β”‚     β”œβ”€β”€ function-bind@0.1.0
  β”‚     └── has@0.0.1
  β”œβ”€β”¬ empower-core@0.2.0
  β”‚ └── call-signature@0.0.2
  β”œβ”€β”€ figures@1.4.0
  β”œβ”€β”€ fn-name@2.0.1
  β”œβ”€β”¬ globby@4.0.0
  β”‚ β”œβ”€β”¬ array-union@1.0.1
  β”‚ β”‚ └── array-uniq@1.0.2
  β”‚ └─┬ glob@6.0.2
  β”‚   β”œβ”€β”¬ inflight@1.0.4
  β”‚   β”‚ └── wrappy@1.0.1
  β”‚   β”œβ”€β”€ inherits@2.0.1
  β”‚   └── once@1.3.3
  β”œβ”€β”€ has-generator@1.0.0
  β”œβ”€β”€ is-generator-fn@1.0.0
  β”œβ”€β”¬ is-observable@0.1.0
  β”‚ └── symbol-observable@0.1.0
  β”œβ”€β”€ is-promise@2.1.0
  β”œβ”€β”¬ loud-rejection@1.2.0
  β”‚ └── signal-exit@2.1.2
  β”œβ”€β”€ max-timeout@1.0.0
  β”œβ”€β”¬ meow@3.6.0
  β”‚ β”œβ”€β”¬ camelcase-keys@2.0.0
  β”‚ β”‚ β”œβ”€β”€ camelcase@2.0.1
  β”‚ β”‚ └── map-obj@1.0.1
  β”‚ β”œβ”€β”€ minimist@1.2.0
  β”‚ β”œβ”€β”¬ normalize-package-data@2.3.5
  β”‚ β”‚ β”œβ”€β”€ hosted-git-info@2.1.4
  β”‚ β”‚ β”œβ”€β”¬ is-builtin-module@1.0.0
  β”‚ β”‚ β”‚ └── builtin-modules@1.1.0
  β”‚ β”‚ β”œβ”€β”€ semver@5.1.0
  β”‚ β”‚ └─┬ validate-npm-package-license@3.0.1
  β”‚ β”‚   β”œβ”€β”¬ spdx-correct@1.0.2
  β”‚ β”‚   β”‚ └── spdx-license-ids@1.1.0
  β”‚ β”‚   └─┬ spdx-expression-parse@1.0.2
  β”‚ β”‚     └── spdx-exceptions@1.0.4
  β”‚ β”œβ”€β”¬ redent@1.0.0
  β”‚ β”‚ β”œβ”€β”¬ indent-string@2.1.0
  β”‚ β”‚ β”‚ └── repeating@2.0.0
  β”‚ β”‚ └── strip-indent@1.0.1
  β”‚ └── trim-newlines@1.0.0
  β”œβ”€β”€ object-assign@4.0.1
  β”œβ”€β”€ observable-to-promise@0.1.0
  β”œβ”€β”¬ plur@2.1.2
  β”‚ └── irregular-plurals@1.1.0
  β”œβ”€β”¬ power-assert-formatter@1.3.2
  β”‚ β”œβ”€β”€ acorn@2.6.4
  β”‚ β”œβ”€β”€ acorn-es7-plugin@1.0.11
  β”‚ β”œβ”€β”€ array-reduce@0.0.0
  β”‚ β”œβ”€β”€ eastasianwidth@0.1.1
  β”‚ β”œβ”€β”€ estraverse@4.1.1
  β”‚ β”œβ”€β”€ googlediff@0.1.0
  β”‚ β”œβ”€β”€ object-keys@1.0.9
  β”‚ β”œβ”€β”¬ stringifier@1.2.1
  β”‚ β”‚ β”œβ”€β”€ array-reduce-right@1.0.0
  β”‚ β”‚ └── traverse@0.6.6
  β”‚ └── type-name@1.1.0
  β”œβ”€β”€ power-assert-renderers@0.1.0
  β”œβ”€β”¬ pretty-ms@2.1.0
  β”‚ β”œβ”€β”¬ is-finite@1.0.1
  β”‚ β”‚ └── number-is-nan@1.0.0
  β”‚ β”œβ”€β”€ parse-ms@1.0.0
  β”‚ └── plur@1.0.0
  β”œβ”€β”€ require-from-string@1.1.0
  β”œβ”€β”¬ resolve-cwd@1.0.0
  β”‚ └── resolve-from@2.0.0
  β”œβ”€β”€ serialize-error@1.1.0
  β”œβ”€β”€ set-immediate-shim@1.0.1
  β”œβ”€β”¬ source-map-support@0.4.0
  β”‚ └─┬ source-map@0.1.32
  β”‚   └── amdefine@1.0.0
  β”œβ”€β”¬ squeak@1.3.0
  β”‚ β”œβ”€β”€ console-stream@0.1.1
  β”‚ └─┬ lpad-align@1.1.0
  β”‚   β”œβ”€β”€ longest@1.0.1
  β”‚   └── lpad@2.0.1
  β”œβ”€β”¬ time-require@0.1.2
  β”‚ β”œβ”€β”¬ chalk@0.4.0
  β”‚ β”‚ β”œβ”€β”€ ansi-styles@1.0.0
  β”‚ β”‚ β”œβ”€β”€ has-color@0.1.7
  β”‚ β”‚ └── strip-ansi@0.1.1
  β”‚ β”œβ”€β”€ date-time@0.1.1
  β”‚ β”œβ”€β”¬ pretty-ms@0.2.2
  β”‚ β”‚ └── parse-ms@0.1.2
  β”‚ └── text-table@0.2.0
  └─┬ update-notifier@0.5.0
    β”œβ”€β”¬ configstore@1.4.0
    β”‚ β”œβ”€β”€ graceful-fs@4.1.2
    β”‚ β”œβ”€β”¬ osenv@0.1.3
    β”‚ β”‚ └── os-homedir@1.0.1
    β”‚ β”œβ”€β”€ uuid@2.0.1
    β”‚ β”œβ”€β”¬ write-file-atomic@1.1.4
    β”‚ β”‚ β”œβ”€β”€ imurmurhash@0.1.4
    β”‚ β”‚ └── slide@1.1.6
    β”‚ └── xdg-basedir@2.0.0
    β”œβ”€β”€ is-npm@1.0.0
    β”œβ”€β”¬ latest-version@1.0.1
    β”‚ └─┬ package-json@1.2.0
    β”‚   β”œβ”€β”¬ got@3.3.1
    β”‚   β”‚ β”œβ”€β”¬ duplexify@3.4.2
    β”‚   β”‚ β”‚ β”œβ”€β”€ end-of-stream@1.0.0
    β”‚   β”‚ β”‚ └─┬ readable-stream@2.0.5
    β”‚   β”‚ β”‚   β”œβ”€β”€ core-util-is@1.0.2
    β”‚   β”‚ β”‚   β”œβ”€β”€ isarray@0.0.1
    β”‚   β”‚ β”‚   β”œβ”€β”€ process-nextick-args@1.0.6
    β”‚   β”‚ β”‚   β”œβ”€β”€ string_decoder@0.10.31
    β”‚   β”‚ β”‚   └── util-deprecate@1.0.2
    β”‚   β”‚ β”œβ”€β”€ infinity-agent@2.0.3
    β”‚   β”‚ β”œβ”€β”€ is-redirect@1.0.0
    β”‚   β”‚ β”œβ”€β”€ is-stream@1.0.1
    β”‚   β”‚ β”œβ”€β”€ lowercase-keys@1.0.0
    β”‚   β”‚ β”œβ”€β”€ nested-error-stacks@1.0.2
    β”‚   β”‚ β”œβ”€β”€ object-assign@3.0.0
    β”‚   β”‚ β”œβ”€β”€ prepend-http@1.0.3
    β”‚   β”‚ β”œβ”€β”¬ read-all-stream@3.0.1
    β”‚   β”‚ β”‚ └─┬ pinkie-promise@1.0.0
    β”‚   β”‚ β”‚   └── pinkie@1.0.0
    β”‚   β”‚ └── timed-out@2.0.0
    β”‚   └─┬ registry-url@3.0.3
    β”‚     └─┬ rc@1.1.5
    β”‚       β”œβ”€β”€ deep-extend@0.4.0
    β”‚       β”œβ”€β”€ ini@1.3.4
    β”‚       β”œβ”€β”€ minimist@1.2.0
    β”‚       └── strip-json-comments@1.0.4
    β”œβ”€β”€ semver-diff@2.1.0
    └── string-length@1.0.1

So I'm really not sure why you're seeing that. Maybe file a bug report with npm?

jamestalmage commented 8 years ago

Actually, it is only ~16.5 MB, @ariporad's number includes dev-dependencies. You need to delete node_modules and run

$ npm install --production

If you create a new project and just do this:

$ npm init
# default for every prompt
$ npm i babel-core babel-preset-es2015 babel-preset-stage-2

I get a relatively svelte 6.8 MB.

Adding babel-plugin-espower brings me to 9.8 MB. That seems like a pretty significant jump. @twada - Any ideas how we can reduce this?

Adding babel-runtime@6.X.X does bump me up to 14 MB, but that is due to massive duplication of babel-runtime@5.X.X. It gets copied into the node_modules folder of every babel-plugin-transform-*. This is expected, since current babel plugins are written in ES6, compiled with babel@5, and maintain a dev-dependency on babel-runtime@5. This really does not hurt your install times though, since all those duplicates are definitely coming from the cache (babel-runtime is not re-downloaded 20 times).

2.5 MB for the remaining 30 some dependencies we have seems pretty reasonable.

ariporad commented 8 years ago

@jamestalmage: that's strange, I did go above and beyond my usual intelligence level and create a new project to install AVA, but I'll try again when I'm home.

novemberborn commented 8 years ago

What are we hoping to achieve here? With changing dependencies this is a never ending struggle.

That said, looks like all Babel dependencies require babel-runtime@^5, whereas we explicitly install ^6. There's FIFTY copies of babel-runtime@5.8.35.

Presumably we could downgrade to ^5 for the time being and we'd save a lot space. In my testing that takes us from 77MB to 29MB.

Of course there's other dependencies doing weird stuff, like fsevents which pulls in 7MB just for node-pre-gyp.


To measure I did a fresh install from NPM (in an empty directory) and ran du -k -d 1 node_modules | sort -n -r. Also check out snyk-resolve which shows the actual dependencies, not deduped.

sindresorhus commented 8 years ago

@novemberborn There are some things that can be done even if the worst offender, Babel and fsevents, are out of our control. Many packages include junk like tests or examples directory, etc. I did a PR marathon a few years ago for Yeoman on 100+ different packages adding a "files" property to their package.json to reduce the total disk size of the dependency tree. That helped a lot. Pretty much have this still open for when I have time to do the same here.

novemberborn commented 8 years ago

Pretty much have this still open for when I have time to do the same here.

Sure, fair enough. Somebody should write a tool for that :stuck_out_tongue_winking_eye:

Also thinking about it more I'm doubtful we can change our babel-runtime version. Presumably the runtime transformer plugin builds against v6, not v5.

novemberborn commented 8 years ago

Also thinking about it more I'm doubtful we can change our babel-runtime version. Presumably the runtime transformer plugin builds against v6, not v5.

Actually if we have a dependency which merely reexports babel-runtime it would allow npm to dedupe babel-runtime@5 instead.

jamestalmage commented 8 years ago

Actually if we have a dependency which merely reexports babel-runtime it would allow npm to dedupe babel-runtime@5 instead.

I thought about that. Actually, I think it would be better if Babel did that (all the Babel 6 plugins should depend on a differently named module that exports babel-runtime@5). That way everyone benefits.

sindresorhus commented 8 years ago

Actually, I think it would be better if Babel did that (all the Babel 6 plugins should depend on a differently named module that exports babel-runtime@5). That way everyone benefits.

:+1:

jokeyrhyme commented 8 years ago

Is detecting Node v6 possible or an option? Would we still want babel to be part of ava when the environment is ES2015-compliant?

jfmengels commented 8 years ago

@jokeyrhyme AVA still injects features that have not yet landed in ES2015 or ES2016, such as async/await. Additionally, it uses Babel for internal transforms (enhancing assertions with power-assert for instance).

I don't know if it's possible to correctly detect the Node version, but that'd be at runtime, not at install time. The team could remove the ES2015 preset when all supported Node versions support it, but that could take a while.

jokeyrhyme commented 8 years ago

@jfmengels we might be able to install babel in a pre/post-install npm hook, and only install exactly the transforms needed to get us from the current version of node to stage-2 or whatever our threshold is. That would mean fewer dependencies for newer Nodes?

sindresorhus commented 8 years ago

@jokeyrhyme That's unfortunately not an option for so many reasons. Some of the best features of AVA require Babel, so I don't see why anyone would want to drop it for some minor space savings. The biggest Babel size issue is about to get fixed anyways https://github.com/babel/babel/pull/3438.

If you want to help out with this, I'd suggest you find packages in the dependency tree that includes junk like test/examples/etc folders and ask them (or better yet do a PR) to use the files property in package.json.

sindresorhus commented 8 years ago

Here's a list of packages we depend on that doesn't have a files entry or .npmignore. Please help us reduce the size of AVA by submitting PRs to those packages adding a files property in package.json.

Tip: $ npm i -g npm-home and then just write nh package-name to go to a specific package.

The list was generated with:

❯ package-config-checker | grep βœ– | sed 's/^ *βœ–/- [ ]/g'
billyjanitsch commented 8 years ago

It may also be worth thinking about install time as well as size. See #841 -- on my machine, AVA's install took ~50.1s. I wonder how much of that is I/O (in which case it will be fixed by addressing the size issue) vs. dependency resolution (in which case the deep nesting itself is also a cause) vs. network traffic (a bit of both, since package requests are made individually).

Another option is to pull out some of the larger deps that only cater to certain use cases into optional plugins, although I suspect the core team would prefer to avoid additional config.

jamestalmage commented 8 years ago

The real issue here is that npm is just slow at this. npm install ava creates hundreds of http requests that just get 3XX responses. It can't even do much of it in parallel, because it needs to resolve which version of direct dependencies will be used, before it can start querying one level deep for transitive dependencies.

I don't see us dropping lots of dependencies. The only dependencies that would be easy to replace, are also ones that are not really going to cut down on download times.

Also, I really don't think comparing cleared cache download times is that valuable. I'm much more concerned with download times when we have mostly cache hits. (AVA is still pretty bad by that metric as well, but it's not as extreme).

achecopar commented 8 years ago

Hello. I have been checking the list of packages, and found out that many of them already have a closed PR, specially from feross and substack authors.

I submit an updated list here with some packages edited in bold, the ones with a new PR and the ones that have an .npmignore. I also wrote the state of the related PR for each one.

The reason and previous discussions on why the PRs were not accepted can be found in feross/is-buffer#12

PACKAGE LIST

novemberborn commented 7 years ago

https://github.com/siddharthkp/cost-of-modules is also a nice tool:

$ cost-of-modules --no-install --less

Calculating...

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ name                           β”‚ children     β”‚ size   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ babel-preset-stage-2           β”‚ 57           β”‚ 23.66M β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ babel-core                     β”‚ 35           β”‚ 15.96M β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ babel-preset-es2015-node4      β”‚ 33           β”‚ 11.36M β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ chokidar                       β”‚ 130          β”‚ 5.44M  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ babel-runtime                  β”‚ 2            β”‚ 3.82M  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ babel-plugin-espower           β”‚ 9            β”‚ 2.33M  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ babel-plugin-ava-throws-helper β”‚ 6            β”‚ 1.18M  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ jest-snapshot                  β”‚ 10           β”‚ 0.87M  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ bluebird                       β”‚ 0            β”‚ 0.58M  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ meow                           β”‚ 25           β”‚ 0.30M  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ + 66 modules                   β”‚              β”‚        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 76 modules                     β”‚ 345 children β”‚ 44.53M β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜
novemberborn commented 7 years ago

With npm 5.3, in a temp directory:

❯ npm init --yes
❯ npm i ava
❯ npx cost-of-modules --no-install --less
npx: installed 16 in 2.28s

Calculating...

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ name      β”‚ children     β”‚ size   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ ava       β”‚ 750          β”‚ 46.04M β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 1 modules β”‚ 413 children β”‚ 17.22M β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The final size matches what Finder reports. I think that's pretty good! Plus, installation times are a lot better with npm 5.

Whilst we can always improve this, I don't think there's much use in keeping this issue open.