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

Typedoc integrated into vitepress #793

Merged
merged 3 commits into from
Feb 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
64 changes: 64 additions & 0 deletions docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { defineConfig } from "vitepress";

import typedocSidebar from "../api/typedoc-sidebar.json";

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "ember-link",
description: "Links as Primitives",
base: "/ember-link/",
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: "Home", link: "/" },
{ text: "Guides", link: "/getting-started" },
{ text: "API", link: "/api/modules", activeMatch: "/api" },
],

outline: [2, 3],

sidebar: {
"/": [
{
text: "Guides",
items: [
{ text: "Getting Started", link: "/getting-started" },
{ text: "Installation", link: "/installation" },
{ text: "Configuration", link: "/configuration" },
{ text: "Migration", link: "/migration" },
],
},
{
text: "Usage",
items: [
{ text: "Using Primitives", link: "/using-primitives" },
{ text: "Params", link: "/params" },
{ text: "Behavior", link: "/behavior" },
{ text: "Link Helper", link: "/helper" },
{ text: "LinkManager Service", link: "/service" },
{ text: "Testing", link: "/testing" },
],
},
{
text: "Advanced",
items: [
{ text: "Customization", link: "/customization" },
{ text: "Using Locales", link: "/using-locales" },
{ text: "Link Builder", link: "/link-builder" },
{ text: "Commands", link: "/commands" },
],
},
],
"/api/": [
{
text: "API",
items: typedocSidebar,
},
],
},

socialLinks: [
{ icon: "github", link: "https://github.com/buschtoens/ember-link" },
],
},
});
60 changes: 0 additions & 60 deletions docs/.vitepress/config.ts

This file was deleted.

89 changes: 0 additions & 89 deletions docs/.vitepress/sidebar-api.ts

This file was deleted.

4 changes: 2 additions & 2 deletions docs/behavior.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Behavior

