Formatting changes for api docs

This commit is contained in:
Aria Minaei 2021-10-04 10:39:12 +02:00
parent 69c6aa9af2
commit 14173fde0a
14 changed files with 111 additions and 41 deletions

View file

@ -1,6 +1,7 @@
import path from 'path'
import {readFileSync, writeFileSync} from 'fs'
import {keyBy} from 'lodash-es'
import {parse as parseJsonC} from 'jsonc-parser'
;(async function () {
// better quote function from https://github.com/google/zx/pull/167
$.quote = function quote(arg) {
@ -22,10 +23,31 @@ import {keyBy} from 'lodash-es'
)
}
const outputPathArg = argv._[argv._.length - 1]
if (outputPathArg.trim().length === 0) {
console.error(
`You must provide a path to create the markdown files in. Eg. $ yarn build:api-docs /path/to/docs-site/docs/api`,
)
process.exit(1)
}
const outputPath = path.resolve(outputPathArg)
const pathToApiJsonFiles = path.dirname(
path.resolve(
'./devEnv',
parseJsonC(
fs.readFileSync('./devEnv/api-extractor-base.json', {
encoding: 'utf-8',
}),
).docModel.apiJsonFilePath,
),
)
await $`yarn build:ts`
await Promise.all(
['@theatre/dataverse', '@theatre/react', 'theatre'].map(
(pkg) => $`yarn workspace ${pkg} run build:api-json`,
),
)
await $`api-documenter markdown --input-folder ${pathToApiJsonFiles} --output-folder ${outputPath}`
})()

View file

@ -175,7 +175,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/temp/<unscopedPackageName>.api.json"
*/
"apiJsonFilePath": "<projectFolder>/dist/<unscopedPackageName>.api.json"
"apiJsonFilePath": "../.temp/api/<unscopedPackageName>.api.json"
},
/**
@ -341,7 +341,7 @@
"logLevel": "none"
},
"ae-forgotten-export": {
"logLevel": "none"
"logLevel": "warning"
}
// "ae-extra-release-tag": {