feat: add link validation & fix broken/relative links

This commit is contained in:
DuroCodes
2024-05-24 17:31:00 -04:00
parent 8b177a8f40
commit 1c6c0f8ec5
18 changed files with 45 additions and 39 deletions

View File

@@ -4,6 +4,7 @@ import starlightBlog from "starlight-blog";
import tailwind from "@astrojs/tailwind";
import starlightTypeDoc, { typeDocSidebarGroup } from "starlight-typedoc";
import lunaria from "@lunariajs/starlight";
import starlightLinksValidator from 'starlight-links-validator';
import { GITHUB_URL, DISCORD_URL } from "./src/utils/consts";
export default defineConfig({
@@ -73,7 +74,7 @@ export default defineConfig({
{
label: "v4",
items: [
{
{
label: "CLI",
autogenerate: { directory: "cli" },
},
@@ -129,6 +130,9 @@ export default defineConfig({
sidebar: { collapsed: true },
}),
lunaria(),
starlightLinksValidator({
exclude: ['/v3/api'],
}),
],
}),
tailwind(),

BIN
bun.lockb

Binary file not shown.

View File

@@ -23,6 +23,7 @@
"astro": "4.9.1",
"sharp": "^0.32.5",
"starlight-blog": "^0.7.1",
"starlight-links-validator": "^0.8.0",
"starlight-typedoc": "^0.12.1",
"typedoc": "^0.25.13",
"typedoc-plugin-markdown": "next",

View File

@@ -24,7 +24,7 @@ Quick List of changes!
### Class based modules
Incorporate class based modules into your project instead of the traditional `commandModule` or `eventModule`
Extend the new [CommandExecutable](docs/api/classes/CommandExecutable) or [EventExecutable](docs/api/classes/EventExecutable)
Extend the new `CommandExecutable` or `EventExecutable`
```ts title="commands/meaning-of-life.ts" {15}
import {
@@ -74,11 +74,11 @@ Feel free to use TypeScript experimental decorators to augment and customize you
The next update will bring sern v2 with some important features. Here are some things to watch out for.
- [Wrapper#client](docs/api/interfaces/Wrapper) will be deprecated
- [Wrapper#sernEmitter](docs/api/interfaces/Wrapper) will be deprecated
- [Wrapper#client](/v3/api/interfaces/wrapper) will be deprecated
- [Wrapper#sernEmitter](/v3/api/interfaces/wrapper) will be deprecated
- a SernEmitter will be automatically created once Sern#init is called
- The option to pass in a function or array for [Wrapper#events](docs/api/interfaces/Wrapper) will be deprecated. Only strings are accepted.
- [Sern#addExternal](docs/api/classes/SernEmitter) will be deprecated in favor of a better way.
- The option to pass in a function or array for [Wrapper#events](/v3/api/interfaces/wrapper) will be deprecated. Only strings are accepted.
- `Sern#addExternal` will be deprecated in favor of a better way.
### Dependencies Update

View File

@@ -17,22 +17,23 @@ date: 2023-01-12
### Breaking changes
- [controller](../docs/api/modules#controller) parameter for plugins has been removed
- `controller` parameter for plugins has been removed
- You'll need to import it instead
- This **breaks** old [CommandPlugin](../docs/api/interfaces/CommandPlugin), but **not** old [EventPlugin](../docs/api/interfaces/EventPlugin)
- This **breaks** old `CommandPlugin`, but **not** old `EventPlugin`
### Deprecations
- [CommandPlugin](../docs/api/interfaces/CommandPlugin) and [EventPlugin](../docs/api/interfaces/EventPlugin) have been renamed [InitPlugin](../docs/api/interfaces/InitPlugin) and [ControlPlugin](../docs/api/interfaces/ControlPlugin)
- `CommandPlugin` and `EventPlugin` have been renamed to [InitPlugin](/v3/api/interfaces/initplugin) and [ControlPlugin](/v3/docs/api/interfaces/controlplugin), respectively
### Reason
- The naming of plugins was getting too complex. For example, plugin naming evolved into CommandModuleCommandPlugin, CommandModuleEventPlugin and more.
- I realize that this affects all plugins. I have updated all [plugins](https://github.com/sern-handler/awesome-plugins/pull/68) to match these changes
- The old way of declaring plugins has been deprecated in favor of newer functions that facilitate and ease typings
- [CommandControlPlugin](../docs/api/modules#commandcontrolplugin)
- [CommandInitPlugin](../docs/api/modules#commandinitplugin)
- [EventControlPlugin](../docs/api/modules#eventcontrolplugin)
- [EventInitPlugin](../docs/api/modules#eventinitplugin)
- [DiscordEventControlPlugin](../docs/api/modules#discordeventcontrolplugin)
This will probably be the last breaking change in a while. Thanks for using sern!
- [CommandControlPlugin](/v3/api/functions/commandcontrolplugin)
- [CommandInitPlugin](/v3/api/functions/commandinitplugin)
- [EventControlPlugin](/v3/api/functions/eventcontrolplugin)
- [EventInitPlugin](/v3/api/functions/eventinitplugin)
- [DiscordEventControlPlugin](/v3/api/functions/discordeventcontrolplugin)
This will probably be the last breaking change in a while. Thanks for using sern!

View File

@@ -77,7 +77,7 @@ type ValidPublishOptions =
## Prerequiring
Is there a [service](../../guide/walkthrough/services) that is required at the top level of a command?
Is there a [service](/v3/guide/walkthrough/services) that is required at the top level of a command?
Create an ES6 script anywhere, such as:

View File

@@ -19,10 +19,10 @@ import PackageManagers from '~/components/PackageManagers.astro';
## Adding Plugins
:::caution
You must have a [sern.config.json](../good-to-know#sernconfigjson) to use this command.
You must have a [sern.config.json](/v3/guide/walkthrough/good-to-know#sernconfigjson) to use this command.
:::
To install [plugins](../plugins) maintained by the community [repository](https://github.com/sern-handler/awesome-plugins):
To install [plugins](/v3/guide/walkthrough/plugins) maintained by the community [repository](https://github.com/sern-handler/awesome-plugins):
```sh
sern plugins
@@ -30,7 +30,7 @@ sern plugins
This will display a menu selection of all installable plugins.
If you'd like to view all plugins, check out our [plugins page](../../../plugins).
If you'd like to view all plugins, check out our [plugins page](/plugins).
## Extra Utilities
@@ -40,4 +40,4 @@ To install extra utilities into your project, run:
sern extra
```
We have a more in depth [guide](../../../cli/about) on the CLI if you're interested in learning more.
We have a more in depth [guide](/v3/cli/about) on the CLI if you're interested in learning more.

View File

@@ -5,7 +5,7 @@ sidebar:
---
:::danger
This contains version 2 code. Please view [transitioning to v3](../transition) for the `Service` API.
This contains version 2 code. Please view [transitioning to v3](/v3/guide/walkthrough/transition) for the `Service` API.
:::
Since version 2.0.0, dependency injection, thanks to [iti](https://github.com/molszanski/iti), is a feature to customize your bot's utilities and structures.
@@ -68,10 +68,10 @@ Everything else is handled. However, you may want customize things.
Each sern built dependency must implement its contracts:
- `@sern/logger`: Logging data → [`Logging`](../../../api/interfaces/logging)
- `@sern/errors`: Handling errors and lifetime → [`ErrorHandling`](../../../api/interfaces/errorhandling)
- `@sern/modules`: Managing all command modules → [`ModuleManager`](../../../api/interfaces/modulemanager)
- `@sern/emitter`: The key to emit events and occurences in a project → [`Emitter`](../../../api/interfaces/emitter)
- `@sern/logger`: Logging data → [`Logging`](/v3/api/interfaces/logging)
- `@sern/errors`: Handling errors and lifetime → [`ErrorHandling`](/v3/api/interfaces/errorhandling)
- `@sern/modules`: Managing all command modules → [`ModuleManager`](/v3/api/interfaces/modulemanager)
- `@sern/emitter`: The key to emit events and occurences in a project → [`Emitter`](/v3/api/interfaces/emitter)
You may also add disposers so that when the application crashes, the targeted dependency calls that function.

View File

@@ -57,13 +57,13 @@ import { Tabs, TabItem } from '@astrojs/starlight/components';
</TabItem>
</Tabs>
To view what each of these properties mean in depth, visit the docs for [`CommandType`](../../../api/enumerations/commandtype).
To view what each of these properties mean in depth, visit the docs for [`CommandType`](/v3/api/enumerations/commandtype).
## Command Module Types
Every command module `type` is part of an enum. This field allows type inference for the rest of a module's fields.
All the command types can be found in the [`CommandType`](../../../api/enumerations/commandtype) enum!
All the command types can be found in the [`CommandType`](/v3/api/enumerations/commandtype) enum!
## Example Modal Command
@@ -114,7 +114,7 @@ Commands are straight forward. Keep in mind, the only required fields for comman
## Context Class
The provided [`Context`](../../../api/classes/context) class helps with modules of `CommandType.Both` (A mixture of slash / legacy commands).
The provided [`Context`](/v3/api/classes/context) class helps with modules of `CommandType.Both` (A mixture of slash / legacy commands).
The `Context` class is passed into modules with type:

View File

@@ -41,9 +41,9 @@ import { Tabs, TabItem } from '@astrojs/starlight/components';
</TabItem>
</Tabs>
Similar to command modules, the `type` property denotes what kind of event it is. You can view [`EventType`](../../../api/enumerations/eventtype) for more information.
Similar to command modules, the `type` property denotes what kind of event it is. You can view [`EventType`](/v3/api/enumerations/eventtype) for more information.
To view what each of these properties mean in depth, visit the docs for [`EventType`](../../../api/enumerations/eventtype).
To view what each of these properties mean in depth, visit the docs for [`EventType`](/v3/api/enumerations/eventtype).
## External Events

View File

@@ -16,6 +16,6 @@ import { Steps } from '@astrojs/starlight/components';
5. `warn` events, where it is possible to throw errors
</Steps>
You can put these and other event listeners into [event modules](../first-event)!
You can put these and other event listeners into [event modules](/v3/guide/walkthrough/first-event)!
You can view all events in the [`SernEventsMapping`](../../../api/interfaces/serneventsmapping) interface.
You can view all events in the [`SernEventsMapping`](/v3/api/interfaces/serneventsmapping) interface.

View File

@@ -28,11 +28,11 @@ interface Dependencies extends CoreDependencies {
Some keys in `Dependencies` are special and are used by sern internally:
- `@sern/client`: Your Discord client. → [`Emitter`](../../../api/interfaces/emitter)
- `@sern/logger`: Logging data → [`Logging`](../../../api/interfaces/logging)
- `@sern/errors`: Handling errors and lifetime → [`ErrorHandling`](../../../api/interfaces/errorhandling)
- `@sern/modules`: Managing all command modules → [`ModuleManager`](../../../api/interfaces/modulemanager)
- `@sern/emitter`: The key to emit events and occurences in a project → [`Emitter`](../../../api/interfaces/emitter)
- `@sern/client`: Your Discord client. → [`Emitter`](/v3/api/interfaces/emitter)
- `@sern/logger`: Logging data → [`Logging`](/v3/api/interfaces/logging)
- `@sern/errors`: Handling errors and lifetime → [`ErrorHandling`](/v3/api/interfaces/errorhandling)
- `@sern/modules`: Managing all command modules → [`ModuleManager`](/v3/api/interfaces/modulemanager)
- `@sern/emitter`: The key to emit events and occurences in a project → [`Emitter`](/v3/api/interfaces/emitter)
## Usage

View File

@@ -9,8 +9,8 @@ sidebar:
+ await makeDependencies({ build: () => {} })
```
v3 comes with the new [Service API](../services). To make sure to enable intellisense,
include a `dependencies.d.ts` file into compilation. (Check out the [changelog](../../../blog/3.0.0) for all new features)
v3 comes with the new [Service API](/v3/guide/walkthrough/services). To make sure to enable intellisense,
include a `dependencies.d.ts` file into compilation. (Check out the [changelog](/blog/3.0.0) for all new features)
A standard project file tree: <br />