1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

get squid-java metadata through GraphQL, remove submodule

This commit is contained in:
Matthias Kretschmann 2019-03-28 18:16:22 +01:00
parent 42acd8f12f
commit 5ebbda6ba9
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 28 additions and 37 deletions

3
.gitmodules vendored
View File

@ -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

1
external/squid-java vendored

@ -1 +0,0 @@
Subproject commit 486f370d55ce498e23363f466128cb89f650fe75

View File

@ -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}`
}
})
})

View File

@ -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",