Skip to content
sern

Release 3.0.0

3.0 Release

Join our discord

Features

Dependency Management

  • Service API (recommended to use this over useContainer hooks)
    • Dependencies type must be globally augmented in order for Services api to function properly
  • new methods on ModuleManager
    • getPublishableCommands()
  • Init Hooks
    • implement starting behavior for dependencies
    • To enforce and type check this, use the Initializable type when making your Dependencies type!
  • Emitter interface
    • More generic interface to define any event emitter
    • You can now swap out the SernEmitter with whatever emitter now.
1
class DatabaseService implements Init {
2
//some hypothetical database
3
_pgsql : database()
4
5
async init() {
6
await _pgsql.load()
7
}
8
9
}
10
11
await makeDependencies({
12
build: root => root.add({
13
db: new DatabaseService() //will be init'ed automatically
14
})
15
})
  • new SernEmitter event modulesLoaded , which allows users to customize behavior after all modules are loaded!
1
export default eventModule({
2
name: "modulesLoaded",
3
type: EventType.Sern,
4
execute: () => {
5
console.log("All modules loaded");
6
},
7
});

Quality of Life

  • faster module loading

    • I utilize async generators for reading files now. A lot faster than the first iteration.
  • better error handling

  • Less boilerplate

    • Services api cleans up v2 boilerplate
  • class modules devex got upgraded and work better than before

  • automatically ignore any files not ending in (mts, cts, mjs, cjs, ts, js)

    • ignore commands and events with ! prefix on filename or directory (ie: !filename.ts or !directory will be ignored by sern)
  • Service API (recommended to use this over useContainer hooks)

    • Dependencies type must be globally augmented in order for Services api to function properly
  • Less boilerplate

  • new methods on ModuleManager

  • automatically ignore any files not ending in (mts, cts, mjs, cjs, ts, js)

    • ignore commands / events with ! prefix on filename or directory (ie: !filename.ts or !directory)
  • new SernEmitter event modulesLoaded , which allows users to customize behavior after all modules are loaded!

  • Init Hooks

    • implement starting behavior for dependencies

Experimental

  • Experimental things may be subject to removal, need feedback and are not guaranteed stable
  • dev / prod mode
    • sern will behave differently depending on mode set
  • init sern from file option
    • reads from local sern.config.json
1
Sern.init("file");

Breaking changes

  • Sern.makeDependencies -> makeDependencies
    • it is asynchronous and top level function now. Make sure to await it before initing for proper synchronization.
  • module store and manager internally changed, so those using them may recieve breaking changes
  • BaseOptions type removed
Sern.makeDependencies({ build: () => {} })
await makeDependencies({ build: () => {} })

Deprecations

  • Removed all previous marked deprecations in v3
  • ModuleStore will be removed as a dependency in v4. The only way to access modules should be through ModuleManager
  • Default Dependencies will be made internal in the v4. Users should only have access to its interface / contract