mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
typedoc fixes
This commit is contained in:
parent
6d6fce2b95
commit
25ac01e97d
@ -17,7 +17,7 @@ const files = ['./src/lib.ts']
|
|||||||
// specifically point to tsconfig, otherwise TypeDoc fails
|
// specifically point to tsconfig, otherwise TypeDoc fails
|
||||||
const config = typescript.findConfigFile('./tsconfig.js', typescript.sys.fileExists)
|
const config = typescript.findConfigFile('./tsconfig.js', typescript.sys.fileExists)
|
||||||
|
|
||||||
const generateJson = () => {
|
const generateJson = async () => {
|
||||||
const spinnerTypedoc = ora('Generating TypeDoc json...').start()
|
const spinnerTypedoc = ora('Generating TypeDoc json...').start()
|
||||||
|
|
||||||
// Setup our TypeDoc app
|
// Setup our TypeDoc app
|
||||||
@ -26,31 +26,32 @@ const generateJson = () => {
|
|||||||
app.options.addReader(new TypeDoc.TypeDocReader())
|
app.options.addReader(new TypeDoc.TypeDocReader())
|
||||||
|
|
||||||
app.bootstrap({
|
app.bootstrap({
|
||||||
tsconfig: config
|
tsconfig: config,
|
||||||
|
entryPoints: files
|
||||||
})
|
})
|
||||||
|
|
||||||
const src = app.expandInputFiles(files)
|
const src = app.expandInputFiles(files)
|
||||||
const project = app.convert(src)
|
const project = app.convert(src)
|
||||||
|
|
||||||
// Generate the JSON file
|
// Generate the JSON file
|
||||||
app.generateJson(project, outPath)
|
await app.generateJson(project, outPath)
|
||||||
|
|
||||||
// Parse and modify json output
|
// Parse and modify json output
|
||||||
const jsonOrig = JSON.parse(fs.readFileSync(outPath, 'utf8'))
|
const jsonOrig = await JSON.parse(fs.readFileSync(outPath, 'utf8'))
|
||||||
|
|
||||||
const jsonFinal = {
|
const jsonFinal = {
|
||||||
info: {
|
info: {
|
||||||
title: 'Ocean.js',
|
title: 'Ocean.js',
|
||||||
description,
|
description,
|
||||||
version,
|
version,
|
||||||
sourceUrl: 'https://github.com/oceanprotocol/ocean-lib-js/blob/master/'
|
sourceUrl: 'https://github.com/oceanprotocol/ocean.js/blob/main/'
|
||||||
},
|
},
|
||||||
...jsonOrig
|
...jsonOrig
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.writeFileSync(outPath, JSON.stringify(jsonFinal, null, 4))
|
fs.writeFileSync(outPath, JSON.stringify(jsonFinal, null, 2))
|
||||||
|
|
||||||
spinnerTypedoc.succeed('Generated TypeDoc json.')
|
spinnerTypedoc.succeed('Generated TypeDoc json.')
|
||||||
}
|
}
|
||||||
|
|
||||||
generateJson()
|
generateJson().catch(console.error)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user