Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

app-root

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

app-root - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

13

index.js

@@ -113,3 +113,5 @@ var detective = require('detective'),

function getAllJSFiles(directory, opt) {
var jsFilePaths = [];
var jsFilePaths = [],
ignoreDirs = opt.ignoreDirectories || [],
ignoreFiles = opt.ignoreFiles || [];

@@ -122,8 +124,9 @@ fs.readdirSync(directory).forEach(function (filename) {

if (isDirectory) {
if (opt.ignore && ! shouldBeIgnored(filename, opt.ignore) ||
(! opt.ignore || ! opt.ignore.length)) {
if (ignoreDirs.length && shouldBeIgnored(filename, ignoreDirs)) return;
jsFilePaths = jsFilePaths.concat(getAllJSFiles(fullName, opt));
}
jsFilePaths = jsFilePaths.concat(getAllJSFiles(fullName, opt));
} else if (ext === '.js') {
if (ignoreFiles && shouldBeIgnored(filename, ignoreFiles)) return;
jsFilePaths.push(fullName);

@@ -130,0 +133,0 @@ }

{
"name": "app-root",
"version": "1.1.2",
"version": "1.2.0",
"description": "Find the entry-point/root file of any CommonJS or AMD JavaScript application",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -18,6 +18,6 @@ Returns a list of candidate root files for CommonJS or AMD JavaScript applications within a directory.

### Ignoring particular subdirectories
### Ignoring particular subdirectories or files
Supply an options object as the second parameter with a field `ignore`
that contains a list of the directories that you want to ignore
Supply an options object as the second parameter with a field `ignoreDirectories` or `ignoreFiles`
that contains a list of the directories or files (respectively) that you want to ignore
when looking for candidate app roots.

@@ -29,3 +29,4 @@

var options = {
ignore: ['bower_components', 'vendor', 'node_modules', '.git']
ignoreDirectories: ['bower_components', 'vendor', 'node_modules', '.git'],
ignoreFiles: ['Gruntfile.js']
};

@@ -32,0 +33,0 @@

var getAppRoot = require('../');
var options = {
ignore: ['bower_components']
ignoreDirectories: ['bower_components'],
ignoreFiles: ['index.js']
};

@@ -6,0 +7,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc