forked from AdguardTeam/HostlistsRegistry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
28 lines (23 loc) · 796 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* globals require, __dirname, process */
const path = require('path');
const fs = require('fs');
const builder = require("adguard-hostlists-builder");
// Validate services.json and make sure it is a valid JSON.
try {
JSON.parse(fs.readFileSync('assets/services.json', 'utf8'));
} catch (ex) {
console.error('Failed to parse services.json', ex);
process.exit(1);
}
// Compile hostlists.
const filtersDir = path.join(__dirname, './filters');
const assetsDir = path.join(__dirname, './assets');
const tagsDir = path.join(__dirname, './tags');
const localesDir = path.join(__dirname, './locales');
(async () => {
try {
await builder.build(filtersDir, tagsDir, localesDir, assetsDir);
} catch (e) {
console.error('Failed to compile hostlists', e)
}
})();