diff --git a/.gitmodules b/.gitmodules index 2298851a..cf63a225 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,6 +5,3 @@ [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 deleted file mode 160000 index 486f370d..00000000 --- a/external/squid-java +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 486f370d55ce498e23363f466128cb89f650fe75 diff --git a/gatsby-node.js b/gatsby-node.js index 01abbb82..55922d48 100755 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -5,7 +5,6 @@ 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 @@ -59,23 +58,6 @@ 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 @@ -117,6 +99,21 @@ exports.createPages = ({ graphql, actions }) => { } } } + + squidJava: github { + repository( + owner: "oceanprotocol" + name: "squid-java" + ) { + name + pom: object(expression: "develop:pom.xml") { + id + ... on GitHub_Blob { + text + } + } + } + } } ` ).then(async result => { @@ -275,15 +272,14 @@ exports.createPages = ({ graphql, actions }) => { const javadocTemplate = path.resolve( './src/templates/Javadoc/index.jsx' ) + const { name, pom } = result.data.squidJava.repository + + const metaSquidJava = parser.xml2js(pom.text, { + compact: true + }) javadocSpecs.forEach(spec => { const javadoc = require(spec) // eslint-disable-line - - const name = path - .basename(spec) - .split('.json') - .join('') - const slug = `/references/${name}/` createPage({ @@ -293,13 +289,13 @@ exports.createPages = ({ graphql, actions }) => { slug, javadoc, title: name, - description: `${metaSquidJava.name._text}. ${ - metaSquidJava.description._text - }.`, - version: metaSquidJava.version._text, - namespace: `${metaSquidJava.groupId._text}.${ - metaSquidJava.artifactId._text - }` + description: `${ + metaSquidJava.project.name._text + }. ${metaSquidJava.project.description._text}.`, + version: metaSquidJava.project.version._text, + namespace: `${ + metaSquidJava.project.groupId._text + }.${metaSquidJava.project.artifactId._text}` } }) }) diff --git a/package.json b/package.json index 91172d16..0bd9b5ff 100644 --- a/package.json +++ b/package.json @@ -85,8 +85,7 @@ "stylelint-config-css-modules": "^1.3.0", "stylelint-config-standard": "^18.2.0", "typedoc": "^0.14.2", - "xml-js": "^1.6.11", - "xml2json": "^0.11.2" + "xml-js": "^1.6.11" }, "repository": { "type": "git",