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

more generic typedoc files inclusion

This commit is contained in:
Matthias Kretschmann 2019-01-22 10:44:58 +01:00
parent 6bf055fea7
commit 1f427aa3fe
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -200,26 +200,38 @@ exports.createPages = ({ graphql, actions }) => {
//
// Create pages from TypeDoc json files
//
const typeDocSpecs = ['./data/squid-js.json']
const typedocTemplate = path.resolve(
'./src/templates/Typedoc.jsx'
)
const squidJsSpecs = require('./data/squid-js.json')
const squidJsSlug = '/references/squid-js/'
typeDocSpecs.forEach(spec => {
const typedoc = require(spec) // eslint-disable-line
createPage({
path: squidJsSlug,
component: typedocTemplate,
context: {
slug: squidJsSlug,
typedoc: squidJsSpecs,
classes: [
'ocean/Ocean',
'ocean/Account',
'ddo/DDO',
'ddo/Service'
]
}
const name = path
.basename(spec)
.split('.json')
.join('')
const slug = `/references/${name}/`
createPage({
path: slug,
component: typedocTemplate,
context: {
slug,
typedoc,
// TODO: defining these classes for inclusion
// needs to be handled somewhere else to keep
// it generic for all TypeDoc specs
classes: [
'ocean/Ocean',
'ocean/Account',
'ddo/DDO',
'ddo/Service'
]
}
})
})
//