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

dir-compare

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dir-compare - npm Package Compare versions

Comparing version 3.2.0 to 3.3.0

6

build/src/entry/entryBuilder.js

@@ -87,2 +87,5 @@ const fs = require('fs');

const path = pathUtils.join(relativePath, entry.name);
if (options.skipEmptyDirs && entry.stat.isDirectory() && isEmptyDir(entry.absolutePath)) {
return false;
}
if ((entry.stat.isFile() && options.includeFilter) && (!match(path, options.includeFilter))) {

@@ -96,2 +99,5 @@ return false;

}
function isEmptyDir(path) {
return fs.readdirSync(path).length === 0;
}
/**

@@ -98,0 +104,0 @@ * Matches path by pattern.

30

build/src/types.d.ts

@@ -13,7 +13,17 @@ /// <reference types="node" />

* Compares files by size. Defaults to 'false'.
*
* Usually one of `compareSize` or `compareContent` options has to be activated. Otherwise files are compared by name disregarding size or content.
*/
compareSize?: boolean;
/**
* Compares files by date of modification (stat.mtime). Defaults to 'false'.
* Compares files by content. Defaults to 'false'.
*
* Usually one of `compareSize` or `compareContent` options has to be activated. Otherwise files are compared by name disregarding size or content.
*/
compareContent?: boolean;
/**
* Compares files by date of modification (stat.mtime). Defaults to 'false'.
*
* Also see [[Options.dateTolerance]].
*/
compareDate?: boolean;

@@ -25,6 +35,2 @@ /**

/**
* Compares files by content. Defaults to 'false'.
*/
compareContent?: boolean;
/**
* Compares entries by symlink. Defaults to 'false'.

@@ -45,2 +51,6 @@

/**
* Ignore empty directories. Defaults to 'false'.
*/
skipEmptyDirs?: boolean;
/**
* Ignore symbolic links. Defaults to 'false'.

@@ -75,9 +85,9 @@ */

*
* Lets consider we want to compare two identical folders `A` and `B` with `B/dir2` being unreadable for current user.
* Lets consider we want to compare two identical folders `A` and `B` with `B/dir2` being unreadable for the current user.
* ```
* A B
* dir1 dir1
* file1 file1
* dir2 dir2 (permission denied)
* file2 file2
* ├── dir1 ├── dir1
* ├──── file1 ├──── file1
* ├── dir2 ├── dir2 (permission denied)
* └─────file2 └─────file2
* ```

@@ -84,0 +94,0 @@ *

{
"name": "dir-compare",
"version": "3.2.0",
"version": "3.3.0",
"description": "Node JS directory compare",

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

@@ -79,3 +79,2 @@ dir-compare

```typescript

@@ -91,2 +90,11 @@ compare(path1: string, path2: string, options?: Options): Promise<Result>

Common options:
* [compareSize](https://gliviu.github.io/dc-api/interfaces/options.html#comparesize)
* [compareContent](https://gliviu.github.io/dc-api/interfaces/options.html#comparecontent)
* [compareDate](https://gliviu.github.io/dc-api/interfaces/options.html#comparedate)
* [excludeFilter](https://gliviu.github.io/dc-api/interfaces/options.html#excludefilter)
* [includeFilter](https://gliviu.github.io/dc-api/interfaces/options.html#includefilter)
* [ignoreCase](https://gliviu.github.io/dc-api/interfaces/options.html#ignorecase)
* [skipSubdirs](https://gliviu.github.io/dc-api/interfaces/options.html#skipsubdirs)
* [skipEmptyDirs](https://gliviu.github.io/dc-api/interfaces/options.html#skipemptydirs)

@@ -101,12 +109,15 @@ ## Glob patterns

```javascript
const options = {
excludeFilter: ".git,node_modules", // exclude git and node modules directories
excludeFilter: "expected" , // exclude '/tests/expected' directory
excludeFilter: "/tests/expected" , // exclude '/tests/expected' directory
excludeFilter: "**/expected" , // exclude '/tests/expected' directory
excludeFilter: "**/tests/**/*.js" , // exclude all js files in '/tests' directory and subdirectories
includeFilter: "*.js,*.yml" , // include js and yaml files
includeFilter: "/tests/**/*.js" , // include all js files in '/tests' directory and subdirectories
includeFilter: "**/tests/**/*.ts" // include all js files in '/tests' directory and subdirectories
}
```
dircompare -x ".git,node_modules" dir1 dir2') exclude git and node modules directories
dircompare -x "expected" dir1 dir2') exclude '/tests/expected' directory
dircompare -x "/tests/expected" dir1 dir2') exclude '/tests/expected' directory
dircompare -x "**/expected" dir1 dir2') exclude '/tests/expected' directory
dircompare -x "**/tests/**/*.js" dir1 dir2') exclude all js files in '/tests' directory and subdirectories
dircompare -f "*.js,*.yml" dir1 dir2') include js and yaml files
dircompare -f "/tests/**/*.js" dir1 dir2') include all js files in '/tests' directory and subdirectories
dircompare -f "**/tests/**/*.ts" dir1 dir2') include all js files in '/tests' directory and subdirectories
```

@@ -239,4 +250,5 @@ ## Custom file content comparators

# Changelog
* v3.3.0 Added `skipEmptyDirs` option
* v3.2.0 [Handle permission denied errors](#handling-permission-denied-errors)
* v3.1.0 Added ignoreAllWhiteSpaces and ignoreEmptyLines options
* v3.1.0 Added `ignoreAllWhiteSpaces` and `ignoreEmptyLines` options
* v3.0.0 Moved CLI component into separate project [dir-compare-cli](https://github.com/gliviu/dir-compare-cli)

@@ -243,0 +255,0 @@ * v2.4.0 New option to customize file/folder name comparison

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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