diff --git a/.gitmodules b/.gitmodules index cf63a225..2298851a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,3 +5,6 @@ [submodule "external/squid-js"] path = external/squid-js url = https://github.com/oceanprotocol/squid-js.git +[submodule "external/squid-java"] + path = external/squid-java + url = https://github.com/oceanprotocol/squid-java.git diff --git a/external/squid-java b/external/squid-java new file mode 160000 index 00000000..486f370d --- /dev/null +++ b/external/squid-java @@ -0,0 +1 @@ +Subproject commit 486f370d55ce498e23363f466128cb89f650fe75 diff --git a/gatsby-node.js b/gatsby-node.js index ce82eb36..8e129f8d 100755 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -4,6 +4,8 @@ const path = require('path') const { createFilePath } = require('gatsby-source-filesystem') const Swagger = require('swagger-client') const { redirects } = require('./config') +const parser = require('xml-js') +const fs = require('fs') exports.onCreateNode = ({ node, getNode, actions }) => { const { createNodeField } = actions @@ -57,6 +59,23 @@ const getSpec = async () => { return spec } +let metaSquidJava + +const getSquidJavaMeta = () => { + fs.readFile('./external/squid-java/pom.xml', (err, data) => { + if (err) return err + + const json = parser.xml2js(data, { + compact: true + }) + + metaSquidJava = json.project + // return json.project + }) +} + +getSquidJavaMeta() + exports.createPages = ({ graphql, actions }) => { const { createPage, createRedirect } = actions @@ -272,7 +291,12 @@ exports.createPages = ({ graphql, actions }) => { component: javadocTemplate, context: { slug, - javadoc + javadoc, + title: name, + description: `${metaSquidJava.name._text}. ${ + metaSquidJava.description._text + }.`, + version: metaSquidJava.version._text } }) }) diff --git a/package.json b/package.json index 03cafc9f..acb545b4 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "gatsby-source-graphql": "^2.0.15", "gatsby-transformer-remark": "^2.3.8", "gatsby-transformer-sharp": "^2.1.17", + "gatsby-transformer-xml": "^2.0.9", "gatsby-transformer-yaml": "^2.1.10", "giphy-js-sdk-core": "^1.0.6", "intersection-observer": "^0.5.1", @@ -83,7 +84,9 @@ "stylelint-config-bigchaindb": "^1.2.1", "stylelint-config-css-modules": "^1.3.0", "stylelint-config-standard": "^18.2.0", - "typedoc": "^0.14.2" + "typedoc": "^0.14.2", + "xml-js": "^1.6.11", + "xml2json": "^0.11.2" }, "repository": { "type": "git", diff --git a/src/templates/Javadoc/index.jsx b/src/templates/Javadoc/index.jsx index e4f03f57..1b0a9039 100644 --- a/src/templates/Javadoc/index.jsx +++ b/src/templates/Javadoc/index.jsx @@ -14,10 +14,6 @@ import stylesDoc from '../Doc.module.scss' import Toc from './Toc' import { cleanPaths } from './utils' -const title = 'squid-java' -const description = 'Java client library for Ocean Protocol' -const version = '0.2.0' - const Paths = ({ javadoc }) => { return Object.keys(javadoc).map(path => ( <div @@ -50,7 +46,7 @@ export default class JavadocTemplate extends Component { render() { const { location, pageContext } = this.props - const { javadoc } = pageContext + const { javadoc, title, description, version } = pageContext return ( <>