disposable-domains 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -0
- package/domain-manager.js +432 -0
- package/flattened_codebase.txt +335 -0
- package/index.js +6 -0
- package/index.json +121599 -0
- package/llm.json +9 -0
- package/package.json +27 -0
- package/test/helpers/isFQDN.js +17 -0
- package/test/helpers/lowercase.js +15 -0
- package/test/helpers/notInWildcard.js +20 -0
- package/test/index.js +33 -0
- package/test/wildcard.js +29 -0
- package/wildcard.js +6 -0
- package/wildcard.json +407 -0
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# disposable-email-domains
|
|
2
|
+
|
|
3
|
+
A list of [disposable email domains](http://en.wikipedia.org/wiki/Disposable_email_address) like `mailinator.com`. You can use it to detect or block disposable accounts in your signup process. Exact domain matches are found in [index.json](https://github.com/tompec/disposable-email-domains/blob/master/index.json) and wildcard domains (ex: `*.33mail.com`) are in [wildcard.json](https://github.com/tompec/disposable-email-domains/blob/master/wildcard.json).
|
|
4
|
+
|
|
5
|
+
# Examples
|
|
6
|
+
|
|
7
|
+
## Node.JS
|
|
8
|
+
```js
|
|
9
|
+
var domains = require('disposable-email-domains');
|
|
10
|
+
var wildcards = require('disposable-email-domains/wildcard.json');
|
|
11
|
+
|
|
12
|
+
// ... your code here
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
# Installation
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
$ npm install disposable-email-domains
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
# Contributing
|
|
22
|
+
|
|
23
|
+
Add new disposable domains to [index.json](https://github.com/tompec/disposable-email-domains/blob/master/index.json) and wildcard disposable domains to [wildcard.json](https://github.com/tompec/disposable-email-domains/blob/master/wildcard.json).
|
|
24
|
+
|
|
25
|
+
To easily add new domains, insert them into [index.txt](https://github.com/tompec/disposable-email-domains/blob/master/contributions/index.txt) and/or [wildcard.txt](https://github.com/tompec/disposable-email-domains/blob/master/contributions/wildcard.txt) and run `npm run add`.
|
|
26
|
+
The domains will be added to the respective files and some validation will be made to ensure they pass the tests.
|
|
27
|
+
|
|
28
|
+
Please run `npm run test` before creating a Pull Request to ensure all tests are passing.
|
|
29
|
+
|
|
30
|
+
You can also run `npm run prod` to add new domains and run the tests at the same time.
|
|
31
|
+
|
|
32
|
+
# License
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
WWWWWW||WWWWWW
|
|
36
|
+
W W W||W W W
|
|
37
|
+
||
|
|
38
|
+
( OO )__________
|
|
39
|
+
/ | \
|
|
40
|
+
/o o| MIT \
|
|
41
|
+
\___/||_||__||_|| *
|
|
42
|
+
|| || || ||
|
|
43
|
+
_||_|| _||_||
|
|
44
|
+
(__|__|(__|__|
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND "AS AND WHEN AVAILABLE", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
48
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
49
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
50
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
51
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
52
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
53
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const _ = require('lodash');
|
|
3
|
+
const validator = require('validator');
|
|
4
|
+
const { execSync } = require('child_process');
|
|
5
|
+
const { tlds } = require('top-level-domains');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Domain Manager - A comprehensive tool for managing disposable email domains
|
|
9
|
+
*
|
|
10
|
+
* This script combines functionality to:
|
|
11
|
+
* 1. Add new domains from contributions
|
|
12
|
+
* 2. Process domains (group by root domains, optimize wildcards)
|
|
13
|
+
* 3. Test domains for validity
|
|
14
|
+
* 4. Sort, deduplicate, and format domains
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// Configuration
|
|
18
|
+
const CONFIG = {
|
|
19
|
+
indexFile: 'index.json',
|
|
20
|
+
wildcardFile: 'wildcard.json',
|
|
21
|
+
contributionsDir: './contributions',
|
|
22
|
+
contributionsIndexFile: './contributions/index.txt'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Load domains from files
|
|
27
|
+
*/
|
|
28
|
+
function loadDomains() {
|
|
29
|
+
console.log('Loading domains...');
|
|
30
|
+
|
|
31
|
+
let index = [];
|
|
32
|
+
let wildcard = [];
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
if (fs.existsSync(CONFIG.indexFile)) {
|
|
36
|
+
index = JSON.parse(fs.readFileSync(CONFIG.indexFile, 'utf8'));
|
|
37
|
+
console.log(`Loaded ${index.length} domains from ${CONFIG.indexFile}`);
|
|
38
|
+
} else {
|
|
39
|
+
console.log(`${CONFIG.indexFile} not found, starting with empty index`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (fs.existsSync(CONFIG.wildcardFile)) {
|
|
43
|
+
wildcard = JSON.parse(fs.readFileSync(CONFIG.wildcardFile, 'utf8'));
|
|
44
|
+
console.log(`Loaded ${wildcard.length} domains from ${CONFIG.wildcardFile}`);
|
|
45
|
+
} else {
|
|
46
|
+
console.log(`${CONFIG.wildcardFile} not found, starting with empty wildcard list`);
|
|
47
|
+
}
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error(`Error loading domains: ${error.message}`);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return { index, wildcard };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Add new domains from contributions
|
|
58
|
+
*/
|
|
59
|
+
function addContributions(index, wildcard) {
|
|
60
|
+
console.log('Adding contributions...');
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
// Create contributions directory if it doesn't exist
|
|
64
|
+
if (!fs.existsSync(CONFIG.contributionsDir)) {
|
|
65
|
+
fs.mkdirSync(CONFIG.contributionsDir, { recursive: true });
|
|
66
|
+
fs.writeFileSync(CONFIG.contributionsIndexFile, '');
|
|
67
|
+
console.log('Created contributions directory and empty index.txt file');
|
|
68
|
+
return { index, wildcard };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Add new domains from contributions
|
|
72
|
+
if (fs.existsSync(CONFIG.contributionsIndexFile)) {
|
|
73
|
+
const newDomains = fs.readFileSync(CONFIG.contributionsIndexFile, 'utf8')
|
|
74
|
+
.split('\n')
|
|
75
|
+
.filter(d => d);
|
|
76
|
+
|
|
77
|
+
if (newDomains.length > 0) {
|
|
78
|
+
console.log(`Adding ${newDomains.length} new domains from contributions`);
|
|
79
|
+
index = _.concat(index, newDomains);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.error(`Error adding contributions: ${error.message}`);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return { index, wildcard };
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Clean and normalize domains
|
|
91
|
+
*/
|
|
92
|
+
function cleanDomains(index, wildcard) {
|
|
93
|
+
console.log('Cleaning domains...');
|
|
94
|
+
|
|
95
|
+
// Remove empty strings
|
|
96
|
+
index = index.filter(d => d);
|
|
97
|
+
wildcard = wildcard.filter(d => d);
|
|
98
|
+
|
|
99
|
+
// Lowercase
|
|
100
|
+
index = index.map(domain => _.toLower(domain));
|
|
101
|
+
wildcard = wildcard.map(domain => _.toLower(domain));
|
|
102
|
+
|
|
103
|
+
// Sort - using simple lexicographical sorting for compatibility with chai-sorted
|
|
104
|
+
index.sort();
|
|
105
|
+
wildcard.sort();
|
|
106
|
+
|
|
107
|
+
// Dedupe
|
|
108
|
+
index = _.uniq(index);
|
|
109
|
+
wildcard = _.uniq(wildcard);
|
|
110
|
+
|
|
111
|
+
return { index, wildcard };
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Process domains to optimize wildcards
|
|
116
|
+
*/
|
|
117
|
+
function processDomains(index, wildcard) {
|
|
118
|
+
console.log('Processing domains...');
|
|
119
|
+
|
|
120
|
+
// Get TLD list from the installed package
|
|
121
|
+
console.log('Using TLD list from top-level-domains package');
|
|
122
|
+
const tldList = tlds.map(item => item.tld);
|
|
123
|
+
tldList.sort((a, b) => b.length - a.length); // Sort by length (longest first)
|
|
124
|
+
console.log(`Loaded ${tldList.length} TLDs from package`);
|
|
125
|
+
|
|
126
|
+
// Function to extract TLD and SLD from a domain
|
|
127
|
+
function extractTldAndSld(domain) {
|
|
128
|
+
// Find the matching TLD
|
|
129
|
+
let matchedTld = null;
|
|
130
|
+
for (const tld of tldList) {
|
|
131
|
+
if (domain.endsWith(`.${tld}`)) {
|
|
132
|
+
matchedTld = tld;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// If no TLD match found, try to use the last part as TLD
|
|
138
|
+
if (!matchedTld) {
|
|
139
|
+
const parts = domain.split('.');
|
|
140
|
+
if (parts.length >= 2) {
|
|
141
|
+
matchedTld = parts[parts.length - 1];
|
|
142
|
+
} else {
|
|
143
|
+
// Can't extract TLD
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Extract SLD (second-level domain)
|
|
149
|
+
const tldPart = `.${matchedTld}`;
|
|
150
|
+
const domainWithoutTld = domain.slice(0, -tldPart.length);
|
|
151
|
+
const parts = domainWithoutTld.split('.');
|
|
152
|
+
|
|
153
|
+
if (parts.length === 1) {
|
|
154
|
+
// This is already a root domain (SLD + TLD)
|
|
155
|
+
return {
|
|
156
|
+
tld: matchedTld,
|
|
157
|
+
sld: parts[0],
|
|
158
|
+
rootDomain: domain
|
|
159
|
+
};
|
|
160
|
+
} else {
|
|
161
|
+
// This is a subdomain
|
|
162
|
+
const sld = parts[parts.length - 1];
|
|
163
|
+
const rootDomain = `${sld}${tldPart}`;
|
|
164
|
+
return {
|
|
165
|
+
tld: matchedTld,
|
|
166
|
+
sld: sld,
|
|
167
|
+
rootDomain: rootDomain
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Group domains by root domain
|
|
173
|
+
const domainGroups = {};
|
|
174
|
+
const unprocessableDomains = [];
|
|
175
|
+
|
|
176
|
+
index.forEach(domain => {
|
|
177
|
+
const extracted = extractTldAndSld(domain);
|
|
178
|
+
if (extracted) {
|
|
179
|
+
const key = extracted.rootDomain;
|
|
180
|
+
if (!domainGroups[key]) {
|
|
181
|
+
domainGroups[key] = [];
|
|
182
|
+
}
|
|
183
|
+
domainGroups[key].push(domain);
|
|
184
|
+
} else {
|
|
185
|
+
unprocessableDomains.push(domain);
|
|
186
|
+
console.warn(`Could not process domain: ${domain}`);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
console.log(`Grouped domains into ${Object.keys(domainGroups).length} root domains`);
|
|
191
|
+
console.log(`Found ${unprocessableDomains.length} unprocessable domains`);
|
|
192
|
+
|
|
193
|
+
// Count domains with multiple subdomains
|
|
194
|
+
let multiSubdomainCount = 0;
|
|
195
|
+
let threeOrMoreSubdomainsCount = 0;
|
|
196
|
+
Object.entries(domainGroups).forEach(([rootDomain, domains]) => {
|
|
197
|
+
if (domains.length > 1) {
|
|
198
|
+
multiSubdomainCount++;
|
|
199
|
+
}
|
|
200
|
+
if (domains.length >= 3) {
|
|
201
|
+
threeOrMoreSubdomainsCount++;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
console.log(`Found ${multiSubdomainCount} root domains with multiple subdomains`);
|
|
205
|
+
console.log(`Found ${threeOrMoreSubdomainsCount} root domains with three or more subdomains`);
|
|
206
|
+
|
|
207
|
+
// Prepare new lists
|
|
208
|
+
const newIndexDomains = [];
|
|
209
|
+
const newWildcardDomains = [...wildcard];
|
|
210
|
+
const movedToWildcard = [];
|
|
211
|
+
|
|
212
|
+
// Process each group
|
|
213
|
+
Object.entries(domainGroups).forEach(([rootDomain, domains]) => {
|
|
214
|
+
if (domains.length < 3) {
|
|
215
|
+
// Less than three domains with this root, keep them all in index.json
|
|
216
|
+
newIndexDomains.push(...domains);
|
|
217
|
+
} else {
|
|
218
|
+
// Three or more domains with this root
|
|
219
|
+
// Add the root domain to index.json if it's in the original list
|
|
220
|
+
if (domains.includes(rootDomain)) {
|
|
221
|
+
newIndexDomains.push(rootDomain);
|
|
222
|
+
} else {
|
|
223
|
+
// If the root domain itself isn't in the list, add the shortest domain
|
|
224
|
+
domains.sort((a, b) => a.length - b.length);
|
|
225
|
+
newIndexDomains.push(domains[0]);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Add the root domain to wildcard.json if not already there
|
|
229
|
+
if (!newWildcardDomains.includes(rootDomain)) {
|
|
230
|
+
newWildcardDomains.push(rootDomain);
|
|
231
|
+
movedToWildcard.push(rootDomain);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
// Add unprocessable domains back to index
|
|
237
|
+
newIndexDomains.push(...unprocessableDomains);
|
|
238
|
+
|
|
239
|
+
console.log(`Processed ${index.length} domains.`);
|
|
240
|
+
console.log(`New index has ${newIndexDomains.length} domains (${index.length - newIndexDomains.length} fewer).`);
|
|
241
|
+
console.log(`New wildcard has ${newWildcardDomains.length} domains (${newWildcardDomains.length - wildcard.length} more).`);
|
|
242
|
+
console.log(`Moved ${movedToWildcard.length} domains to wildcard.`);
|
|
243
|
+
|
|
244
|
+
// Make sure to sort the final lists again
|
|
245
|
+
newIndexDomains.sort();
|
|
246
|
+
newWildcardDomains.sort();
|
|
247
|
+
|
|
248
|
+
return {
|
|
249
|
+
index: newIndexDomains,
|
|
250
|
+
wildcard: newWildcardDomains
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Remove domains that are covered by wildcards
|
|
256
|
+
*/
|
|
257
|
+
function removeWildcardCoveredDomains(index, wildcard) {
|
|
258
|
+
console.log('Removing domains covered by wildcards...');
|
|
259
|
+
|
|
260
|
+
const regexp = new RegExp(/(.+(?:\.[\w-]+\.[\w-]+)+)$/);
|
|
261
|
+
|
|
262
|
+
const filteredIndex = index.filter(domain => {
|
|
263
|
+
if (regexp.test(domain)) {
|
|
264
|
+
return !wildcard.some(wildcardDomain => {
|
|
265
|
+
return _.endsWith(domain, wildcardDomain);
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
return true;
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
console.log(`Removed ${index.length - filteredIndex.length} domains covered by wildcards`);
|
|
272
|
+
|
|
273
|
+
// Make sure to sort again after filtering
|
|
274
|
+
filteredIndex.sort();
|
|
275
|
+
|
|
276
|
+
return {
|
|
277
|
+
index: filteredIndex,
|
|
278
|
+
wildcard
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Test domains for validity
|
|
284
|
+
*/
|
|
285
|
+
function testDomains(index, wildcard) {
|
|
286
|
+
console.log('Testing domains...');
|
|
287
|
+
|
|
288
|
+
const invalidIndex = [];
|
|
289
|
+
const invalidWildcard = [];
|
|
290
|
+
|
|
291
|
+
// Test if domains are valid FQDNs
|
|
292
|
+
index.forEach(domain => {
|
|
293
|
+
if (!validator.isFQDN(domain)) {
|
|
294
|
+
invalidIndex.push(domain);
|
|
295
|
+
console.warn(`Invalid domain in index: ${domain}`);
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
wildcard.forEach(domain => {
|
|
300
|
+
if (!validator.isFQDN(domain)) {
|
|
301
|
+
invalidWildcard.push(domain);
|
|
302
|
+
console.warn(`Invalid domain in wildcard: ${domain}`);
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
// Remove invalid domains
|
|
307
|
+
const validIndex = index.filter(domain => !invalidIndex.includes(domain));
|
|
308
|
+
const validWildcard = wildcard.filter(domain => !invalidWildcard.includes(domain));
|
|
309
|
+
|
|
310
|
+
console.log(`Removed ${invalidIndex.length} invalid domains from index`);
|
|
311
|
+
console.log(`Removed ${invalidWildcard.length} invalid domains from wildcard`);
|
|
312
|
+
|
|
313
|
+
// Final sort to ensure alphabetical order
|
|
314
|
+
validIndex.sort();
|
|
315
|
+
validWildcard.sort();
|
|
316
|
+
|
|
317
|
+
return {
|
|
318
|
+
index: validIndex,
|
|
319
|
+
wildcard: validWildcard
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Save domains to files
|
|
325
|
+
*/
|
|
326
|
+
function saveDomains(index, wildcard) {
|
|
327
|
+
console.log('Saving domains...');
|
|
328
|
+
|
|
329
|
+
// Final sort before saving to ensure alphabetical order
|
|
330
|
+
index.sort();
|
|
331
|
+
wildcard.sort();
|
|
332
|
+
|
|
333
|
+
try {
|
|
334
|
+
fs.writeFileSync(CONFIG.indexFile, JSON.stringify(index, null, 2));
|
|
335
|
+
fs.writeFileSync(CONFIG.wildcardFile, JSON.stringify(wildcard, null, 2));
|
|
336
|
+
|
|
337
|
+
console.log(`Saved ${index.length} domains to ${CONFIG.indexFile}`);
|
|
338
|
+
console.log(`Saved ${wildcard.length} domains to ${CONFIG.wildcardFile}`);
|
|
339
|
+
|
|
340
|
+
// Clear contribution files after successful save
|
|
341
|
+
if (fs.existsSync(CONFIG.contributionsIndexFile)) {
|
|
342
|
+
fs.writeFileSync(CONFIG.contributionsIndexFile, '');
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
return true;
|
|
346
|
+
} catch (error) {
|
|
347
|
+
console.error(`Error saving domains: ${error.message}`);
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Run tests on the domains
|
|
354
|
+
*/
|
|
355
|
+
function runTests() {
|
|
356
|
+
console.log('Running tests...');
|
|
357
|
+
|
|
358
|
+
try {
|
|
359
|
+
// Check if mocha is installed
|
|
360
|
+
try {
|
|
361
|
+
execSync('npx mocha --version', { stdio: 'ignore' });
|
|
362
|
+
} catch (error) {
|
|
363
|
+
console.error('Mocha is not installed. Please install it with: npm install --save-dev mocha');
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// Run the tests
|
|
368
|
+
try {
|
|
369
|
+
const testOutput = execSync('npx mocha test/index.js test/wildcard.js', { encoding: 'utf8' });
|
|
370
|
+
console.log(testOutput);
|
|
371
|
+
return true;
|
|
372
|
+
} catch (error) {
|
|
373
|
+
console.error('Tests failed:');
|
|
374
|
+
console.error(error.stdout);
|
|
375
|
+
return false;
|
|
376
|
+
}
|
|
377
|
+
} catch (error) {
|
|
378
|
+
console.error(`Error running tests: ${error.message}`);
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Main function
|
|
385
|
+
*/
|
|
386
|
+
function main() {
|
|
387
|
+
console.log('=== Domain Manager ===');
|
|
388
|
+
|
|
389
|
+
// Process command line arguments
|
|
390
|
+
const args = process.argv.slice(2);
|
|
391
|
+
const skipTests = args.includes('--skip-tests');
|
|
392
|
+
const skipProcessing = args.includes('--skip-processing');
|
|
393
|
+
|
|
394
|
+
// Load domains
|
|
395
|
+
let { index, wildcard } = loadDomains();
|
|
396
|
+
|
|
397
|
+
// Add contributions
|
|
398
|
+
({ index, wildcard } = addContributions(index, wildcard));
|
|
399
|
+
|
|
400
|
+
// Clean domains
|
|
401
|
+
({ index, wildcard } = cleanDomains(index, wildcard));
|
|
402
|
+
|
|
403
|
+
// Process domains (optimize wildcards)
|
|
404
|
+
if (!skipProcessing) {
|
|
405
|
+
({ index, wildcard } = processDomains(index, wildcard));
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// Remove domains covered by wildcards
|
|
409
|
+
({ index, wildcard } = removeWildcardCoveredDomains(index, wildcard));
|
|
410
|
+
|
|
411
|
+
// Test domains
|
|
412
|
+
({ index, wildcard } = testDomains(index, wildcard));
|
|
413
|
+
|
|
414
|
+
// Save domains
|
|
415
|
+
const saveSuccess = saveDomains(index, wildcard);
|
|
416
|
+
|
|
417
|
+
// Run tests
|
|
418
|
+
if (!skipTests && saveSuccess) {
|
|
419
|
+
const testsSuccess = runTests();
|
|
420
|
+
if (testsSuccess) {
|
|
421
|
+
console.log('All tests passed!');
|
|
422
|
+
} else {
|
|
423
|
+
console.error('Tests failed!');
|
|
424
|
+
process.exit(1);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
console.log('Done!');
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// Run the main function
|
|
432
|
+
main();
|