ci: update scripts for documentation changes (#9055)

* ci: update scripts for documentation changes

* refactor: use tsconfig files

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Suneet Tipirneni
2023-01-17 14:15:01 -05:00
committed by GitHub
parent 2e48faf91a
commit 56ef3ad8a0
29 changed files with 123 additions and 19 deletions

View File

@@ -4,6 +4,7 @@ import { chdir } from 'node:process';
import { copy } from 'fs-extra';
import { parse as parseYAML, stringify as stringifyYAML } from 'yaml';
import cliffJumperJSON from './template/.cliff-jumperrc.json';
import apiExtractorJSON from './template/api-extractor.json';
import templateJSON from './template/template.package.json';
interface LabelerData {
@@ -52,6 +53,15 @@ export async function createPackage(packageName: string, packageDescription?: st
await writeFile('.cliff-jumperrc.json', JSON.stringify(newCliffJumperJSON, null, 2));
// Update api-extractor.json
const newApiExtractorJSON = { ...apiExtractorJSON };
newApiExtractorJSON.docModel.projectFolderUrl = newApiExtractorJSON.docModel.projectFolderUrl.replace(
'{name}',
packageName,
);
await writeFile('api-extractor.json', JSON.stringify(newApiExtractorJSON, null, 2));
// Move to github directory
chdir(join('..', '..', '.github'));

View File

@@ -0,0 +1,6 @@
{
"extends": "../../api-extractor.json",
"docModel": {
"projectFolderUrl": "https://github.com/discordjs/discord.js/tree/main/packages/{name}"
}
}

View File

@@ -1,3 +0,0 @@
{
"extends": "../../api-extractor.json"
}

View File

@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.docs.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "dist-docs"
}
}

View File

@@ -5,9 +5,10 @@
"scripts": {
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --fix --format=pretty",
"docs": "api-extractor run --local",
"docs": "yarn build:docs && api-extractor run --local",
"prepack": "yarn build && yarn lint",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/{name}/*'",
"release": "cliff-jumper"