You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/dev/mappings.md
+4-11Lines changed: 4 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ sidebar:
5
5
order: 5
6
6
---
7
7
8
-
[The mappings repository](https://github.com/moonlight-mod/mappings) contains a collection of known Webpack modules with human-readable names. It finds Webpack modules and creates an alias to them, as well as remapping exports.
8
+
[The mappings package](https://github.com/moonlight-mod/moonlight/tree/main/packages/mappings) contains a collection of known Webpack modules with human-readable names. It finds Webpack modules and creates an alias to them, as well as remapping exports.
9
9
10
10
## Remapping in your own extension
11
11
@@ -56,18 +56,11 @@ export default Exports;
56
56
57
57
When adding a new module:
58
58
59
-
-`node generate.js imports --write` to write the new `src/modules.ts`
60
-
61
-
When adding types to a module:
62
-
63
-
- Add its path and a name to `generate.js`
59
+
- If the module has types, add its path and a name to `generate.js`
64
60
- Name should be the last part of the path except in cases where it breaks syntax (e.g. `highlight.js` -> `HighlightJS`)
65
61
- Mappings for CSS class names should replace `.css` with `CSS`
66
-
-`node generate.js types --write` to generate the new type index
67
-
-`node generate.js declares "@moonlight-mod/wp/" > ../moonlight/packages/types/src/mappings.d.ts` to update import statements in moonlight
68
-
- You don't have to do this unless you're a moonlight core developer
Copy file name to clipboardExpand all lines: src/content/docs/dev/project-structure.md
+3-12Lines changed: 3 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,11 +14,9 @@ Each package contains a `package.json` and a `tsconfig.json`. Most packages will
14
14
15
15
## Build system
16
16
17
-
moonlight uses [esbuild](https://esbuild.github.io) as its build system. The build script (`build.mjs`) is a single file which handles building [each stage](#load-stages) of moonlight, as well as each [core extension](#core-extensions).
17
+
moonlight uses [esbuild](https://esbuild.github.io) as its build system. The build script (`build.mjs`) is a single file which handles building [each stage](#load-stages) of moonlight, as well as each [core extension](#core-extensions). This build script shares code with custom extensions in [esbuild-config](https://github.com/moonlight-mod/moonlight/tree/main/packages/esbuild-config), so flaws like [needing dev server restarts](/ext-dev/pitfalls#restarting-dev-mode-is-required-in-some-scenarios) apply to moonlight itself as well.
18
18
19
-
This build script is separate to [our esbuild-config repository](https://github.com/moonlight-mod/esbuild-config), which is used by third-party developers in their own extensions. A future goal is to use the esbuild-config repository in moonlight itself ([see open issue](https://github.com/moonlight-mod/moonlight/issues/222)). Even though they do not share code, the implementation is similar, so flaws like [needing dev server restarts](/ext-dev/pitfalls#restarting-dev-mode-is-required-in-some-scenarios) apply to moonlight itself as well.
20
-
21
-
esbuild's plugin API is very simple, and as such, moonlight's build script contains [a lot of hacks to get desired behavior](https://github.com/moonlight-mod/moonlight/blob/c01adbed21f7d7963f1ccb3038c8550fcd6343f0/build.mjs#L170-L175). In the future, moonlight and the [extension template](https://github.com/moonlight-mod/create-extension) may switch to another build system, but there are no plans to switch from esbuild at this time.
19
+
In the future, moonlight and the [extension template](https://github.com/moonlight-mod/create-extension) may switch to another build system, but there are no plans to switch from esbuild at this time.
22
20
23
21
## Core
24
22
@@ -138,11 +136,4 @@ After processing the extensions, it calls the `window._moonlightWebLoad` functio
138
136
139
137
## Other dependencies
140
138
141
-
moonlight uses some other packages that are not in the workspace, like [LunAST](https://github.com/moonlight-mod/lunast), [moonmap](https://github.com/moonlight-mod/moonmap), and [mappings](https://github.com/moonlight-mod/mappings). These packages do *not* use esbuild, and instead use [tsc](https://www.typescriptlang.org/docs/handbook/compiler-options.html), because they do not need any special config and are published on npm.
142
-
143
-
Sometimes, you may need to modify one of these libraries, and test them in a local copy of moonlight. This is a known pain point of working with moonlight, and there are several ways to accomplish this:
144
-
145
-
- Use [pnpm link](https://pnpm.io/cli/link) or [the link script](/dev/helper-scripts#linkmjs). Several developers have reported weird desyncs after linking packages, so exercise caution when using these.
146
-
- Edit the `package.json` of the desired package(s) to use the `file:` protocol.
147
-
148
-
Remember to undo your changes when you're done linking the other library, and make sure that `pnpm-lock.yaml` hasn't been changed by your testing.
139
+
moonlight uses some other packages that are not in the workspace, like [LunAST](https://github.com/moonlight-mod/lunast) and [moonmap](https://github.com/moonlight-mod/moonmap). Additionally, some packages in the moonlight monorepo must be published to npm, like [mappings](https://github.com/moonlight-mod/moonlight/tree/main/packages/mappings) and [esbuild-config](https://github.com/moonlight-mod/moonlight/tree/main/packages/esbuild-config). These packages do *not* use esbuild, and instead use [tsc](https://www.typescriptlang.org/docs/handbook/compiler-options.html).
Copy file name to clipboardExpand all lines: src/content/docs/dev/publishing.md
+12-28Lines changed: 12 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,54 +9,38 @@ This page is mainly here for moonlight core developers who forget what they're d
9
9
:::
10
10
11
11
:::caution
12
-
Version bumps are not done until a publish is required. Make sure to version bump moonlight (and types, if necessary) before publishing.
13
-
14
-
When publishing to npm, versions are constant. Exercise caution.
12
+
Version bumps are not done until a publish is required. When publishing to npm, versions are constant. Exercise caution.
15
13
:::
16
14
17
15
## Publishing moonlight
18
16
19
-
moonlight CI builds the `develop` branch automatically. This section is for publishing a new stable, versioned release.
17
+
moonlight CI builds the `main` branch automatically. This section is for publishing a new stable, versioned release.
20
18
21
-
- Checkout the `develop` branch.
22
-
- Pull to ensure you have the latest changes.
23
19
- Checkout the `main` branch.
24
-
- Merge `develop` into `main`.
25
-
- Update the version in the following files:
26
-
-`package.json`
27
-
-`packages/browser/manifest.json`
28
-
-`packages/browser/manifestv2.json`
29
-
- Write `CHANGELOG.md`.
30
-
- Do not append to the changelog - remake it.
31
-
- If any types changes were made in this release, [update the types version](#publishing-types).
20
+
- Pull to ensure you have the latest changes.
21
+
- Run `node scripts/version.mjs` to update the project version.
22
+
- If there were no changes to types or mappings, you can technically undo the version bump, though it's suggested to just leave it there out of caution. If there were any changes to mappings, types must always be updated to sync alongside it.
23
+
- Write `CHANGELOG.md`. Do not append to the changelog - remake it.
32
24
- Commit and push to `main`.
33
-
- Make sure to push before creating the tag, or you might confuse CI (reasons unknown).
34
-
- Create a tag with the version, **starting with the character `v`**: `git tag vX.Y.Z`
25
+
- Make sure to push before creating the tag, or you might confuse CI.
26
+
- Create a tag with the new version, **starting with the character `v`**: `git tag vX.Y.Z`
35
27
- This `v` is very important. CI will not pick it up otherwise. The installers will not know what to do without it.
28
+
- Double triple check that you didn't mistype the version number (this has happened before).
36
29
- Push the tag: `git push --tags`
37
-
- Checkout the `develop` branch.
38
-
- Merge `main` into `develop`.
39
-
- Push to `develop`.
40
-
41
-
## Publishing types
42
30
43
-
- Update the version in `packages/types/package.json`.
44
-
- We originally didn't have the types version in sync with moonlight, but we're aiming to resync. Bump the patch version until we can eventually re-synchronize them.
45
-
- Continue to publish a moonlight release like normal, and wait for CI to finish.
46
-
-[Run the types workflow](https://github.com/moonlight-mod/moonlight/actions/workflows/types.yml) to manually trigger a release to npm.
47
-
- If the manifest type was updated, regenerate the schema: `pnpx ts-json-schema-generator --path './packages/types/src/*.ts' --type ExtensionManifest -f ./tsconfig.json > ../moonlight-mod.github.io/public/manifest.schema.json`
31
+
Packages will be published to npm alongside the GitHub release. If the extension manifest type was updated, regenerate the JSON Schema: `pnpx ts-json-schema-generator --path './packages/types/src/*.ts' --type ExtensionManifest -f ./tsconfig.json > ../moonlight-mod.github.io/public/manifest.schema.json`
Copy file name to clipboardExpand all lines: src/content/docs/dev/setup.md
-2Lines changed: 0 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,5 @@ For more information on project structure, [see the dedicated page](/dev/project
18
18
19
19
- Ensure your commits pass Prettier/ESLint. This is a requirement for merge.
20
20
- moonlight uses [husky](https://typicode.github.io/husky) to check lints on commit. This should have automatically been setup for you when running `pnpm install`.
21
-
- Please make PRs to the `develop` branch instead of `main`.
22
-
-`develop` is merged into `main` when moonlight updates happen. Our in-progress work resides on `develop`.
23
21
- Don't break the existing API surface.
24
22
- Library extensions and moonlight globals cannot change in a way that breaks existing extensions (unless there is an upcoming API bump).
Copy file name to clipboardExpand all lines: src/content/docs/ext-dev/mappings.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,13 @@ sidebar:
5
5
order: 8
6
6
---
7
7
8
-
moonlight comes with [mappings](https://github.com/moonlight-mod/mappings) that automatically rename Discord's Webpack modules for you. You can import and use these modules in your extensions.
8
+
moonlight comes with [mappings](https://github.com/moonlight-mod/moonlight/tree/main/packages/mappings) that automatically rename Discord's Webpack modules for you. You can import and use these modules in your extensions.
9
9
10
10
mappings automatically detects unknown modules and remaps them to have consistent module IDs and export names.
11
11
12
12
## Browsing mappings
13
13
14
-
There is no search system for mappings yet, but you can browse [the source repository](https://github.com/moonlight-mod/mappings) instead. Press `/` on your keyboard to search in the GitHub web UI.
14
+
There is no search system for mappings yet, but you can browse [the source repository](https://github.com/moonlight-mod/moonlight/tree/main/packages/mappings) instead. Press `/` on your keyboard to search in the GitHub web UI.
0 commit comments