
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
Functionality ( and README ) heavily inspired by ck86's main-bower-files
var mainNPMFiles = require('npmfiles');
var files = mainNPMFiles([options]);
This will read your package.json, iterate through your dependencies and returns an array of files defined in the main property of the packages package.json.
You can override the behavior if you add an overrides property to your own package.json.
var gulp = require('gulp');
var mainNPMFiles = require('npmfiles');
gulp.task('TASKNAME', function() {
return gulp.src(mainNPMFiles())
.pipe(/* what you want to do with the files */)
});
These options can be set directly in your package.json file, e.g.:
{
"name": "your-package-name",
"dependencies": {
"NPM-PACKAGE": "*"
},
"overrides": {
"NPM-PACKAGE": {
"main": [
// Here you can override the main files or ignoring this package, for more info see options
]
}
}
}
Type: String or Array
You can specify which files should be selected. e.g.:
You can also use glob pattern to select files, e.g.:
{
"overrides": {
"NPM-PACKAGE": {
"main": "**/*.js"
}
}
}
Type: Boolean Default: false
Set to true if you want to ignore this package.
These options can be passed to this plugin, e.g: mainNPMFiles(/* options*/)
Type: String
You can specify the node_modules folder path where the modules are located.
For example:
mainNPMFiles({
nodeModulesPath: 'path/for/node_modules'
})
.pipe(gulp.dest('client/src/lib'));
Type: String
You can specify the package.json file path.
For example:
mainNPMFiles({
packageJsonPath: 'path/for/package.json'
})
.pipe(gulp.dest('client/src/lib'));
Type: Boolean Default: false
Set this option to true to add the devDependencies to your dependencies
Type: Boolean Default: false
Set this option to true to show warnings for packages that don't have any files in the main entry or overrides
(MIT License)
Copyright (c) 2017 Cosmin Lupu
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Get all main files for your project's NPM modules
The npm package npmfiles receives a total of 685 weekly downloads. As such, npmfiles popularity was classified as not popular.
We found that npmfiles demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.