Gathering detailed insights and metrics for npm-packlist
Gathering detailed insights and metrics for npm-packlist
Gathering detailed insights and metrics for npm-packlist
Gathering detailed insights and metrics for npm-packlist
@types/npm-packlist
TypeScript definitions for npm-packlist
@npmcli/installed-package-contents
Get the list of files installed in a package in node_modules, including bundled dependencies
@pnpm/fs.packlist
Get a list of the files to add from a directory into an npm package
npm-pack-zip
Run npm pack to generate a .zip archive file
Walk through a folder and figure out what goes in an npm package
npm install npm-packlist
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
110 Stars
285 Commits
32 Forks
14 Watching
2 Branches
89 Contributors
Updated on 25 Nov 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
0.9%
1,895,982
Compared to previous day
Last week
5%
10,201,684
Compared to previous week
Last month
12.6%
41,162,177
Compared to previous month
Last year
15.6%
457,276,197
Compared to previous year
1
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:
1const Arborist = require('@npmcli/arborist') 2const packlist = require('npm-packlist') 3const tar = require('tar') 4const packageDir = '/path/to/package' 5const packageTarball = '/path/to/package.tgz' 6 7const arborist = new Arborist({ path: packageDir }) 8arborist.loadActual().then((tree) => { 9 packlist(tree) 10 .then(files => tar.create({ 11 prefix: 'package/', 12 cwd: packageDir, 13 file: packageTarball, 14 gzip: true 15 }, files)) 16 .then(_ => { 17 // tarball has been created, continue with your day 18 }) 19 })
This uses the following rules:
If a package.json
file is found, and it has a files
list,
then ignore everything that isn't in files
. Always include the root
readme, license, licence and copying files, if they exist, as well
as the package.json file itself. Non-root readme, license, licence and
copying files are included by default, but can be excluded using the
files
list e.g. "!readme"
.
If there's no package.json
file (or it has no files
list), and
there is a .npmignore
file, then ignore all the files in the
.npmignore
file.
If there's no package.json
with a files
list, and there's no
.npmignore
file, but there is a .gitignore
file, then ignore
all the files in the .gitignore
file.
Everything in the root node_modules
is 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 files
list, or
a !negated
rule in a relevant .npmignore
or .gitignore
),
always ignore certain common cruft files:
.*.swp
, ._*
and .*.orig
files.npmrc
files (these may contain private configs)node_modules/.bin
folder/build/config.gypi
and .lock-wscript
.DS_Store
files because wtf are those evennpm-debug.log
files at the root of a projectYou can explicitly re-include any of these with a files
list in
package.json
or a negated ignore file rule.
Only the package.json
file in the very root of the project is ever
inspected for a files
list. Below the top level of the root package,
package.json
is treated as just another file, and no package-specific
semantics are applied.
package.json
and .npmignore
rulesIn previous versions of this library, the files
list in package.json
was used as an initial filter to drive further tree walking. That is no
longer the case as of version 6.0.0.
If you have a package.json
file with a files
array within, any top
level .npmignore
and .gitignore
files will be ignored.
If a directory is listed in files
, then any rules in nested .npmignore
files within that directory will be honored.
For example, with this package.json:
1{ 2 "files": [ "dir" ] 3}
a .npmignore
file at dir/.npmignore
(and any subsequent
sub-directories) will be honored. However, a .npmignore
at the root
level will be skipped.
Additionally, with this package.json:
{
"files": ["dir/subdir"]
}
a .npmignore
file at dir/.npmignore
will be honored, as well as dir/subdir/.npmignore
.
Any specific file matched by an exact filename in the package.json files
list will be included, and cannot be excluded, by any .npmignore
files.
Same API as ignore-walk, except providing a tree
is required and there are hard-coded file list and rule sets.
The Walker
class requires an arborist tree, and if any bundled dependencies are found will include them as well as their own dependencies in the resulting file set.
No vulnerabilities found.
Reason
all changesets reviewed
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
7 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More