Skip to content

Commit

Permalink
ci: update scripts for documentation changes (#9055)
Browse files Browse the repository at this point in the history
* ci: update scripts for documentation changes

* refactor: use tsconfig files

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
suneettipirneni and kodiakhq[bot] authored Jan 17, 2023
1 parent 2e48faf commit 56ef3ad
Show file tree
Hide file tree
Showing 29 changed files with 123 additions and 19 deletions.
2 changes: 1 addition & 1 deletion packages/brokers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc --emitDeclarationOnly --declarationMap --skipLibCheck --outDir \"dist-docs\"",
"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",
"fmt": "yarn format",
Expand Down
7 changes: 7 additions & 0 deletions packages/brokers/tsconfig.docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.docs.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "dist-docs"
}
}
2 changes: 1 addition & 1 deletion packages/builders/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc --emitDeclarationOnly --declarationMap --skipLibCheck --outDir \"dist-docs\" && yarn downlevel-dts ./dist-docs ./dist-docs",
"build:docs": "tsc -p tsconfig.docs.json && yarn downlevel-dts ./dist-docs ./dist-docs",
"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",
"fmt": "yarn format",
Expand Down
8 changes: 8 additions & 0 deletions packages/builders/tsconfig.docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.docs.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "dist-docs",
"exactOptionalPropertyTypes": false
}
}
5 changes: 2 additions & 3 deletions packages/collection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
"scripts": {
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc --emitDeclarationOnly --declarationMap --skipLibCheck --outDir \"dist-docs\"",
"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",
"fmt": "yarn format",
"docs": "yarn build:docs && api-extractor run --local",
"prepack": "yarn lint && yarn test && yarn build",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/collection/*'",
"release": "cliff-jumper",
"docs:declarations": "tsc --emitDeclarationOnly --declarationMap --skipLibCheck --outDir \"dist\""
"release": "cliff-jumper"
},
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
7 changes: 7 additions & 0 deletions packages/collection/tsconfig.docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.docs.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "dist-docs"
}
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc --emitDeclarationOnly --declarationMap --skipLibCheck --outDir \"dist-docs\"",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts --fix --format=pretty",
"docs": "yarn build:docs && api-extractor run --local",
Expand Down
7 changes: 7 additions & 0 deletions packages/core/tsconfig.docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.docs.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "dist-docs"
}
}
2 changes: 1 addition & 1 deletion packages/formatters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc --emitDeclarationOnly --declarationMap --skipLibCheck --outDir \"dist-docs\"",
"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": "yarn build:docs && api-extractor run --local",
Expand Down
7 changes: 7 additions & 0 deletions packages/formatters/tsconfig.docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.docs.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "dist-docs"
}
}
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc --emitDeclarationOnly --declarationMap --skipLibCheck --outDir \"dist-docs\"",
"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": "yarn build:docs && api-extractor run --local",
Expand Down
7 changes: 7 additions & 0 deletions packages/next/tsconfig.docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.docs.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "dist-docs"
}
}
2 changes: 1 addition & 1 deletion packages/proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc --emitDeclarationOnly --declarationMap --skipLibCheck --outDir \"dist-docs\"",
"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",
"fmt": "yarn format",
Expand Down
7 changes: 7 additions & 0 deletions packages/proxy/tsconfig.docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.docs.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "dist-docs"
}
}
2 changes: 1 addition & 1 deletion packages/rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc --emitDeclarationOnly --declarationMap --skipLibCheck --outDir \"dist-docs\"",
"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",
"fmt": "yarn format",
Expand Down
7 changes: 7 additions & 0 deletions packages/rest/tsconfig.docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.docs.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "dist-docs"
}
}
10 changes: 10 additions & 0 deletions packages/scripts/src/createPackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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'));

Expand Down
6 changes: 6 additions & 0 deletions packages/scripts/src/template/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../../api-extractor.json",
"docModel": {
"projectFolderUrl": "https://github.com/discordjs/discord.js/tree/main/packages/{name}"
}
}
3 changes: 0 additions & 3 deletions packages/scripts/src/template/default/api-extractor.json

This file was deleted.

7 changes: 7 additions & 0 deletions packages/scripts/src/template/default/tsconfig.docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.docs.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "dist-docs"
}
}
3 changes: 2 additions & 1 deletion packages/scripts/src/template/template.package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Utilities shared across Discord.js packages",
"scripts": {
"build": "tsup",
"build:docs": "tsc --emitDeclarationOnly --declarationMap --skipLibCheck --outDir \"dist-docs\"",
"build:docs": "tsc -p tsconfig.docs.json",
"test": "vitest run && tsd",
"lint": "prettier --check . && TIMING=1 eslint src --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && TIMING=1 eslint src --ext .mjs,.js,.ts --fix --format=pretty",
Expand Down
7 changes: 7 additions & 0 deletions packages/util/tsconfig.docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.docs.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "dist-docs"
}
}
2 changes: 1 addition & 1 deletion packages/voice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Implementation of the Discord Voice API for node.js",
"scripts": {
"build": "tsup && node scripts/postbuild.mjs",
"build:docs": "tsc --emitDeclarationOnly --declarationMap --skipLibCheck --outDir \"dist-docs\"",
"build:docs": "tsc -p tsconfig.docs.json",
"test": "jest --coverage",
"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",
Expand Down
7 changes: 7 additions & 0 deletions packages/voice/tsconfig.docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.docs.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "dist-docs"
}
}
2 changes: 1 addition & 1 deletion packages/ws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc --emitDeclarationOnly --declarationMap --skipLibCheck --outDir \"dist-docs\"",
"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": "yarn build:docs && api-extractor run --local",
Expand Down
7 changes: 7 additions & 0 deletions packages/ws/tsconfig.docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.docs.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "dist-docs"
}
}
7 changes: 7 additions & 0 deletions tsconfig.docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"emitDeclarationOnly": true,
"skipLibCheck": true
}
}
3 changes: 1 addition & 2 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@
"outputs": []
},
"docs": {
"dependsOn": ["^build"],
"outputs": ["../../api-extractor.json", "api-extractor.json", "docs/**", "tsconfig.json"]
"outputs": ["../../api-extractor.json", "api-extractor.json", "docs/**", "tsconfig.json", "dist-docs"]
},
"changelog": {
"outputs": ["cliff.toml", "CHANGELOG.md"]
Expand Down

2 comments on commit 56ef3ad

@vercel
Copy link

@vercel vercel bot commented on 56ef3ad Jan 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 56ef3ad Jan 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.