@tunnckocore/publish-packed
v0.1.0
Published
Publishes a package together with its dependencies
Downloads
4
Readme
publish-packed
Publishes a package together with its dependencies
When publishing a package, dependencies are not bundled with the package. Although you could use bundledDependencies, you have to list all the dependencies you want to bundle.
publish-packed
bundles all dependencies with your package:
it installs all your dependencies first
it moves the
node_modules
folder from the root of your package tolib/node_modules
When publishing, npm ignores the
node_modules
folder in the root of your package. However, it packs allnode_modules
in subfolders.it escapes the
dependencies
field in your package'spackage.json
, so during installation no dependencies of your package will be installed, except optional dependencies.it can prune
node_modules
, removing markdown files, tests, configs and other resources that are not code
Limitations:
- you can use
publish-packed
only if all your source code is in thelib/
directory because all you dependencies are going to be insidelib/node_modules
. - you can use
publish-packed
only if your prod dependencies don't have lifecycle events likepostinstall
that should be executed during installation
Installation
npm install --global publish-packed
Usage
Install in-publish as dev dependency
npm install --save-dev in-publish
Add it to package.json
:
"scripts": {
"prepublish": "in-publish && echo 'You need to use \"publish-packed\" to publish this package' && false || not-in-publish"
}
To publish the package, run publish-packed
.