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

This commit is contained in:
Fabian Stamm 2020-01-07 22:32:08 +01:00
parent 148acaadd1
commit 87e33a3bd0
6 changed files with 1146 additions and 8 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/osplus-mail
registry: hibas123.azurecr.io

22
Dockerfile Normal file
View File

@ -0,0 +1,22 @@
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"]
EXPOSE 3006/tcp
CMD ["npm", "run", "start"]

1093
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -12,22 +12,22 @@
"live": "nodemon -i db.json lib/index.js" "live": "nodemon -i db.json lib/index.js"
}, },
"devDependencies": { "devDependencies": {
"@types/dotenv": "^4.0.3", "@types/dotenv": "^8.2.0",
"@types/html-entities": "^1.2.16", "@types/html-entities": "^1.2.16",
"@types/lowdb": "^1.0.5", "@types/lowdb": "^1.0.5",
"@types/node": "^10.7.0", "@types/node": "^13.1.4",
"@types/node-fetch": "^2.1.2", "@types/node-fetch": "^2.1.2",
"@types/nodemailer": "^4.6.2", "@types/nodemailer": "^6.4.0",
"nodemon": "^1.18.3", "nodemon": "^2.0.2",
"typescript": "^3.0.1" "typescript": "^3.0.1"
}, },
"dependencies": { "dependencies": {
"@hibas123/nodelogging": "^1.3.12", "@hibas123/nodelogging": "^2.1.2",
"dotenv": "^6.0.0", "dotenv": "^8.2.0",
"html-entities": "^1.2.1", "html-entities": "^1.2.1",
"lowdb": "^1.0.0", "lowdb": "^1.0.0",
"node-fetch": "^2.2.0", "node-fetch": "^2.2.0",
"nodemailer": "^4.6.7", "nodemailer": "^6.4.2",
"rss-parser": "^3.4.2", "rss-parser": "^3.4.2",
"ssl-root-cas": "^1.2.5", "ssl-root-cas": "^1.2.5",
"telegraf": "^3.24.1" "telegraf": "^3.24.1"

View File

@ -56,7 +56,7 @@ async function check() {
try { try {
let data = await fetch(process.env.FEED).then(res => res.text()); let data = await fetch(process.env.FEED).then(res => res.text());
Logging.log("Received Data"); Logging.log("Received Data");
let feed: Feed = await parser.parseString(data).catch(err => Logging.error(err)); let feed: Feed = await parser.parseString(data).catch(err => Logging.error(err)) as any;
//Check for new entries //Check for new entries
let items = feed.items.filter(item => { let items = feed.items.filter(item => {
return db.get(calculateHash(item)).value() !== true; return db.get(calculateHash(item)).value() !== true;