A tool that pre bundles and re-publishes npm dependencies
The goal of this module is to reduce the number of visible
dependencies in node_modules
; npm ls
& package-lock.json
that are NOT related to production code.
pre-bundled
solves half the problem, look at the sister
project npm-bin-deps
to solve the other half.
To add new modules to pre-bundled
you need github & npm access
to run the binary.
If you run this command without access to github or npm then please reach out by opening an issue or send a tweet
The pre-bundled
binary will re-bundle a library like rimraf
or tape
such that it has zero dependencies, by checking all
of the dependencies into git and into the npm tarball.
You can see a list of existing pre-bundled modules on
To add new ones you run pre-bundled ${module} ${version}
If you have ever been frustrated with too many dependencies and wish you could install more glorious zero dependency libraries then this module is for you.
As an example, tape
has 69 total dependencies and ends up
auditing 107 packages.
raynos at raynos-Precision-5530
~/optoolco/temp
$ npm i tape -D --loglevel notice
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
+ [email protected]
updated 1 package and audited 107 packages in 2.905s
found 0 vulnerabilities
raynos at raynos-Precision-5530
~/optoolco/temp
$ npm ls | wc -l
69
Of couse @pre-bundled/tape
has one dependency and audits
exactly one dependency
raynos at raynos-Precision-5530
~/optoolco/temp
$ npm i @pre-bundled/tape -D
npm http fetch GET 304 https://registry.npmjs.org/@pre-bundled%2ftape 2026ms (from cache)
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 414ms
+ @pre-bundled/[email protected]
added 1 package from 1 contributor and audited 1 package in 2.545s
found 0 vulnerabilities
raynos at raynos-Precision-5530
~/optoolco/temp
$ npm ls
[email protected] /home/raynos/optoolco/temp
@pre-bundled/[email protected]
Peer dependencies are BROKEN.
Imagine you have a small project with a couple of important non-trivial production dependencies and then some test dependencies.
For example tape
& rimraf
; Just these two simple dependencies
add quite a lot of weight to your project ( 70 extra dependencies )
raynos at raynos-Precision-5530
~/projects/fake-cloudwatch-logs on npr*
$ cat package-lock.json | wc -l
485
raynos at raynos-Precision-5530
~/projects/fake-cloudwatch-logs on npr*
$ npm ls | wc -l
91
raynos at raynos-Precision-5530
~/projects/fake-cloudwatch-logs on npr*
$ ls node_modules/ | wc -l
57
God forbid you install a larger dependency like jest
which adds
350 deps or tap
which adds 250 deps.
By using @pre-bundled/tape
& @pre-bundled/rimraf
you can
install any dependency as if its a micro zero dependency library.
raynos at raynos-Precision-5530
~/projects/fake-cloudwatch-logs on npr
$ cat package-lock.json | wc -l
146
raynos at raynos-Precision-5530
~/projects/fake-cloudwatch-logs on npr
$ npm ls | wc -l
24
raynos at raynos-Precision-5530
~/projects/fake-cloudwatch-logs on npr
$ ls node_modules/ | wc -l
18
Your dependency count is now tiny, if you look at the actual
output of npm ls
you can see
raynos at raynos-Precision-5530
~/projects/fake-cloudwatch-logs on npr
$ npm ls
[email protected] /home/raynos/projects/fake-cloudwatch-logs
@pre-bundled/[email protected]
@pre-bundled/[email protected]
@types/[email protected]
[email protected]
[email protected]
[email protected]
[email protected] deduped
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected] deduped
[email protected]
[email protected]
[email protected] deduped
[email protected]
[email protected]
[email protected]
You can now see all of your important production dependencies from
aws-sdk
and the extra dependencies like tape
& rimraf
dont
take up any mental space or physical space.
$ pre-bundled -h
pre-bundled {module} {version}
This tool re-bundles a module and publishes
It to both github & npm for pre-bundled
module: NPM module name
version: Version you want to bundle
To run this tool you need access to NPM & github
Ask @Raynos on twitter
--dry Run it in dry mode ( no publish )
--publishSuffix set a suffic for publishing
% npm install pre-bundled -g