1
0
mirror of https://github.com/oceanprotocol/community-numbers.git synced 2024-11-22 01:37:02 +01:00

fixes & formatting

This commit is contained in:
Matthias Kretschmann 2020-06-16 12:32:47 +02:00
parent a9bf257d71
commit bf53963fe0
Signed by: m
GPG Key ID: 606EEEF3C479A91F
17 changed files with 236 additions and 221 deletions

View File

@ -1,13 +0,0 @@
# EditorConfig is awesome: http://EditorConfig.org
[*]
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
[*.json]
indent_size = 2

View File

@ -1,3 +1,3 @@
{ {
"extends": "oceanprotocol" "extends": ["oceanprotocol", "prettier"]
} }

View File

@ -1,7 +1,7 @@
version: 2 version: 2
updates: updates:
- package-ecosystem: npm - package-ecosystem: npm
directory: "/" directory: '/'
schedule: schedule:
interval: daily interval: daily
time: '03:00' time: '03:00'

6
.prettierrc Normal file
View File

@ -0,0 +1,6 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"tabWidth": 2
}

View File

@ -2,7 +2,9 @@ import fetch from 'node-fetch'
import { log, logError } from '../utils' import { log, logError } from '../utils'
const getGitcoin = async () => { const getGitcoin = async () => {
const response = await fetch('https://gitcoin.co/api/v0.1/bounties/?&org=oceanprotocol') const response = await fetch(
'https://gitcoin.co/api/v0.1/bounties/?&org=oceanprotocol'
)
if (response.status !== 200) { if (response.status !== 200) {
logError(`Non-200 response code from Gitcoin: ${response.status}`) logError(`Non-200 response code from Gitcoin: ${response.status}`)

View File

@ -11,7 +11,9 @@ export default async function fetchDiscord() {
const members = await page.evaluate(() => { const members = await page.evaluate(() => {
// get the activity count element // get the activity count element
const membersElement = document.querySelector('[class*="activityCount"] > div:last-child span') const membersElement = document.querySelector(
'[class*="activityCount"] > div:last-child span'
)
const membersElementText = membersElement.innerText const membersElementText = membersElement.innerText
const number = membersElementText.replace(' Members', '') const number = membersElementText.replace(' Members', '')
return number return number

View File

@ -14,7 +14,8 @@ const options = {
// Fetch all public GitHub repos // Fetch all public GitHub repos
// //
export default async function fetchGitHubRepos() { export default async function fetchGitHubRepos() {
const url = 'https://api.github.com/orgs/oceanprotocol/repos?type=public&per_page=200' const url =
'https://api.github.com/orgs/oceanprotocol/repos?type=public&per_page=200'
const start = Date.now() const start = Date.now()
const response = await fetch(url, options) const response = await fetch(url, options)
@ -27,7 +28,7 @@ export default async function fetchGitHubRepos() {
const numbers = [] const numbers = []
json.map(item => { json.map((item) => {
if (item.stargazers_count) { if (item.stargazers_count) {
return numbers.push(item.stargazers_count) return numbers.push(item.stargazers_count)
} }

View File

@ -15,7 +15,10 @@ export default async function fetchTelegram() {
const dataCommunity = await load(bodyCommunity, { normalizeWhitespace: true }) const dataCommunity = await load(bodyCommunity, { normalizeWhitespace: true })
let infoCommunity = dataCommunity('.tgme_page_extra').text() let infoCommunity = dataCommunity('.tgme_page_extra').text()
infoCommunity = infoCommunity.replace(' members', '').replace(' ', '').replace(' ', '') infoCommunity = infoCommunity
.replace(' members', '')
.replace(' ', '')
.replace(' ', '')
const membersCommunity = parseInt(infoCommunity) const membersCommunity = parseInt(infoCommunity)
log( log(

View File

@ -2,7 +2,8 @@ import fetch from 'node-fetch'
import { log, logError } from '../utils' import { log, logError } from '../utils'
export default async function fetchTwitter() { export default async function fetchTwitter() {
const url = 'https://cdn.syndication.twimg.com/widgets/followbutton/info.json?screen_names=oceanprotocol' const url =
'https://cdn.syndication.twimg.com/widgets/followbutton/info.json?screen_names=oceanprotocol'
const start = Date.now() const start = Date.now()
const response = await fetch(url) const response = await fetch(url)

View File

@ -1,9 +1,9 @@
/* eslint-disable no-console */ /* eslint-disable no-console */
const chalk = require('chalk') const chalk = require('chalk')
const log = text => console.log(text) const log = (text) => console.log(text)
const logError = text => console.error(chalk.bold.red(text)) const logError = (text) => console.error(chalk.bold.red(text))
const arrSum = arr => arr.reduce((a, b) => a + b, 0) const arrSum = (arr) => arr.reduce((a, b) => a + b, 0)
module.exports = { log, logError, arrSum } module.exports = { log, logError, arrSum }

15
package-lock.json generated
View File

@ -757,6 +757,15 @@
} }
} }
}, },
"eslint-config-prettier": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz",
"integrity": "sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA==",
"dev": true,
"requires": {
"get-stdin": "^6.0.0"
}
},
"eslint-config-standard": { "eslint-config-standard": {
"version": "14.0.0", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-14.0.0.tgz", "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-14.0.0.tgz",
@ -1186,6 +1195,12 @@
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
"dev": true "dev": true
}, },
"get-stdin": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz",
"integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==",
"dev": true
},
"get-stream": { "get-stream": {
"version": "5.1.0", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz",

View File

@ -9,13 +9,13 @@
"dependencies": { "dependencies": {
"chalk": "^4.1.0", "chalk": "^4.1.0",
"cheerio": "^1.0.0-rc.3", "cheerio": "^1.0.0-rc.3",
"ms": "^2.1.1",
"node-fetch": "^2.6.0", "node-fetch": "^2.6.0",
"puppeteer": "^4.0.0" "puppeteer": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^7.2.0", "eslint": "^7.2.0",
"eslint-config-oceanprotocol": "^1.5.0", "eslint-config-oceanprotocol": "^1.5.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-node": "^11.1.0" "eslint-plugin-node": "^11.1.0"
} }
} }

View File

@ -1,5 +1,3 @@
{ {
"routes": [ "routes": [{ "src": "/", "dest": "/api" }]
{ "src": "/", "dest": "/api" }
]
} }