Skip to content

Commit 8759302

Browse files
committed
Update docs for new repository changes
1 parent a7c2c27 commit 8759302

6 files changed

Lines changed: 21 additions & 71 deletions

File tree

src/content/docs/dev/helper-scripts.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/content/docs/dev/mappings.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar:
55
order: 5
66
---
77

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.
99

1010
## Remapping in your own extension
1111

@@ -56,18 +56,11 @@ export default Exports;
5656

5757
When adding a new module:
5858

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`
6460
- Name should be the last part of the path except in cases where it breaks syntax (e.g. `highlight.js` -> `HighlightJS`)
6561
- 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
69-
70-
Remember to format with Prettier!
62+
- In `packages/mappings`, run `node generate.js`
63+
- Format with Prettier
7164

7265
## Finding names
7366

src/content/docs/dev/project-structure.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ Each package contains a `package.json` and a `tsconfig.json`. Most packages will
1414

1515
## Build system
1616

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.
1818

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.
2220

2321
## Core
2422

@@ -138,11 +136,4 @@ After processing the extensions, it calls the `window._moonlightWebLoad` functio
138136

139137
## Other dependencies
140138

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).

src/content/docs/dev/publishing.md

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,54 +9,38 @@ This page is mainly here for moonlight core developers who forget what they're d
99
:::
1010

1111
:::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.
1513
:::
1614

1715
## Publishing moonlight
1816

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.
2018

21-
- Checkout the `develop` branch.
22-
- Pull to ensure you have the latest changes.
2319
- 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.
3224
- 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`
3527
- 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).
3629
- Push the tag: `git push --tags`
37-
- Checkout the `develop` branch.
38-
- Merge `main` into `develop`.
39-
- Push to `develop`.
40-
41-
## Publishing types
4230

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`
4832

4933
## Publishing other libraries
5034

51-
(e.g. moonmap, LunAST, mappings, create-extension)
35+
(e.g. moonmap, LunAST, create-extension)
5236

5337
- Update package.json with a new version.
5438
- Commit and push to `main`.
5539
- Create a tag with the version, **starting with the character `v`**: `git tag vX.Y.Z`
5640
- Same reasoning as [above](#publishing-moonlight).
5741
- Push the tag: `git push --tags`
5842
- Wait for the package to be uploaded to npm.
59-
- Use [the update helper script](/dev/helper-scripts) to update the dependencies in moonlight if needed.
43+
- Update the dependencies in moonlight.
6044

6145
## Publishing the installer
6246

src/content/docs/dev/setup.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,5 @@ For more information on project structure, [see the dedicated page](/dev/project
1818

1919
- Ensure your commits pass Prettier/ESLint. This is a requirement for merge.
2020
- 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`.
2321
- Don't break the existing API surface.
2422
- Library extensions and moonlight globals cannot change in a way that breaks existing extensions (unless there is an upcoming API bump).

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ sidebar:
55
order: 8
66
---
77

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.
99

1010
mappings automatically detects unknown modules and remaps them to have consistent module IDs and export names.
1111

1212
## Browsing mappings
1313

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.
1515

1616
## Notable modules
1717

0 commit comments

Comments
 (0)