1
0
mirror of https://github.com/oceanprotocol/community-numbers.git synced 2024-11-21 17:27:01 +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
updates:
- package-ecosystem: npm
directory: "/"
directory: '/'
schedule:
interval: daily
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'
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) {
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(() => {
// 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 number = membersElementText.replace(' Members', '')
return number

View File

@ -14,7 +14,8 @@ const options = {
// Fetch all public GitHub repos
//
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 response = await fetch(url, options)
@ -27,7 +28,7 @@ export default async function fetchGitHubRepos() {
const numbers = []
json.map(item => {
json.map((item) => {
if (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 })
let infoCommunity = dataCommunity('.tgme_page_extra').text()
infoCommunity = infoCommunity.replace(' members', '').replace(' ', '').replace(' ', '')
infoCommunity = infoCommunity
.replace(' members', '')
.replace(' ', '')
.replace(' ', '')
const membersCommunity = parseInt(infoCommunity)
log(

View File

@ -2,7 +2,8 @@ import fetch from 'node-fetch'
import { log, logError } from '../utils'
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 response = await fetch(url)

View File

@ -1,9 +1,9 @@
/* eslint-disable no-console */
const chalk = require('chalk')
const log = text => console.log(text)
const logError = text => console.error(chalk.bold.red(text))
const log = (text) => console.log(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 }

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": {
"version": "14.0.0",
"resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-14.0.0.tgz",
@ -1186,6 +1195,12 @@
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
"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": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz",

View File

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

View File

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