[`Behavior`](./api/interfaces/ember_link.Behavior.md) controls the way links are
[`Behavior`](./api/ember-link/interfaces/Behavior.md) controls the way links are
opened. This can be [configured globally](./configuration.md) or
[locally with each link](./helper.md#parameters).

## `open`

When links are opened with [`link.open`](./api/classes/ember_link.Link.md#open)
When links are opened with [`link.open`](./api/ember-link/classes/Link.md#open)
it will use
[`Router.transitionTo()`](https://api.emberjs.com/ember/5.0/classes/RouterService/methods/transitionTo?anchor=transitionTo)
by default, but you can set it to `replace` to use
Expand Down
4 changes: 2 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ You can configure it globally or locally and there are reasons for both.
## Global Behavior

Global configuration is happening through the
[`LinkManagerService`](./api/classes/ember_link.LinkManagerService.md) to match
[`LinkManagerService`](./api/ember-link/classes/LinkManagerService.md) to match
the needs for your application:

```ts
Expand All @@ -28,7 +28,7 @@ export default class ApplicationRoute extends Route {

Local behavior can be applied for each link instance and _may_ overwrite
globally configured behavior. Pass the `behavior` parameter to a
[`Link`](./api/classes/ember_link.Link.md) instance.
[`Link`](./api/ember-link/classes/Link.md) instance.

## Global vs. Local Behavior

Expand Down
8 changes: 4 additions & 4 deletions docs/service.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# `LinkManager` Service

The `LinkManager` service is used by the [`(link) helper`](./helper.md) and
to create a [`Link`](./api/classes/ember_link.Link.md) instances.
to create a [`Link`](./api/ember-link/classes/Link.md) instances.

You can also use this service directly to programmatically create link
references.

## `createLink(linkParams: LinkParams): Link`

Will create a [`Link`](./api/classes/ember_link.Link.md) to pass around using
Will create a [`Link`](./api/ember-link/classes/Link.md)to pass around using
the same parameters as [`(link) helper`](./helper.md).

::: info
API Docs: [createLink](./api/classes/ember_link.LinkManagerService.md#createlink)
API Docs: [createLink](./api/ember-link/classes/LinkManagerService.md#createlink)
:::

## `getLinkParamsFromURL(url: string): LinkParams`
Expand All @@ -21,5 +21,5 @@ Use this method to derive `LinkParams` from a serialized, recognizable URL, that
you can then pass into `createLink`.

::: info
API Docs: [getLinkParamsFromURL](./api/classes/ember_link.LinkManagerService.md#getlinkparamsfromurl)
API Docs: [getLinkParamsFromURL](./api/ember-link/classes/LinkManagerService.md#getlinkparamsfromurl)
:::
2 changes: 1 addition & 1 deletion docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ your app boots with a fully-fledged router, so `ember-link` just works normally.
In [integration / render tests (`setupRenderingTest(hooks)`)](https://guides.emberjs.com/release/testing/testing-components/) the
router is not initialized, so `ember-link` can't operate normally. To still
support using `(link)` & friends in render tests, you can use the
[`setupLink(hooks)` test helper](./api/modules/ember_link_test_support.md#setuplink).
[`setupLink(hooks)` test helper](./api/ember-link/test-support/functions/setupLink.md).

```ts
import { click, render } from '@ember/test-helpers';
Expand Down
6 changes: 3 additions & 3 deletions docs/using-primitives.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ That also prepares them to properly work with [testing](./testing.md).

## Low Level Components

Make [`Link`](./api/classes/ember_link.Link.md) a first-class
Make [`Link`](./api/ember-link/classes/Link.md) a first-class
primitive in your app architecture! Instead of manually wiring up
[`Link#url`](./api/classes/ember_link.Link.md#url) and
[`Link#open()`](./api/classes/ember_link.Link.md#open) every time, rather
[`Link#url`](./api/ember-link/classes/Link.md#url) and
[`Link#open()`](./api/ember-link/classes/Link.md#open) every time, rather
create your own ready-to-use, style-guide-compliant link and button components
that accept `@link` as an argument.

Expand Down
3 changes: 2 additions & 1 deletion ember-link/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@
"rollup": "4.9.6",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-ts": "^3.4.5",
"typedoc-plugin-markdown": "^4.0.0-next.50",
"typedoc-vitepress-theme": "^1.0.0-next.8",
"typedoc": "^0.25.7",
"typedoc-plugin-markdown": "^3.17.1",
"typescript": "^5.3.3"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion ember-link/src/services/link-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class LinkManagerService extends Service {
*/
@service('router') readonly router!: RouterServiceWithRecognize;

[BEHAVIOR]: Behavior = {
protected [BEHAVIOR]: Behavior = {
open: 'transition',
prevent
};
Expand Down
21 changes: 14 additions & 7 deletions ember-link/typedoc.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
{
"entryPoints": [
"src/index.ts",
"src/test-support/index.ts"
"./src/index.ts",
"./src/test-support/index.ts"
],
"out": "../docs/api",
"json": "../docs/api/data.json",
"plugin": [
"typedoc-plugin-markdown"
"typedoc-plugin-markdown",
"typedoc-vitepress-theme"
],
"docsRoot": "../docs",
"excludeExternals": true,
"excludePrivate": true,
"excludeProtected": true,
"excludeExternals": true,
// typedoc-plugin-markdown
"hideBreadcrumbs": true
"useCodeBlocks": true,
"parametersFormat": "table",
"typeDeclarationFormat": "table",
"textContentMappings": {
"breadcrumbs.home": "API",
"kind.typeAlias.singular": "Type",
"kind.typeAlias.plural": "Types",
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"docs:preview": "vitepress preview docs"
},
"devDependencies": {
"concurrently": "^7.6.0",
"vitepress": "^1.0.0-beta.3"
"concurrently": "^8.2.2",
"vitepress": "^1.0.0-rc.41"
},
"volta": {
"node": "20.11.0"
Expand Down
Loading
Loading