Skip to content

Commit

Permalink
update dependencies; remove newrelic to compatible with node v11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Nov 18, 2018
1 parent b00b5c8 commit 2008e4d
Show file tree
Hide file tree
Showing 17 changed files with 303 additions and 346 deletions.
1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"no-useless-rename": 1,
"rest-spread-spacing": 1,
"no-trailing-spaces": 1,
"quotes": [1, "single"],
"no-control-regex": 0,
"prettier/prettier": 0,
"no-await-in-loop": 1
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ config/app.json
config/config.js
yarn-error.log
tmp
newrelic_agent.log
*.swp
*.iml
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: node_js

node_js:
- "lts/*"
node_js: stable

install:
- yarn
Expand Down
3 changes: 0 additions & 3 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
"website": "https://docs.rsshub.app/",
"logo": "https://i.imgur.com/NZpRScX.png",
"keywords": ["RSS"],
"engines": {
"node": "10.x"
},
"env": {
"PORT": {
"value": "80",
Expand Down
1 change: 0 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,4 @@ module.exports = {
pass: process.env.HTTP_BASIC_AUTH_PASS || 'passw0rd',
},
puppeteerWSEndpoint: process.env.PUPPETEER_WS_ENDPOINT,
newrelicLicenseKey: process.env.NEWRELIC_LICENSE_KEY,
};
3 changes: 0 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
const config = require('./config');
if (config.newrelicLicenseKey) {
require('newrelic');
}
const Koa = require('koa');
const fs = require('fs');
const logger = require('./utils/logger');
Expand Down
24 changes: 0 additions & 24 deletions newrelic.js

This file was deleted.

25 changes: 12 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@
},
"homepage": "https://github.com/DIYgod/RSSHub#readme",
"devDependencies": {
"eslint": "5.8.0",
"eslint-config-prettier": "^3.1.0",
"eslint": "5.9.0",
"eslint-config-prettier": "^3.3.0",
"eslint-plugin-prettier": "^3.0.0",
"lint-staged": "^8.0.2",
"nodemon": "^1.18.4",
"prettier": "^1.14.2",
"lint-staged": "^8.0.5",
"nodemon": "^1.18.6",
"prettier": "^1.15.2",
"prettier-check": "^2.0.0",
"vuepress": "0.14.4",
"vuepress": "0.14.5",
"yorkie": "^2.0.0"
},
"dependencies": {
"art-template": "4.13.1",
"art-template": "4.13.2",
"axios": "0.18.0",
"axios-retry": "3.1.1",
"cheerio": "1.0.0-rc.2",
Expand All @@ -49,28 +49,27 @@
"dayjs": "^1.7.7",
"form-data": "^2.3.2",
"git-rev-sync": "1.12.0",
"googleapis": "34.0.0",
"googleapis": "35.0.0",
"he": "^1.1.1",
"iconv-lite": "0.4.24",
"imgur": "^0.3.1",
"json-bigint": "0.3.0",
"koa": "2.6.1",
"koa": "2.6.2",
"koa-basic-auth": "^3.0.0",
"koa-favicon": "2.0.1",
"koa-mount": "^4.0.0",
"koa-router": "7.4.0",
"lru-cache": "4.1.3",
"luxon": "^1.4.3",
"luxon": "^1.7.1",
"markdown-it": "^8.4.2",
"newrelic": "^4.9.0",
"path-to-regexp": "2.4.0",
"pidusage": "^2.0.17",
"plist": "^3.0.1",
"puppeteer": "^1.9.0",
"puppeteer": "^1.10.0",
"raven": "^2.6.4",
"readall": "1.1.0",
"redis": "2.8.0",
"rss-parser": "3.5.2",
"rss-parser": "3.5.3",
"sharp": "^0.21.0",
"twit": "2.2.11",
"winston": "3.1.0"
Expand Down
46 changes: 24 additions & 22 deletions routes/99percentinvisible/transcript.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,30 @@ module.exports = async (ctx) => {
.get();

const out = await Promise.all(
list.filter((e) => e.startsWith('/episode')).map(async (itemUrl) => {
itemUrl = url.resolve(host, itemUrl);
const cache = await ctx.cache.get(itemUrl);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}

const response = await axios.get(itemUrl);
const $ = cheerio.load(response.data);

const single = {
title: $('article header h1')
.text()
.trim(),
link: itemUrl,
author: '99% Invisible',
description: $('article .transcript-content').html(),
pubDate: new Date($('article header .entry-meta time').text()),
};
ctx.cache.set(itemUrl, JSON.stringify(single), 24 * 60 * 60);
return Promise.resolve(single);
})
list
.filter((e) => e.startsWith('/episode'))
.map(async (itemUrl) => {
itemUrl = url.resolve(host, itemUrl);
const cache = await ctx.cache.get(itemUrl);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}

const response = await axios.get(itemUrl);
const $ = cheerio.load(response.data);

const single = {
title: $('article header h1')
.text()
.trim(),
link: itemUrl,
author: '99% Invisible',
description: $('article .transcript-content').html(),
pubDate: new Date($('article header .entry-meta time').text()),
};
ctx.cache.set(itemUrl, JSON.stringify(single), 24 * 60 * 60);
return Promise.resolve(single);
})
);

