Comparing version 0.0.3-0 to 0.0.3
@@ -14,6 +14,3 @@ { | ||
], | ||
"program": "${workspaceFolder}/dist/src/index.js", | ||
"outFiles": [ | ||
"${workspaceFolder}/dist/**/*.js" | ||
], | ||
"program": "${workspaceFolder}/dist/rssmailer.js", | ||
"args": ["-c", "./config.js"] | ||
@@ -20,0 +17,0 @@ } |
@@ -54,3 +54,3 @@ "use strict"; | ||
logger_1["default"].debug({ conf: conf }); | ||
var feeds = conf.feeds.map(function (x) { | ||
var mergedFeeds = conf.feeds.map(function (x) { | ||
if (typeof x === "string") | ||
@@ -60,3 +60,3 @@ x = __assign(__assign({}, FEED_DEFAULT_CONF), { url: x }); | ||
}); | ||
return __assign(__assign(__assign({}, DEFAULT_CONF), conf), { feeds: feeds }); | ||
return __assign(__assign(__assign({}, DEFAULT_CONF), conf), { feeds: mergedFeeds }); | ||
}); |
@@ -44,3 +44,3 @@ "use strict"; | ||
}) | ||
.then(function (res) { return decodeHandleMap[feed.charset || "utf8"](res.data); }) | ||
.then(function (res) { return decodeHandleMap[feed.charset](res.data); }) | ||
.then(function (original) { return ({ feed: feed, original: original }); })["catch"](function (error) { | ||
@@ -47,0 +47,0 @@ logger_1["default"].error("fetch error ".concat(feed.url), (error === null || error === void 0 ? void 0 : error.message) || error); |
@@ -7,3 +7,3 @@ "use strict"; | ||
var categories = { | ||
"default": { appenders: ["stdout", "file"], level: "trace" } | ||
"default": { appenders: ["stdout", "file"], level: "info" } | ||
}; | ||
@@ -10,0 +10,0 @@ var appenders = { |
{ | ||
"name": "rss-mailer", | ||
"version": "0.0.3-0", | ||
"version": "0.0.3", | ||
"description": "RssMailer", | ||
"main": "index.js", | ||
"bin": { | ||
"rssmailer": "dist/rssmailer.js" | ||
"rssmailer": "dist/bin/rssmailer.js" | ||
}, | ||
"scripts": { | ||
"dev": "tsc -w", | ||
"dev": "tsc -w --sourceMap", | ||
"build": "rm -fr ./dist && tsc && cp -r src/template dist/" | ||
@@ -12,0 +12,0 @@ }, |
import path, { resolve } from "path"; | ||
import { Options } from "../rssmailer"; | ||
import { Options } from "../bin/rssmailer"; | ||
import logger from "./logger"; | ||
@@ -63,11 +63,12 @@ | ||
const feeds = conf.feeds.map((x: string | Feed) => { | ||
const mergedFeeds = conf.feeds.map((x: string | Feed) => { | ||
if (typeof x === "string") x = { ...FEED_DEFAULT_CONF, url: x } as Feed; | ||
return { ...FEED_DEFAULT_CONF, ...x }; | ||
}); | ||
return { | ||
...DEFAULT_CONF, | ||
...conf, | ||
feeds, | ||
feeds: mergedFeeds | ||
}; | ||
}; |
@@ -19,2 +19,7 @@ import { Conf, Feed } from "./configure"; | ||
/** | ||
* | ||
* @param feed | ||
* @returns | ||
*/ | ||
function request(feed: Feed) { | ||
@@ -28,3 +33,3 @@ logger.info(`fetch ${feed.url}`); | ||
}) | ||
.then((res) => decodeHandleMap[feed.charset || "utf8"](res.data)) | ||
.then((res) => decodeHandleMap[feed.charset](res.data)) | ||
.then((original) => ({ feed, original })) | ||
@@ -31,0 +36,0 @@ .catch((error) => { |
@@ -6,4 +6,7 @@ import { Item } from "rss-parser"; | ||
/** | ||
* | ||
*/ | ||
const NOW = Date.now(); | ||
function freshFilter(rule: FreshFilterRule, item: Item) { | ||
@@ -22,4 +25,12 @@ const pubDate = item.pubDate; | ||
/** | ||
* TODO | ||
*/ | ||
function countFilter(rule: CountFilterRule, item: Item) {} | ||
/** | ||
* | ||
*/ | ||
const filterMap = { | ||
@@ -29,3 +40,2 @@ fresh: freshFilter, | ||
}; | ||
function handleFilter(filterRules: Conf["filter"], items: Item[]) { | ||
@@ -43,2 +53,6 @@ return items.filter((item) => { | ||
/** | ||
* | ||
*/ | ||
export default (conf: Conf) => (data: PaseRes[]) => { | ||
@@ -45,0 +59,0 @@ const { filter } = conf; |
import { getLogger, configure } from "log4js"; | ||
import { join } from "path"; | ||
const logger = getLogger(); | ||
const categories = { | ||
default: { appenders: ["stdout", "file"], level: "trace" }, | ||
default: { appenders: ["stdout", "file"], level: "info" }, | ||
}; | ||
const appenders = { | ||
@@ -15,4 +18,4 @@ stdout: { type: "stdout" }, | ||
configure({ categories, appenders }); | ||
export default logger; |
@@ -13,5 +13,6 @@ import { Conf } from "./configure"; | ||
/** | ||
* | ||
*/ | ||
const parser: Parser<{}, {}> = new Parser(); | ||
function parse(data: FetcherRes): Promise<PaseRes> { | ||
@@ -18,0 +19,0 @@ logger.info(`parse ${data.feed.url}`) |
@@ -8,2 +8,3 @@ import { Conf } from "./configure"; | ||
/** | ||
@@ -10,0 +11,0 @@ * |
@@ -7,8 +7,5 @@ import { Conf, EmailSenderConf, FileSenderConf } from "./configure"; | ||
/** | ||
* | ||
* @param conf | ||
* @param emailConf | ||
* @param content | ||
* @returns | ||
*/ | ||
@@ -39,6 +36,2 @@ function sendEmail(conf: Conf, emailConf: EmailSenderConf, content: string) { | ||
* | ||
* @param conf | ||
* @param writeFileConf | ||
* @param content | ||
* @returns | ||
*/ | ||
@@ -65,2 +58,3 @@ function sendFile( | ||
/** | ||
@@ -74,2 +68,3 @@ * | ||
/** | ||
@@ -76,0 +71,0 @@ * |
@@ -9,5 +9,5 @@ { | ||
"preserveConstEnums": true, | ||
"sourceMap": false, | ||
"resolveJsonModule": true, | ||
"esModuleInterop": true | ||
"esModuleInterop": true, | ||
"declaration": true | ||
}, | ||
@@ -14,0 +14,0 @@ "include": [ |
32
75
37030
920