Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for packages entry point strategy #24

Merged
merged 4 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- name: Store Playwright Version
run: |
PLAYWRIGHT_VERSION=$(pnpm playwright --version | sed 's/Version //')
PLAYWRIGHT_VERSION=$(pnpm exec playwright --version | sed 's/Version //')
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
working-directory: packages/starlight-typedoc

Expand Down
4 changes: 2 additions & 2 deletions example/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export default defineConfig({
},
plugins: [
starlightTypeDoc({
entryPoints: ['../fixtures/src/index.ts'],
tsconfig: '../fixtures/tsconfig.json',
entryPoints: ['../fixtures/basics/src/index.ts'],
tsconfig: '../fixtures/basics/tsconfig.json',
sidebar: {
label: 'API (auto-generated)',
},
Expand Down
4 changes: 2 additions & 2 deletions example/astro.multiple-entrypoints.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ export default defineConfig({
starlight({
plugins: [
starlightTypeDoc({
entryPoints: ['../fixtures/src/Bar.ts', '../fixtures/src/Foo.ts'],
entryPoints: ['../fixtures/basics/src/Bar.ts', '../fixtures/basics/src/Foo.ts'],
output: 'api-multiple-entrypoints',
pagination: true,
sidebar: {
collapsed: true,
},
tsconfig: '../fixtures/tsconfig.json',
tsconfig: '../fixtures/basics/tsconfig.json',
// @ts-expect-error - Fake the `readme` option not being set to ensure that frontmatter titles are escaped properly.
// @see https://github.com/HiDeoo/starlight-typedoc/pull/7
typeDoc: {
Expand Down
29 changes: 29 additions & 0 deletions example/astro.packages-entrypoints.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import starlight from '@astrojs/starlight'
import { defineConfig } from 'astro/config'
import starlightTypeDoc, { typeDocSidebarGroup } from 'starlight-typedoc'

export default defineConfig({
base: '/packages-entrypoints/',
integrations: [
starlight({
plugins: [
starlightTypeDoc({
entryPoints: ['../fixtures/packages/packages/*'],
output: 'api-packages-entrypoints',
tsconfig: '../fixtures/packages/tsconfig.json',
typeDoc: {
entryPointStrategy: 'packages',
},
}),
],
sidebar: [
{
label: 'Guides',
items: [{ label: 'Example Guide', link: '/guides/example/' }],
},
typeDocSidebarGroup,
],
title: 'Starlight TypeDoc Packages Entry Points Example',
}),
],
})
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"dev": "astro dev",
"dev:single-entrypoints": "astro dev --config astro.config.ts",
"dev:multiple-entrypoints": "astro dev --config astro.multiple-entrypoints.config.ts",
"dev:packages-entrypoints": "pnpm -C ../fixtures/packages run build && astro dev --config astro.packages-entrypoints.config.ts",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
Expand Down
1 change: 1 addition & 0 deletions example/src/content/docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Autogenerated by https://github.com/HiDeoo/starlight-typedoc
api/
api-multiple-entrypoints/
api-packages-entrypoints/
File renamed without changes.
2 changes: 1 addition & 1 deletion fixtures/package.json → fixtures/basics/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@starlight-typedoc/fixtures",
"name": "@starlight-typedoc/fixtures-basics",
"version": "0.0.1",
"license": "MIT",
"description": "Starlight plugin to generate documentation from TypeScript using TypeDoc.",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions fixtures/src/shared.ts → fixtures/basics/src/shared.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export { doThingA as doThingARef } from './functions'

/**
* This is a string variable.
*/
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions fixtures/basics/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.json"
}
34 changes: 34 additions & 0 deletions fixtures/packages/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "@starlight-typedoc/fixtures-packages",
"version": "0.0.1",
"license": "MIT",
"description": "Starlight plugin to generate documentation from TypeScript using TypeDoc.",
"author": "HiDeoo <[email protected]> (https://hideoo.dev)",
"type": "module",
"scripts": {
"build": "tsc --build"
},
"dependencies": {
"typescript": "5.1.6"
},
"engines": {
"node": ">=18.14.1"
},
"packageManager": "[email protected]",
"private": true,
"sideEffects": false,
"keywords": [
"starlight",
"plugin",
"typedoc",
"typescript",
"documentation",
"astro"
],
"homepage": "https://github.com/HiDeoo/starlight-typedoc",
"repository": {
"type": "git",
"url": "https://github.com/HiDeoo/starlight-typedoc.git"
},
"bugs": "https://github.com/HiDeoo/starlight-typedoc/issues"
}
25 changes: 25 additions & 0 deletions fixtures/packages/packages/bar/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "bar",
"version": "0.0.1",
"license": "MIT",
"description": "Starlight plugin to generate documentation from TypeScript using TypeDoc.",
"author": "HiDeoo <[email protected]> (https://hideoo.dev)",
"type": "module",
"packageManager": "[email protected]",
"private": true,
"sideEffects": false,
"keywords": [
"starlight",
"plugin",
"typedoc",
"typescript",
"documentation",
"astro"
],
"homepage": "https://github.com/HiDeoo/starlight-typedoc",
"repository": {
"type": "git",
"url": "https://github.com/HiDeoo/starlight-typedoc.git"
},
"bugs": "https://github.com/HiDeoo/starlight-typedoc/issues"
}
6 changes: 6 additions & 0 deletions fixtures/packages/packages/bar/src/functions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* A function that does a bar thing.
*/
export function doBar() {
return 'doBar'
}
1 change: 1 addition & 0 deletions fixtures/packages/packages/bar/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './functions.js'
8 changes: 8 additions & 0 deletions fixtures/packages/packages/bar/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
},
"include": ["src"]
}
3 changes: 3 additions & 0 deletions fixtures/packages/packages/bar/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"entryPoints": ["src/index.ts"]
}
25 changes: 25 additions & 0 deletions fixtures/packages/packages/foo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "foo",
"version": "0.0.1",
"license": "MIT",
"description": "Starlight plugin to generate documentation from TypeScript using TypeDoc.",
"author": "HiDeoo <[email protected]> (https://hideoo.dev)",
"type": "module",
"packageManager": "[email protected]",
"private": true,
"sideEffects": false,
"keywords": [
"starlight",
"plugin",
"typedoc",
"typescript",
"documentation",
"astro"
],
"homepage": "https://github.com/HiDeoo/starlight-typedoc",
"repository": {
"type": "git",
"url": "https://github.com/HiDeoo/starlight-typedoc.git"
},
"bugs": "https://github.com/HiDeoo/starlight-typedoc/issues"
}
16 changes: 16 additions & 0 deletions fixtures/packages/packages/foo/src/functions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* A function that does a foo thing.
* @deprecated Use the new {@link doFooFaster} function instead.
*/
export function doFoo() {
return 'doFoo'
}

/**
* A function that does another foo thing but faster.
*
* This is a faster alternative to {@link doFoo}.
*/
export function doFooFaster() {
return 'doFoo'
}
1 change: 1 addition & 0 deletions fixtures/packages/packages/foo/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './functions.js'
8 changes: 8 additions & 0 deletions fixtures/packages/packages/foo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
},
"include": ["src"]
}
3 changes: 3 additions & 0 deletions fixtures/packages/packages/foo/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"entryPoints": ["src/index.ts"]
}
9 changes: 9 additions & 0 deletions fixtures/packages/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"composite": true,
"declaration": true,
"declarationMap": true,
"module": "NodeNext",
"strict": true
}
}
11 changes: 11 additions & 0 deletions fixtures/packages/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"files": [],
"references": [
{
"path": "./packages/bar"
},
{
"path": "./packages/foo"
}
]
}
3 changes: 0 additions & 3 deletions fixtures/tsconfig.json

This file was deleted.

Loading