@@ -7,21 +7,28 @@ A tool for generating differential updates for filter lists.
77- [ Prerequisites] ( #prerequisites )
88- [ How to Install] ( #how-to-install )
99- [ How to Use] ( #how-to-use )
10- - [ CLI] ( #cli )
11- - [ API] ( #api )
12- - [ Algorithm] ( #algorithm )
10+ - [ CLI] ( #cli )
11+ - [ API] ( #api )
12+ - [ Algorithm Overview ] ( #algorithm-overview )
1313
1414## Prerequisites
1515
16- - ** diff utility** : This tool relies on the standard Unix ` diff ` utility to generate patches efficiently. Make sure it's installed on your system.
17- - On macOS: Available by default or through XCode CLI tools
18- - On Linux: Available by default or install via your package manager (e.g., ` apt-get install diffutils ` )
19- - On Windows: Available via WSL or Git Bash
16+ <!-- NOTE: Minimal supported Node.js version should be specified in package.json -->
17+ <!-- and the same one should be used for testing in .github/workflows/test.yaml -->
18+ - [ Node.js] v18.13.0 or higher.
19+
20+ - ** diff utility** — this tool relies on the standard Unix ` diff ` utility to generate patches efficiently.
21+ Make sure it's installed on your system:
22+ - On macOS: Available by default or through XCode CLI tools.
23+ - On Linux: Available by default or install via your package manager (e.g., ` apt-get install diffutils ` ).
24+ - On Windows: Available via WSL or Git Bash.
25+
26+ [ Node.js ] : https://nodejs.org/en/download
2027
2128## How to Install
2229
2330``` bash
24- yarn add @adguard/diff-builder
31+ pnpm add @adguard/diff-builder
2532```
2633
2734## How to Use
@@ -65,32 +72,38 @@ Where:
6572## Algorithm Overview
6673
6774### 1. Setup
68- - Resolve absolute paths for the old and new filters and the patches directory.
75+
76+ - Resolve absolute paths for the old and new filters and the patches directory.
6977
7078### 2. Prepare Patch Directory
71- - Ensure the patches directory exists, creating it if necessary.
79+
80+ - Ensure the patches directory exists, creating it if necessary.
7281
7382### 3. Clean Up Old Patches
74- - Delete any outdated patches from the patches directory except empty patches.
83+
84+ - Delete any outdated patches from the patches directory except empty patches.
7585
7686### 4. Read Filters and Detect Changes
77- - Read and split the old and new filter files into lines.
78- - Check if there are significant changes between the two sets of lines, excluding 'Diff-Path' and 'Checksum' tags.
87+
88+ - Read and split the old and new filter files into lines.
89+ - Check if there are significant changes between the two sets of lines, excluding 'Diff-Path' and 'Checksum' tags.
7990
8091### 5. Handle No Changes
81- - If no significant changes are found, revert any changes in the new filter and exit.
92+
93+ - If no significant changes are found, revert any changes in the new filter and exit.
8294
8395### 6. Process Changes
84- - Generate a new patch name and validate its uniqueness.
85- - Update the 'Diff-Path' tag in the new filter.
86- - Create a diff patch between the old and new filters.
87- - Optionally, add a checksum to the patch.
96+
97+ - Generate a new patch name and validate its uniqueness.
98+ - Update the 'Diff-Path' tag in the new filter.
99+ - Create a diff patch between the old and new filters.
100+ - Optionally, add a checksum to the patch.
88101
89102### 7. Finalize
90- - Write the updated new filter back to its file.
91- - Create an empty patch file for future use if necessary.
92- - Save the diff patch to the appropriate file.
93103
104+ - Write the updated new filter back to its file.
105+ - Create an empty patch file for future use if necessary.
106+ - Save the diff patch to the appropriate file.
94107
95108## API
96109
0 commit comments