diff --git a/package.json b/package.json index 960a702..9e2dbdb 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "test": "jest", "postinstall": "husky install", "release": "zx scripts/release.mjs", - "build:api-docs": "zx scripts/build-api-docs.mjs /Users/andrew/Projects/theatre-docs/docs/api", + "build:api-docs": "zx scripts/build-api-docs.mjs", "lint:all": "eslint . --ext ts,tsx --ignore-path=.gitignore --rulesdir ./devEnv/eslint/rules" }, "lint-staged": { diff --git a/scripts/build-api-docs.mjs b/scripts/build-api-docs.mjs index 71dca6c..7324af2 100644 --- a/scripts/build-api-docs.mjs +++ b/scripts/build-api-docs.mjs @@ -56,7 +56,7 @@ import {parse as parseJsonC} from 'jsonc-parser' ) /* - We replace the Pointer name with a similar-looking one so that that shitty + We replace the Pointer name with a similar-looking one so that api-documenter generates two different pages for Pointer and pointer, instead of overwriting one with the other. @@ -68,9 +68,15 @@ import {parse as parseJsonC} from 'jsonc-parser' */ const replacement = 'Pointer\u200E' - fs.writeFileSync('./.temp/api/dataverse.api.json', fs.readFileSync('./.temp/api/dataverse.api.json', { - encoding: 'utf-8', - }).replaceAll('"name": "Pointer"', `"name": "${replacement}"`).replaceAll('{@link Pointer}', `{@link ${replacement}}`)) + fs.writeFileSync( + './.temp/api/dataverse.api.json', + fs + .readFileSync('./.temp/api/dataverse.api.json', { + encoding: 'utf-8', + }) + .replaceAll('"name": "Pointer"', `"name": "${replacement}"`) + .replaceAll('{@link Pointer}', `{@link ${replacement}}`), + ) await $`api-documenter markdown --input-folder ${pathToApiJsonFiles} --output-folder ${outputPath}` })()