diff --git a/.env.sample b/.env.sample
new file mode 100644
index 00000000..3b926cd6
--- /dev/null
+++ b/.env.sample
@@ -0,0 +1 @@
+GITHUB_TOKEN=
diff --git a/.gitignore b/.gitignore
index a2ab7551..adeedae8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,5 @@ yarn-error.log
.cache
/public
.DS_Store
+.env
+.env.*
diff --git a/.travis.yml b/.travis.yml
index 32170ba0..cb673f33 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,7 +5,7 @@ node_js: node
script:
- npm test
- - npm run build
+ - 'if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then npm run build; fi'
notifications:
email: false
diff --git a/README.md b/README.md
index f5b6f9ae..80d653ed 100644
--- a/README.md
+++ b/README.md
@@ -23,19 +23,18 @@
- [Repositories](#repositories)
- [Development](#development)
- [Use Docker](#use-docker)
+- [GitHub GraphQL API](#github-graphql-api)
- [Authors](#authors)
- [License](#license)
## Content
-All content lives in the [`/content`](content/) & [`/data`](data/) folders utilizing GitHub Flavored Markdown and YAML. Content is organized into the above mentioned categories through subfolders. Those subfolder names, along with the file name, define the final url of a given piece of content.
+All content lives in the [`/content`](content/) & [`/data`](data/) folders utilizing GitHub Flavored Markdown and YAML. Content is organized through subfolders corresponding to the sections mentioned below. Those subfolder names, along with the file name, define the final url of a given piece of content.
-The final navigational organisation of the content is driven through the sidebar files under [`/data/sidebars`](data/sidebars/).
+The final navigational organisation of the content is driven through the sidebar files under [`/data/sidebars`](data/sidebars/). Some global values used throughout the site can be set in [`config.js`](config.js).
Have a look at [docs.oceanprotocol.com/test/](https://docs.oceanprotocol.com/test/) to see what content elements can be used in the docs.
-Some global values used throughout the site can be set in [`config.js`](config.js).
-
### Sections
The documentation is split in multiple sections whose content lives in this repo:
@@ -48,12 +47,12 @@ Those sections and their copy are defined in the [`/data/sections.yml`](data/sec
TODO: Additionally, these docs live in their respective repos and are pulled into this site on build time:
-- API reference
+- API references
- Component docs
### Editing docs
-Every article on [docs.oceanprotocol.com](https://docs.oceanprotocol.com) ends with an _Edit this page on GitHub_ link. Clicking that will put you to the right place in the repository from where you can hit the _Edit_ pencil icon.
+Every article on [docs.oceanprotocol.com](https://docs.oceanprotocol.com) ends with an _Edit this page on GitHub_ link. Clicking that will put you to the right place in the repository from where you can hit the _Edit_ pencil icon on GitHub.
GitHub will automatically fork the repository if you are not part of the `oceanprotocol` organisation on GitHub. Members can simply push to a new branch on the original repo.
@@ -62,17 +61,40 @@ The editing workflow is as follows:
1. Make your changes
2. Push your changes to a new branch in the repo, or in your fork
3. Open a pull request against `master`, automatically asking for review
-4. Wait for review, possibly make request changes
+4. Wait for review, possibly make requested changes
5. Wait for all checks to pass
6. Merge!
### Adding docs
-...
+1. Add new Markdown file under one of the folders under [`/content`](content/)
+2. Add new path to one of the sidebars in [`/data/sidebars`](data/sidebars/)
+3. ...
### Repositories
-The repositories list is currently sourced from the [`/data/repositories.yml`](data/repositories.yml) file. The GitHub link is auto generated from the given repository name and will always be added by default.
+The repositories list is currently sourced from the [`/data/repositories.yml`](data/repositories.yml) file, defining the grouping, the display order, and which repos to include.
+
+Including a repo requires only the `name` key and value, and it needs to be exactly the same as the repo name on GitHub:
+
+```yaml
+- name: pleuston
+```
+
+Additional information about a repo will then be fetched automatically via [GitHub's GraphQL API](https://developer.github.com/v4/) on build time, and re-fetched every 5 minutes on client side. You can also add a private repo to prepare for a release, it will show up as soon as it is made public on GitHub.
+
+The above example will result in:
+
+
+
+Additionally, you can attach multiple links to a repo. The GitHub link is automatically added for every repository and will always be displayed. Add more links like so:
+
+```yaml
+- name: keeper-contracts
+ links:
+ - name: Documentation
+ url: https://github.com/oceanprotocol/keeper-contracts/tree/develop/doc
+```
- [`/data/repositories.yml`](data/repositories.yml)
@@ -112,6 +134,48 @@ docker-compose up
This will expose a hot-reloading server under [localhost:8000](http://localhost:8000).
+## GitHub GraphQL API
+
+The GitHub GraphQL API integration is done through [gatsby-source-graphql](https://www.gatsbyjs.org/packages/gatsby-source-graphql/) and requires authorization.
+
+An environment variable `GITHUB_TOKEN` needs to present, filled with a [personal access token](https://github.com/settings/tokens) with the scope `public_repo`.
+
+For local development, you can simply [create a personal access token](https://github.com/settings/tokens) and use it in your local .env file:
+
+```bash
+cp .env.sample .env
+vi .env
+# GITHUB_TOKEN=ADD-YOUR-TOKEN-HERE
+```
+
+When running the site locally, you can use the GraphiQL client running under [localhost:8000/\_\_\_graphql](http://localhost:8000/___graphql) to explore the whole GraphQL layer of the site (not just the GitHub infos).
+
+
+
+This query should get you started to explore what information you can get from GitHub:
+
+```graphql
+query {
+ github {
+ organization(login: "oceanprotocol") {
+ repositories(first: 100) {
+ edges {
+ node {
+ name
+ description
+ url
+ forkCount
+ stargazers {
+ totalCount
+ }
+ }
+ }
+ }
+ }
+ }
+}
+```
+
## Authors
- Troy McConaghy ([@ttmc](https://github.com/ttmc)) - [Ocean Protocol](https://oceanprotocol.com)
diff --git a/content/concepts/bounties.md b/content/concepts/bounties.md
index 9349f460..7ca5a4a7 100644
--- a/content/concepts/bounties.md
+++ b/content/concepts/bounties.md
@@ -5,6 +5,7 @@ description: Help with Ocean Protocol development and have Ocean Tokens rain on
Explain our bounties
-- [🎣 ocean-bounties](https://github.com/oceanprotocol/ocean-bounties/issues)
+
+
- [Gitcoin](https://gitcoin.co/profile/oceanprotocol)
- [bounties.network](https://explorer.bounties.network/explorer?bountyStage=active&search=ocean%20protocol)
diff --git a/content/concepts/development.md b/content/concepts/development.md
index 542436f7..2ddbf96c 100644
--- a/content/concepts/development.md
+++ b/content/concepts/development.md
@@ -7,7 +7,7 @@ description: Learn about the engineering process behind Ocean Protocol and how y
Ocean Protocol uses [C4 Standard process](https://github.com/unprotocols/rfc/blob/master/1/README.md) to manage changes in the source code. Find more details in the respective [OEP-01](https://github.com/oceanprotocol/OEPs/tree/master/1).
-- [🐙 Ocean Protocol Enhancement Proposals (OEPs)](https://github.com/oceanprotocol/OEPs)
+
## Project management
@@ -16,4 +16,5 @@ We use GitHub as a means for maintaining and tracking issues, roadmap and source
- [Ocean Protocol on GitHub](https://github.com/oceanprotocol)
- [Business Board (Ocean Roadmap)](https://github.com/oceanprotocol/ocean/projects/1)
- [Milestones](https://github.com/oceanprotocol/ocean/milestones?direction=asc&sort=due_date&state=open)
-- [🕶 dev-ocean](https://github.com/oceanprotocol/dev-ocean): Ocean Engineering Pages with documentation about Development, DevOps, QA, Security, etc.
+
+
diff --git a/content/concepts/ecosystem.md b/content/concepts/ecosystem.md
index ac205410..9c652d42 100644
--- a/content/concepts/ecosystem.md
+++ b/content/concepts/ecosystem.md
@@ -7,25 +7,25 @@ description: The Ocean Protocol network consists of various components. Learn ab
See also [Set Up a Keeper](/setup/keeper/)
-- [💧 keeper-contracts](https://github.com/oceanprotocol/keeper-contracts)
+
## Aquarius
Aquarius provides an off-chain database store for metadata about data assets. Every marketplace must run an instance of Aquarius.
-- [🐋 aquarius](https://github.com/oceanprotocol/aquarius)
+
## Brizo
Brizo is the technical component executed by Publishers allowing them to provide extended data services. Brizo, as part of the Publisher ecosystem, includes the credentials to interact with the infrastructure (initially cloud, but could be on-premise).
-- [brizo](https://github.com/oceanprotocol/brizo)
+
## Pleuston
An example marketplace front-end for consumers to explore, download, and publish data assets within the Ocean Protocol network. Implemented using React and squid-js.
-- [🦄 pleuston](https://github.com/oceanprotocol/pleuston)
+
## Squid
@@ -39,7 +39,7 @@ Client libraries used by applications to interact with Ocean nodes, including Ke
All of our core components generate Docker images automatically and we provide some handy Docker Compose scripts to help with testing, showcasing, and developing Ocean Protocol.
-- [🐳 docker-images](https://github.com/oceanprotocol/docker-images)
+
### Full Ocean network stack
diff --git a/content/test.md b/content/test.md
index d04240e9..67cabdf5 100644
--- a/content/test.md
+++ b/content/test.md
@@ -19,6 +19,7 @@ For more complete info, see [John Gruber's original spec](http://daringfireball.
* [Horizontal Rule](#horizontal-rule)
* [Line Breaks](#line-breaks)
* [Videos](#videos)
+* [React Components in Markdown](#react-components-in-markdown)
## Headers
@@ -375,3 +376,22 @@ Or, in pure Markdown, but losing the image sizing and border:
```md
[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg)](http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE)
```
+
+## React Components in Markdown
+
+In all Markdown docs you can use some select React Components. This magic is done with [gatsby-remark-component](https://www.gatsbyjs.org/packages/gatsby-remark-component/).
+
+Note that the component name in Markdown needs to be always in lowercase, and have a closing tag.
+
+### Repository
+
+The `Repository` component fetching and displaying information about a GitHub repo. can be used as `` Component requires a `name` to be passed:
+
+```
+
+```
+
+Resulting in:
+
+
+
diff --git a/content/tutorials/jupyter.md b/content/tutorials/jupyter.md
index 7e7e14d6..bac37b6c 100644
--- a/content/tutorials/jupyter.md
+++ b/content/tutorials/jupyter.md
@@ -4,4 +4,4 @@ title: Use Jupyter Notebooks to interact with the Ocean network
For now, check out [the Mantaray repository](https://github.com/oceanprotocol/mantaray). In the future, we hope to have live online Jupyter notebooks.
-- [mantaray](https://github.com/oceanprotocol/mantaray)
+
diff --git a/data/repositories.yml b/data/repositories.yml
index f7a82b27..1948a560 100644
--- a/data/repositories.yml
+++ b/data/repositories.yml
@@ -1,36 +1,22 @@
- group: Core Components
items:
- name: keeper-contracts
- description: '💧 Integration of TCRs, CPM and Ocean Tokens in Solidity'
links:
- name: Documentation
url: https://github.com/oceanprotocol/keeper-contracts/tree/develop/doc
- name: aquarius
- description: '🐋 Off-chain database store for data assets metadata.'
links:
- name: API reference
url: https://github.com/oceanprotocol/aquarius/blob/develop/docs/for_api_users/API.md
- name: brizo
- description: 'Helping publishers to expose their services'
-
- name: pleuston
- description: '🦄 Web app for consumers to explore, download, and publish data assets.'
- group: Libraries
items:
- name: squid-js
- description: '🦑 JavaScript client library for Ocean Protocol'
-
- name: squid-py
- description: '🦑 Python client library for Ocean Protocol'
-
- name: squid-java
- description: '🦑 Java client library for Ocean Protocol'
-
- name: secret-store-client-js
- description: '🔑 JavaScript implementation of the parity secret store for use in ocean.'
-
- name: secret-store-client-py
- description: '🔑 Parity Secret Store Python Client'
diff --git a/gatsby-config.js b/gatsby-config.js
index 770c8454..42a4a4a8 100755
--- a/gatsby-config.js
+++ b/gatsby-config.js
@@ -1,3 +1,12 @@
+require('dotenv').config()
+
+if (!process.env.GITHUB_TOKEN) {
+ throw new Error(
+ `A GitHub token is required to build the site. Check the README
+ \nhttps://github.com/oceanprotocol/docs.`
+ )
+}
+
const config = require('./config.js')
module.exports = {
@@ -36,6 +45,20 @@ module.exports = {
path: `${__dirname}/node_modules/@oceanprotocol/art`
}
},
+ {
+ resolve: 'gatsby-source-graphql',
+ options: {
+ typeName: 'GitHub',
+ fieldName: 'github',
+ url: 'https://api.github.com/graphql',
+ headers: {
+ Authorization: `bearer ${process.env.GITHUB_TOKEN}`
+ },
+ // Additional options to pass to node-fetch
+ fetchOptions: {},
+ refetchInterval: 300 // 5 min.
+ }
+ },
{
resolve: 'gatsby-transformer-remark',
options: {
@@ -55,7 +78,8 @@ module.exports = {
'gatsby-remark-responsive-iframe',
'gatsby-remark-prismjs',
'gatsby-remark-autolink-headers',
- 'gatsby-remark-copy-linked-files'
+ 'gatsby-remark-copy-linked-files',
+ 'gatsby-remark-component'
]
}
},
diff --git a/package.json b/package.json
index 59a5d5c5..f0674565 100755
--- a/package.json
+++ b/package.json
@@ -18,6 +18,7 @@
"gatsby-plugin-sitemap": "^2.0.2",
"gatsby-plugin-svgr": "^2.0.0-alpha",
"gatsby-remark-autolink-headers": "^2.0.11",
+ "gatsby-remark-component": "^1.1.3",
"gatsby-remark-copy-linked-files": "^2.0.6",
"gatsby-remark-embed-video": "^1.4.0",
"gatsby-remark-images": "^2.0.6",
@@ -25,6 +26,7 @@
"gatsby-remark-responsive-iframe": "^2.0.6",
"gatsby-remark-smartypants": "^2.0.6",
"gatsby-source-filesystem": "^2.0.8",
+ "gatsby-source-graphql": "^2.0.6",
"gatsby-transformer-remark": "^2.1.12",
"gatsby-transformer-sharp": "^2.1.8",
"gatsby-transformer-yaml": "^2.1.5",
@@ -33,7 +35,8 @@
"prismjs": "^1.15.0",
"react": "^16.6.1",
"react-dom": "^16.6.1",
- "react-helmet": "^5.2.0"
+ "react-helmet": "^5.2.0",
+ "rehype-react": "^3.0.3"
},
"license": "Apache-2.0",
"scripts": {
@@ -49,6 +52,7 @@
"test": "npm run lint"
},
"devDependencies": {
+ "dotenv": "^6.1.0",
"eslint": "^5.9.0",
"eslint-config-oceanprotocol": "^1.3.0",
"eslint-config-prettier": "^3.1.0",
diff --git a/src/components/DocContent.jsx b/src/components/DocContent.jsx
index ce4237c5..e639bc02 100644
--- a/src/components/DocContent.jsx
+++ b/src/components/DocContent.jsx
@@ -1,15 +1,17 @@
import React from 'react'
import PropTypes from 'prop-types'
+import RehypeReact from 'rehype-react'
+import Repository from './Repositories/Repository'
import styles from './DocContent.module.scss'
-const DocContent = ({ html }) =>
+const renderAst = new RehypeReact({
+ createElement: React.createElement,
+ components: { repo: Repository }
+}).Compiler
+
+const DocContent = ({ html, htmlAst }) =>
html ? (
-
+