mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
prototype fetching repos from GitHub's GraphQL API
This commit is contained in:
parent
64a172f4c4
commit
05de45573a
1
.env.sample
Normal file
1
.env.sample
Normal file
@ -0,0 +1 @@
|
|||||||
|
GITHUB_TOKEN=
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,3 +5,5 @@ yarn-error.log
|
|||||||
.cache
|
.cache
|
||||||
/public
|
/public
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
.env.development
|
||||||
|
.env.production
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
const config = require('./config.js')
|
const config = require('./config.js')
|
||||||
|
|
||||||
|
require('dotenv').config({
|
||||||
|
path: `.env.${process.env.NODE_ENV}`
|
||||||
|
})
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
siteMetadata: {
|
siteMetadata: {
|
||||||
// spread all of our config values here
|
// spread all of our config values here
|
||||||
@ -36,6 +40,23 @@ module.exports = {
|
|||||||
path: `${__dirname}/node_modules/@oceanprotocol/art`
|
path: `${__dirname}/node_modules/@oceanprotocol/art`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
resolve: 'gatsby-source-graphql',
|
||||||
|
options: {
|
||||||
|
typeName: 'GitHub',
|
||||||
|
fieldName: 'github',
|
||||||
|
// Url to query from
|
||||||
|
url: 'https://api.github.com/graphql',
|
||||||
|
// HTTP headers
|
||||||
|
headers: {
|
||||||
|
// Learn about environment variables: https://gatsby.app/env-vars
|
||||||
|
Authorization: `bearer ${process.env.GITHUB_TOKEN}`
|
||||||
|
},
|
||||||
|
// Additional options to pass to node-fetch
|
||||||
|
fetchOptions: {},
|
||||||
|
refetchInterval: 60
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
resolve: 'gatsby-transformer-remark',
|
resolve: 'gatsby-transformer-remark',
|
||||||
options: {
|
options: {
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
"gatsby-remark-responsive-iframe": "^2.0.6",
|
"gatsby-remark-responsive-iframe": "^2.0.6",
|
||||||
"gatsby-remark-smartypants": "^2.0.6",
|
"gatsby-remark-smartypants": "^2.0.6",
|
||||||
"gatsby-source-filesystem": "^2.0.8",
|
"gatsby-source-filesystem": "^2.0.8",
|
||||||
|
"gatsby-source-graphql": "^2.0.6",
|
||||||
"gatsby-transformer-remark": "^2.1.12",
|
"gatsby-transformer-remark": "^2.1.12",
|
||||||
"gatsby-transformer-sharp": "^2.1.8",
|
"gatsby-transformer-sharp": "^2.1.8",
|
||||||
"gatsby-transformer-yaml": "^2.1.5",
|
"gatsby-transformer-yaml": "^2.1.5",
|
||||||
@ -49,6 +50,7 @@
|
|||||||
"test": "npm run lint"
|
"test": "npm run lint"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"dotenv": "^6.1.0",
|
||||||
"eslint": "^5.9.0",
|
"eslint": "^5.9.0",
|
||||||
"eslint-config-oceanprotocol": "^1.3.0",
|
"eslint-config-oceanprotocol": "^1.3.0",
|
||||||
"eslint-config-prettier": "^3.1.0",
|
"eslint-config-prettier": "^3.1.0",
|
||||||
|
@ -15,6 +15,7 @@ const RepositoryList = ({ repositories }) => (
|
|||||||
key={item.name}
|
key={item.name}
|
||||||
name={item.name}
|
name={item.name}
|
||||||
description={item.description}
|
description={item.description}
|
||||||
|
url={item.url}
|
||||||
links={item.links}
|
links={item.links}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
@ -29,9 +29,7 @@ const QuickRun = () => (
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
const Repositories = () => (
|
const query = graphql`
|
||||||
<StaticQuery
|
|
||||||
query={graphql`
|
|
||||||
query {
|
query {
|
||||||
allRepositoriesYaml {
|
allRepositoriesYaml {
|
||||||
edges {
|
edges {
|
||||||
@ -49,10 +47,31 @@ const Repositories = () => (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
github {
|
||||||
|
organization(login: "oceanprotocol") {
|
||||||
|
repositories(first: 100) {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
description
|
||||||
|
url
|
||||||
}
|
}
|
||||||
`}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
const Repositories = () => (
|
||||||
|
<StaticQuery
|
||||||
|
query={query}
|
||||||
render={data => {
|
render={data => {
|
||||||
const repositories = data.allRepositoriesYaml.edges
|
const repositories = data.allRepositoriesYaml.edges
|
||||||
|
const repositoriesGitHub =
|
||||||
|
data.github.organization.repositories.edges
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.repositories}>
|
<div className={styles.repositories}>
|
||||||
|
Loading…
Reference in New Issue
Block a user