Refactor/Chore: prepare build infra for further optimization

This commit is contained in:
SukkaW
2023-09-14 20:45:01 +08:00
parent 78afa595a9
commit 0a4c99ab0e
21 changed files with 282 additions and 201 deletions

View File

@@ -6,7 +6,7 @@ const { processLine } = require('./lib/process-line');
const { createRuleset } = require('./lib/create-file');
const { runner } = require('./lib/trace-runner');
runner(__filename, async () => {
const buildTelegramCIDR = async () => {
/** @type {Response} */
const resp = await fetchWithRetry('https://core.telegram.org/resources/cidr.txt');
const lastModified = resp.headers.get('last-modified');
@@ -49,4 +49,10 @@ runner(__filename, async () => {
path.resolve(__dirname, '../List/ip/telegram.conf'),
path.resolve(__dirname, '../Clash/ip/telegram.txt')
));
});
};
module.exports.buildTelegramCIDR = buildTelegramCIDR;
if (require.main === module) {
runner(__filename, buildTelegramCIDR);
}