You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -155,7 +155,7 @@ A couple of handlers are included in the library:
155
155
* text sync compare - `dircompare.fileCompareHandlers.lineBasedFileCompare.compareSync`
156
156
* text async compare - `dircompare.fileCompareHandlers.lineBasedFileCompare.compareAsync`
157
157
158
-
Use [defaultFileCompare.js](https://github.com/gliviu/dir-compare/blob/master/src/FileCompareHandler/default/defaultFileCompare.ts) as an example to create your own.
158
+
Use [defaultFileCompare](https://github.com/gliviu/dir-compare/blob/master/src/FileCompareHandler/default/defaultFileCompare.ts) as an example to create your own.
159
159
160
160
### Ignore line endings and white spaces
161
161
Line based comparator can be used to ignore line ending and white space differences.
@@ -180,6 +180,62 @@ console.log(res)
180
180
dircompare.compare(path1, path2, options)
181
181
.then(res=>console.log(res))
182
182
```
183
+
184
+
## Glob filter
185
+
The current implementation of the glob filter uses minimatch and is based on [includeFilter and excludeFilter options](#glob-patterns). While it is meant to fit most use cases, [some scenarios](https://github.com/gliviu/dir-compare/issues/67) are not addressed.
186
+
187
+
Use [filterHandler option](https://gliviu.github.io/dc-api/interfaces/Options.html#filterHandler) to alter this behavior.
188
+
189
+
The following example demonstrates how to include only files with a specific extension in our comparison.
For reference, the default minimatch filter can be found in [defaultFilterHandler](https://github.com/gliviu/dir-compare/blob/master/src/FilterHandler/defaultFilterHandler.ts) which is exposed by [filterHandlers property](https://gliviu.github.io/dc-api/variables/filterHandlers.html).
216
+
217
+
### Implement .gitignore filter
218
+
[Globby](https://www.npmjs.com/package/globby) library provides the functionality to parse and apply `.gitignore` rules.
219
+
This is a [sample implementation](https://github.com/gliviu/dir-compare/blob/master/test/extended/gitignoreSupport/gitignoreFilter.ts) that uses globby and dir-compare filter extension.
includeFilter: '*.js'// if present, regular filters are applied after .gitignore rules.
233
+
}
234
+
235
+
const res:Result=compareSync(d1, d2, options)
236
+
237
+
```
238
+
183
239
## Name comparators
184
240
If [default](https://github.com/gliviu/dir-compare/blob/master/src/NameCompare/defaultNameCompare.ts) name comparison is not enough, custom behavior can be specified with [compareNameHandler](https://gliviu.github.io/dc-api/interfaces/Options.html#compareNameHandler) option.
185
241
Following example adds the possibility to ignore file extensions.
For reference, the default name comparator can be found in [defaultNameCompare](https://github.com/gliviu/dir-compare/blob/master/src/NameCompare/defaultNameCompare.ts) which is exposed by [compareNameHandlers property](https://gliviu.github.io/dc-api/variables/compareNameHandlers.html).
281
+
224
282
225
283
## Result builder
226
284
[Result builder](https://gliviu.github.io/dc-api/interfaces/Options.html#resultBuilder) is called for each pair of entries encountered during comparison. Its purpose is to append entries in `diffSet` and eventually update `statistics` object with new stats.
@@ -244,74 +302,22 @@ const res = dircompare.compareSync('...', '...', options)
244
302
245
303
The [default](https://github.com/gliviu/dir-compare/blob/master/src/ResultBuilder/defaultResultBuilderCallback.ts) builder can be used as an example.
246
304
247
-
## Glob filter
248
-
The current implementation of the glob filter uses minimatch and is based on [includeFilter and excludeFilter options](#glob-patterns). While it is meant to fit most use cases, [some scenarios](https://github.com/gliviu/dir-compare/issues/67) are not addressed.
249
-
250
-
Use [filterHandler option](https://gliviu.github.io/dc-api/interfaces/Options.html#filterHandler) to alter this behavior.
251
-
252
-
The following example demonstrates how to include only files with a specific extension in our comparison.
For reference, the default minimatch filter can be found in [defaultFilterHandler](https://github.com/gliviu/dir-compare/blob/master/src/FilterHandler/defaultFilterHandler.ts) which is exposed by [filterHandlers property](https://gliviu.github.io/dc-api/index.html#filterHandlers).
279
-
280
-
### Implement .gitignore filter
281
-
[Globby](https://github.com/sindresorhus/globby) library provides the functionality to parse and apply `.gitignore` rules.
282
-
This is a [sample implementation](https://github.com/gliviu/dir-compare/blob/master/test/extended/gitignoreSupport/gitignoreFilter.ts) that uses globby and dir-compare filter extension.
*[Visual Studio Code - Compare Folders](https://marketplace.visualstudio.com/items?itemName=moshfeu.compare-folders)
305
308
306
309
# Changelog
310
+
* v4.2.0
311
+
* Updated dependencies
312
+
* Increased test coverage
307
313
* v4.1.0
308
314
* Possibility to alter the default [Glob filter](#glob-filter) behavior
309
315
*[Ignore files and directories according to .gitignore rules](#implement-gitignore-filter).
310
316
* New [origin](https://gliviu.github.io/dc-api/interfaces/Entry.html#origin) field in Entry to distinguish between the left or right directory
311
317
* Improved api documentation
312
318
* v4.0.0
313
319
* Switched project to typescript
314
-
*[Async comparator](https://gliviu.github.io/dc-api/index.html#compare) improvements when comparing large directory structures
320
+
*[Async comparator](https://gliviu.github.io/dc-api/functions/compare.html) improvements when comparing large directory structures
315
321
* Heap usage has decreased 3x compared to previous version
316
322
* Works 2x faster when comparing by content
317
323
* Better concurrency. UI apps will be more responsive while comparison is ongoing
* Broken links are no longer treated as errors. As a result there are new statistics (leftBrokenLinks, rightBrokenLinks, distinctBrokenLinks, totalBrokenLinks) and new entry type - broken-link.
0 commit comments