ctx.state.data = {
Expand Down
14 changes: 8 additions & 6 deletions routes/github/issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ module.exports = async (ctx) => {
ctx.state.data = {
title: `${user}/${repo} Issues`,
link: host,
item: data.filter((item) => item.pull_request === undefined).map((item) => ({
title: item.title,
description: md.render(item.body) || 'No description',
pubDate: new Date(item.created_at),
link: `${host}/${item.number}`,
})),
item: data
.filter((item) => item.pull_request === undefined)
.map((item) => ({
title: item.title,
description: md.render(item.body) || 'No description',
pubDate: new Date(item.created_at),
link: `${host}/${item.number}`,
})),
};
};
27 changes: 13 additions & 14 deletions routes/universities/cas/sim/academic.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,19 @@ module.exports = async (ctx) => {

const list = $('.list-news li')
.slice(0, 10)
.map(
(i, e) =>
$(e).children().length > 0
? {
link: $(e)
.find('a')
.attr('href'),
date: $(e)
.find('span')
.text()
.replace('[', '')
.replace(']', ''),
}
: null
.map((i, e) =>
$(e).children().length > 0
? {
link: $(e)
.find('a')
.attr('href'),
date: $(e)
.find('span')
.text()
.replace('[', '')
.replace(']', ''),
}
: null
)
.get();

Expand Down
56 changes: 29 additions & 27 deletions routes/universities/sdu/cmse.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,36 @@ module.exports = async (ctx) => {
.get();

const out = await Promise.all(
list.filter((e) => e.startsWith('../info')).map(async (itemUrl) => {
itemUrl = url.resolve(host, itemUrl.slice('3'));
const cache = await ctx.cache.get(itemUrl);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}

const response = await axios.get(itemUrl);
const $ = cheerio.load(response.data);

const rawDate = $('#show_info')
.text()
.split(/\s{4}/);
let date = rawDate[0].split(':')[1];
date = date.slice(0, 4) + '-' + date.slice(5, 7) + '-' + date.slice(8, 10) + ' ' + date.slice(12);

const single = {
title: $('#show_title')
list
.filter((e) => e.startsWith('../info'))
.map(async (itemUrl) => {
itemUrl = url.resolve(host, itemUrl.slice('3'));
const cache = await ctx.cache.get(itemUrl);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}

const response = await axios.get(itemUrl);
const $ = cheerio.load(response.data);

const rawDate = $('#show_info')
.text()
.trim(),
link: itemUrl,
author: '山东大学材料科学与工程学院',
description: $('#show_content').html(),
pubDate: new Date(date),
};
ctx.cache.set(itemUrl, JSON.stringify(single), 24 * 60 * 60);
return Promise.resolve(single);
})
.split(/\s{4}/);
let date = rawDate[0].split(':')[1];
date = date.slice(0, 4) + '-' + date.slice(5, 7) + '-' + date.slice(8, 10) + ' ' + date.slice(12);

const single = {
title: $('#show_title')
.text()
.trim(),
link: itemUrl,
author: '山东大学材料科学与工程学院',
description: $('#show_content').html(),
pubDate: new Date(date),
};
ctx.cache.set(itemUrl, JSON.stringify(single), 24 * 60 * 60);
return Promise.resolve(single);
})
);

ctx.state.data = {
Expand Down
54 changes: 28 additions & 26 deletions routes/universities/sdu/epe.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,35 @@ module.exports = async (ctx) => {
.get();

const out = await Promise.all(
list.filter((e) => e.startsWith('../info')).map(async (itemUrl) => {
itemUrl = url.resolve(host, itemUrl.slice('3'));
const cache = await ctx.cache.get(itemUrl);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}

const response = await axios.get(itemUrl);
const $ = cheerio.load(response.data);

const rawDate = $('#show_info')
.text()
.split(/\s{4}/);
const date = rawDate[0].split(':')[1];

const single = {
title: $('#show_title')
list
.filter((e) => e.startsWith('../info'))
.map(async (itemUrl) => {
itemUrl = url.resolve(host, itemUrl.slice('3'));
const cache = await ctx.cache.get(itemUrl);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}

const response = await axios.get(itemUrl);
const $ = cheerio.load(response.data);

const rawDate = $('#show_info')
.text()
.trim(),
link: itemUrl,
author: '山东大学能源与动力工程学院',
description: $('#show_content').html(),
pubDate: new Date(date),
};
ctx.cache.set(itemUrl, JSON.stringify(single), 24 * 60 * 60);
return Promise.resolve(single);
})
.split(/\s{4}/);
const date = rawDate[0].split(':')[1];

const single = {
title: $('#show_title')
.text()
.trim(),
link: itemUrl,
author: '山东大学能源与动力工程学院',
description: $('#show_content').html(),
pubDate: new Date(date),
};
ctx.cache.set(itemUrl, JSON.stringify(single), 24 * 60 * 60);
return Promise.resolve(single);
})
);

ctx.state.data = {
Expand Down
Loading

0 comments on commit 2008e4d

Please sign in to comment.