Skip to content

Commit a82aafa

Browse files
committed
Ensure block/allowlist files exist
Enhances user friendliness.
1 parent c85eca4 commit a82aafa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cf_list_create.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ let duplicateDomainCount = 0;
3434
let allowedDomainCount = 0;
3535
const memoizedNormalizeDomain = memoize(normalizeDomain);
3636

37+
// Check if the blocklist.txt and allowlist.txt files exist
38+
for (const filename of [allowlistFilename, blocklistFilename]) {
39+
if (!existsSync(filename)) {
40+
console.error(`File not found: ${filename}. Please create a block/allowlist first, or run download_lists.js to download the recommended lists.`);
41+
process.exit(1);
42+
}
43+
}
44+
3745
// Read allowlist
3846
console.log(`Processing ${allowlistFilename}`);
3947
await readFile(resolve(`./${allowlistFilename}`), (line) => {

0 commit comments

Comments
 (0)