* feat: basic initialisation * fix: no scope * chore: add options for issues * feat: good word, Monbrey * feat: basic README.md * fix: no documentation for this * feat: install for them * chore: update licencing * chore: fix year * fix: build tsup * feat: add TypeScript option * feat: add `name` option * chore: ignore annoying errors * chore: add tsconfig.json * refactor: remove name We can just use the name of the directory instead. * chore: update cliff jumper rc * chore: bump dependencies * chore: bump dependencies * fix: build in prepack * fix: configure ESLint correctly * feat: infer package manager * docs(packageManager): document `install()` * fix(packageManager): do not emit a warning for `npm` * refactor: change project name colour to yellow * docs(constants): basic documentation * feat: add link * chore: add `verbatimModuleSyntax` * chore: bump discord.js * refactor: switch to @sapphire/ts-config * refactor: file name changes * refactor: tweak description * chore: update yarn.lock * fix: add .env * chore: bump dependencies * feat: event handler * refactor: use `default` * refactor: simpler event * chore: bump discord.js * fix: add release script and reorder * style: reorder package.json * chore: remove unneeded ignores * chore: bump minimum Node.js version * chore: add @types/node to TypeScript package.json * chore: apply requested changes Co-authored-by: Noel <buechler.noel@outlook.com> * style: run ESLint + Prettier * refactor: prefer "the" * refactor: remove some comments * feat: add ESLint + Prettier * chore: requested changes Co-authored-by: Noel <buechler.noel@outlook.com> * chore: more requested changes Co-authored-by: Noel <buechler.noel@outlook.com> --------- Co-authored-by: Noel <buechler.noel@outlook.com>
2.8 KiB
Contributing
The issue tracker is only for bug reports and enhancement suggestions. If you have a question, please ask it in the Discord server instead of opening an issue – you will get redirected there anyway.
If you wish to contribute to the discord.js codebase or documentation, feel free to fork the repository and submit a pull request. We use ESLint to enforce a consistent coding style, so having that set up in your editor of choice is a great boon to your development process.
Setup
To get ready to work on the codebase, please do the following:
- Fork & clone the repository, and make sure you're on the main branch
- Run
yarn --immutable(install) - Run
yarn buildto build local packages - Code your heart out!
- Run
yarn testto run ESLint and ensure any JSDoc changes are valid - Submit a pull request (Make sure you follow the conventional commit format)
Testing changes locally
If you want to test changes you've made locally, you can do so by using yarn link. This will create a symlink to your local copy of the discord.js libraries.
- Create a new directory
mkdir discordjs-testand move into itcd discordjs-test - Initialize a new yarn 3 project
yarn init -2 - Disable pnp
yarn config set nodeLinker node-modules - Now link the local discord.js project you cloned earlier
yarn link -A {PATH_TO_DISCORDJS_REPO} - Install packages you'd like to test locally
yarn add discord.js@latest,yarn add @discordjs/rest@latest, etc. Note: Make sure you uselatesttag or else yarn will try to install the remote package from npm - Import the package in your source code and test them out!
Working with TypeScript packages
When testing local changes, you may notice you need to manually recompile TypeScript projects on every change in order to get the latest code changes to test locally.
To avoid this you can use the --watch parameter in the package build script to automatically recompile the project when changes are detected.
For example, to automatically recompile the @discordjs/rest project when changes are detected, run yarn turbo run build --filter=@discordjs/rest -- --watch in the root folder of where you cloned the discord.js repo.
Adding new packages
If you'd like to create another package under the @discordjs organization run the following command:
yarn create-package <package-name> [package-description]
This will create new package directory under packages/ with the required configuration files. You can
begin to make changes within the src/ directory. It may also be required to update the CODEOWNERS file.