1
0
mirror of https://github.com/oceanprotocol/community-numbers.git synced 2024-12-22 17:23:31 +01:00

fixes forlocal development

This commit is contained in:
Matthias Kretschmann 2020-06-16 15:16:31 +02:00
parent 45a0e6ade2
commit 8a01b9f3fa
Signed by: m
GPG Key ID: 606EEEF3C479A91F
8 changed files with 28 additions and 13 deletions

View File

@ -22,7 +22,7 @@ export default async function fetchBounties() {
const { total, open } = await getGitcoin()
log(
'Re-fetched bounties. ' +
' bounties. ' +
`Total: ${total} bounties. Open: ${open} bounties. ` +
`Elapsed: ${new Date() - start}ms`
)

View File

@ -1,16 +1,25 @@
import chrome from 'chrome-aws-lambda'
import puppeteer from 'puppeteer-core'
import { log } from '../utils'
const isDev = process.env.VERCEL_URL === undefined
const puppeteer = isDev ? require('puppeteer') : require('puppeteer-core')
export default async function fetchDiscord() {
const url = 'https://discord.com/invite/TnXjkR5'
const start = Date.now()
const browser = await puppeteer.launch({
args: chrome.args,
executablePath: await chrome.executablePath,
headless: chrome.headless
})
const config = {
ignoreHTTPSErrors: true,
...(isDev
? { headless: true }
: {
args: chrome.args,
executablePath: await chrome.executablePath,
headless: chrome.headless
})
}
const browser = await puppeteer.launch(config)
const page = await browser.newPage()
await page.goto(url)
@ -25,7 +34,7 @@ export default async function fetchDiscord() {
})
log(
'Re-fetched Discord. ' +
' Discord. ' +
`Total: ${members} members. ` +
`Elapsed: ${new Date() - start}ms`
)

View File

@ -39,7 +39,7 @@ export default async function fetchGitHubRepos() {
const repositories = json.length
log(
'Re-fetched GitHub. ' +
' GitHub. ' +
`Total: ${repositories} public projects with a total of ${stars} stargazers. ` +
`Elapsed: ${new Date() - start}ms`
)

View File

@ -18,7 +18,7 @@ export default async function fetchMedium() {
const followers = collection.metadata.followerCount
log(
'Re-fetched Medium. ' +
' Medium. ' +
`Total: ${followers} followers. ` +
`Elapsed: ${new Date() - start}ms`
)

View File

@ -22,7 +22,7 @@ export default async function fetchTelegram() {
const community = parseInt(infoCommunity)
log(
'Re-fetched Telegram. ' +
' Telegram. ' +
`Total: ${community} oceanprotocol_community members. ` +
`Elapsed: ${new Date() - start}ms`
)
@ -42,7 +42,7 @@ export default async function fetchTelegram() {
const news = parseInt(infoNews)
log(
'Re-fetched Telegram. ' +
' Telegram. ' +
`Total: ${news} oceanprotocol members. ` +
`Elapsed: ${new Date() - start}ms`
)

View File

@ -16,7 +16,7 @@ export default async function fetchTwitter() {
const followers = json[0].followers_count
log(
'Re-fetched Twitter. ' +
' Twitter. ' +
`Total: ${followers} followers. ` +
`Elapsed: ${new Date() - start}ms`
)

5
package-lock.json generated
View File

@ -282,6 +282,11 @@
"lambdafs": "^1.3.0"
}
},
"chrome-finder": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/chrome-finder/-/chrome-finder-1.0.7.tgz",
"integrity": "sha512-Cxdl9ns86sXKMU5jIWy7rb0jX0SlWBNVV30/eBvtYCSx+GfLOM+MyODWd6gv72QONFWPbEmere8VL/xVIrTzmA=="
},
"cli-cursor": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz",

View File

@ -10,6 +10,7 @@
"chalk": "^4.1.0",
"cheerio": "^1.0.0-rc.3",
"chrome-aws-lambda": "^3.1.1",
"chrome-finder": "^1.0.7",
"node-fetch": "^2.6.0",
"puppeteer": "^4.0.0",
"puppeteer-core": "^4.0.0"