From ebe5c84ba3f5436dca00b5a3d7884d824efcbe62 Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Mon, 26 Jun 2023 23:03:54 -0500 Subject: [PATCH] separating walkthroughs --- .../{walkthrough => walkthrough-v2}/cli.md | 0 .../conclusion.md | 0 .../dependency-injection.md | 0 .../first-command.md | 0 .../first-event.md | 0 .../{walkthrough => walkthrough-v2}/goal.md | 4 ++ .../good-to-know.md | 0 .../plugins.md | 0 .../sern-emitter.md | 0 docs/guide/walkthrough-v3/transition.md | 38 +++++++++++++++++++ 10 files changed, 42 insertions(+) rename docs/guide/{walkthrough => walkthrough-v2}/cli.md (100%) rename docs/guide/{walkthrough => walkthrough-v2}/conclusion.md (100%) rename docs/guide/{walkthrough => walkthrough-v2}/dependency-injection.md (100%) rename docs/guide/{walkthrough => walkthrough-v2}/first-command.md (100%) rename docs/guide/{walkthrough => walkthrough-v2}/first-event.md (100%) rename docs/guide/{walkthrough => walkthrough-v2}/goal.md (89%) rename docs/guide/{walkthrough => walkthrough-v2}/good-to-know.md (100%) rename docs/guide/{walkthrough => walkthrough-v2}/plugins.md (100%) rename docs/guide/{walkthrough => walkthrough-v2}/sern-emitter.md (100%) create mode 100644 docs/guide/walkthrough-v3/transition.md diff --git a/docs/guide/walkthrough/cli.md b/docs/guide/walkthrough-v2/cli.md similarity index 100% rename from docs/guide/walkthrough/cli.md rename to docs/guide/walkthrough-v2/cli.md diff --git a/docs/guide/walkthrough/conclusion.md b/docs/guide/walkthrough-v2/conclusion.md similarity index 100% rename from docs/guide/walkthrough/conclusion.md rename to docs/guide/walkthrough-v2/conclusion.md diff --git a/docs/guide/walkthrough/dependency-injection.md b/docs/guide/walkthrough-v2/dependency-injection.md similarity index 100% rename from docs/guide/walkthrough/dependency-injection.md rename to docs/guide/walkthrough-v2/dependency-injection.md diff --git a/docs/guide/walkthrough/first-command.md b/docs/guide/walkthrough-v2/first-command.md similarity index 100% rename from docs/guide/walkthrough/first-command.md rename to docs/guide/walkthrough-v2/first-command.md diff --git a/docs/guide/walkthrough/first-event.md b/docs/guide/walkthrough-v2/first-event.md similarity index 100% rename from docs/guide/walkthrough/first-event.md rename to docs/guide/walkthrough-v2/first-event.md diff --git a/docs/guide/walkthrough/goal.md b/docs/guide/walkthrough-v2/goal.md similarity index 89% rename from docs/guide/walkthrough/goal.md rename to docs/guide/walkthrough-v2/goal.md index b26959153..93d97bb44 100644 --- a/docs/guide/walkthrough/goal.md +++ b/docs/guide/walkthrough-v2/goal.md @@ -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. diff --git a/docs/guide/walkthrough/good-to-know.md b/docs/guide/walkthrough-v2/good-to-know.md similarity index 100% rename from docs/guide/walkthrough/good-to-know.md rename to docs/guide/walkthrough-v2/good-to-know.md diff --git a/docs/guide/walkthrough/plugins.md b/docs/guide/walkthrough-v2/plugins.md similarity index 100% rename from docs/guide/walkthrough/plugins.md rename to docs/guide/walkthrough-v2/plugins.md diff --git a/docs/guide/walkthrough/sern-emitter.md b/docs/guide/walkthrough-v2/sern-emitter.md similarity index 100% rename from docs/guide/walkthrough/sern-emitter.md rename to docs/guide/walkthrough-v2/sern-emitter.md diff --git a/docs/guide/walkthrough-v3/transition.md b/docs/guide/walkthrough-v3/transition.md new file mode 100644 index 000000000..daacc439d --- /dev/null +++ b/docs/guide/walkthrough-v3/transition.md @@ -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 + } +} + + +export {} + +```