mirror of
https://github.com/sern-handler/website
synced 2026-06-27 18:22:22 +00:00
separating walkthroughs
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
::warning
|
||||
This is the v2 guide. Go to the v3 guide!
|
||||
::
|
||||
|
||||
# Walkthrough
|
||||
|
||||
This walkthrough will be written in [TypeScript](https://www.typescriptlang.org/) but will have JavaScript snippets throughout.
|
||||
38
docs/guide/walkthrough-v3/transition.md
Normal file
38
docs/guide/walkthrough-v3/transition.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Transitioning from v2 to v3
|
||||
|
||||
|
||||
- Sern.makeDependencies -> makeDependencies
|
||||
- it is asynchronous and top level function now. Make sure to await it before initing for proper synchronization.
|
||||
|
||||
|
||||
```diff
|
||||
- Sern.makeDependencies({ build: () => {} })
|
||||
+ await makeDependencies({ build: () => {} })
|
||||
```
|
||||
Also, v3 comes with the new Service api. To make sure to enable intellisense
|
||||
|
||||
include a dependencies.d.ts file into compilation.
|
||||
```ts
|
||||
/**
|
||||
* This file serves as intellisense for sern projects.
|
||||
* Types are declared here for dependencies to function properly
|
||||
* Service(s) api rely on this file to provide a better developer experience.
|
||||
*/
|
||||
|
||||
import { SernEmitter, Logging, CoreModuleStore, ModuleManager, ErrorHandling, CoreDependencies, Singleton } from '@sern/handler'
|
||||
import { Client } from 'discord.js'
|
||||
|
||||
declare global {
|
||||
interface Dependencies extends CoreDependencies {
|
||||
'@sern/client': Singleton<Client>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export {}
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user