Get a list of the files to add from a folder into an npm package
These can be handed to tar like so to make an npm package tarball:
const packlist =const tar =const packageDir = '/path/to/package'const packageTarball = '/path/to/package.tgz'
This uses the following rules:
package.jsonfile is found, and it has a
fileslist, then ignore everything that isn't in
files. Always include the readme, license, notice, changes, changelog, and history files, if they exist, and the package.json file itself.
If there's no
package.jsonfile (or it has no
fileslist), and there is a
.npmignorefile, then ignore all the files in the
If there's no
fileslist, and there's no
.npmignorefile, but there is a
.gitignorefile, then ignore all the files in the
Everything in the root
node_modulesis ignored, unless it's a bundled dependency. If it IS a bundled dependency, and it's a symbolic link, then the target of the link is included, not the symlink itself.
Unless they're explicitly included (by being in a
fileslist, or a
!negatedrule in a relevant
.gitignore), always ignore certain common cruft files:
- .npmignore and .gitignore files (their effect is in the package already, there's no need to include them in the package)
- editor junk like
.npmrcfiles (these may contain private configs)
- Waf and gyp cruft like
.DS_Storefiles because wtf are those even
npm-debug.logfiles at the root of a project
You can explicitly re-include any of these with a
package.jsonor a negated ignore file rule.
Same API as ignore-walk, just hard-coded file list and rule sets.
WalkerSync classes take a
bundled argument, which
is a list of package names to include from node_modules. When calling
packlist.sync() functions, this
module calls into