Adding CI and making CI ready
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Fabian Stamm 2020-01-07 23:03:26 +01:00
parent ef234ed748
commit e9e580b74d
6 changed files with 81 additions and 13 deletions

3
.drone.status Normal file
View File

@ -0,0 +1,3 @@
{
"url": "https://drone.hibas123.de/hibas123/THM_OSPLUS_NEWS_MAILER"
}

20
.drone.yml Normal file
View File

@ -0,0 +1,20 @@
kind: pipeline
type: docker
name: default
steps:
- name: Build with node
image: node:12
commands:
- npm install
- npm run build
- name: Publish to docker
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
auto_tag: true
repo: hibas123.azurecr.io/telegram-rss
registry: hibas123.azurecr.io

20
Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM node:12
LABEL maintainer="Fabian Stamm <dev@fabianstamm.de>"
RUN apt-get update
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ENV NODE_ENV=production
COPY ["package.json", "package-lock.json", "/usr/src/app/"]
RUN npm install
COPY lib/ /usr/src/app/lib
VOLUME [ "/usr/src/app/logs", "/usr/src/app/persist"]
CMD ["npm", "run", "start"]

41
package-lock.json generated
View File

@ -865,7 +865,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@ -886,12 +887,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -906,17 +909,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@ -1033,7 +1039,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
@ -1045,6 +1052,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -1059,6 +1067,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -1066,12 +1075,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@ -1090,6 +1101,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -1170,7 +1182,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
@ -1182,6 +1195,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -1267,7 +1281,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@ -1303,6 +1318,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -1322,6 +1338,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -1365,12 +1382,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},

View File

@ -32,4 +32,4 @@
"ssl-root-cas": "^1.2.5",
"telegraf": "^3.24.1"
}
}
}

View File

@ -12,11 +12,17 @@ import fetch from "node-fetch";
import rss from "rss-parser";
import Telegraf from "telegraf";
import * as fs from "fs";
dotenv.config();
const parser = new rss();
const entities = new AllHtmlEntities();
const adapter = new FileSync<{ feeds: IDBFeed[] }>("db.json");
if (!fs.existsSync("./persist")) {
fs.mkdirSync("./persist")
}
const adapter = new FileSync<{ feeds: IDBFeed[] }>("persist/db.json");
const db = low(adapter);
db.defaults({ feeds: [] }).write();