Skip to main content
Version: 2.3

Update and migrations

General update guide

TSCord is a template-kind of project, so updating it can really be harsh.
However, here is an update guide that you can (quite) follow for each migration:

  1. cd into your project directory
  2. git remote add tscord https://github.com/barthofu/tscord
  3. git fetch origin
  4. Now, get the tag of the release you want to update to (ex: v2.1)
  5. git merge v2.1 (replace v2.1 with the tag you want to)
  6. Resolve the conflicts (we highly recommend you to use the new merge editor of VSCode)
  7. Once you've resolved all the conflict, commit the changes
  8. git remote rm tscord

Migrations

This section contains useful information about some version migration.

v2.0 to v2.1

Custom events

Events and Custom events, which used to both relay the @On() decorator of discordx, are now split.

Indeed, we've implemented our own event manager so custom events are split from the discord ones, so they don't have to execute the whole guards pipeline.

You'll have to replace all your custom events by the new @OnCustom() decorators, and emit them via the emit() method of the EventManager service.

configs alias

The src/config folder has been renamed to src/configs, and so for its path alias: @config -> @configs.

v2.2 to v2.3
caution

This migration is quite heavy, and you should be careful when updating to this version. It is mainly due to the fact that we've auto-formatted the code on nearly all the files.

You should check changes commit-per-commit on the associated Github PR to see what has changed and adapt your code accordingly.

Sorry for the inconvenience.

Path aliases

All the internal tsconfig path aliases have changed from @<module_name> to @/<module_name> (e.g: @services -> @/services).

You should replace all the old path aliases by the new ones (quite fast to do with the global research/replace feature of your IDE).

Environment variables

We now use envalid to validate the environment variables upon startup.

You shouldn't import them from process.env anymore. Use the env object from the @/env module instead.

Service and Injectable

Three tsyringe decorators have been replaced by custom wrappers importable from @/decorators:

  • @singleton() -> @Service()
  • @injectable() -> @Injectable()
  • @autoInjectable() -> @AutoInjectable()