Skip to content

Commit 05a47cc

Browse files
committed
Fix some issues, document what's next & patch writing
1 parent 3158479 commit 05a47cc

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

src/content/docs/ext-dev/cookbook.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export const webpackModules: ExtensionWebExports["webpackModules"] = {
104104

105105
Then, import React from [mappings](/ext-dev/mappings):
106106

107-
```ts title="webpackModules/element.tsx"
107+
```tsx title="webpackModules/element.tsx"
108108
import React from "@moonlight-mod/wp/react";
109109

110110
export default function MyElement() {

src/content/docs/ext-dev/getting-started.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,17 @@ Do not add the directory with your code. moonlight will only be able to load the
121121

122122
After restarting your client, the extension will load.
123123

124-
When your extension is ready, you can [distribute the extension on a custom repository](#publishing-to-github-pages) or [submit to the official repository](/ext-dev/official-repository).
124+
## What's next?
125+
126+
Congrats on making it this far! There's a lot more to learn about how moonlight works:
127+
128+
- [Read about Webpack modules](/ext-dev/webpack), and learn how to write your own patches & make your own Webpack modules.
129+
- [Read the cookbook](/ext-dev/cookbook) for common patterns you may want to use.
130+
- [Set up DevTools](/ext-dev/devtools) to make reverse engineering Discord easier.
131+
- [Read common pitfalls](/ext-dev/pitfalls) so you know to avoid them.
132+
- When your extension is ready, [submit to the official repository](/ext-dev/official-repository) or [distribute the extension on a custom repository](#publishing-to-github-pages).
133+
134+
If you need any help, don't be afraid to [ask in our Discord server](https://discord.gg/FdZBTFCP6F).
125135

126136
## Publishing to GitHub Pages
127137

src/content/docs/ext-dev/webpack.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ export const patches: ExtensionWebExports["patches"] = [
9595
];
9696
```
9797

98+
### Writing good patches
99+
100+
It is suggested to follow some guidelines when writing patches:
101+
102+
- Never hardcode minified variable names. Use `.` (or `.{1,2}` for longer names), so the patch still functions when the names change.
103+
- Use capture groups (e.g. `(.)`) to use previous variable names and snippets of code in your patches.
104+
- Keep logic inside of the patch to a minimum, and instead use `require` to [load your own Webpack module](#webpack-module-insertion).
105+
98106
## Webpack module insertion
99107

100108
Similar to patching, extensions can also insert their own Webpack modules. These can be required like normal modules (which means they can be used inside of patches and other extensions). Extension Webpack modules take the form of `${ext.id}_${webpackModule.name}` (e.g. the `stores` Webpack module in the `common` extension has the ID `common_stores`).

0 commit comments

Comments
 (0)