democracy.js
democracy.js copied to clipboard
Typescript, CI, start/stop methods, dev script, and new options
Changes:
User facing:
- Expose TS typings #4
- Switch to ESM
- Allow stopping and starting a node #9
- Add an
autoStart
option - Add an
enableStrictWeightMode
option to be more aggressive about making the highest-weighted node the leader (may help with https://github.com/mKeRix/room-assistant/issues/860) - Change isLeader() implementation such that it isn't reliant on object key iteration order, which could have potentially returned false if the current node was a leader and another node was still reporting themself as a leader. If this occurred, it would mean the runoff elections might not occur when necessary, which could result in multiple leaders existing indefinitely.
Dev facing:
- Remove the deprecated shortid package and replace it with nanoid
- Update eslint packages and add a script for linting
- Introduce Github actions to run linting and type checking on PRs and pushes
- Mark internal-only methods as private
- Introduce a dev script to easily run a 3 node cluster that watches for file changes
- Resolve #17, #16, #15, #13, #11, #8 as well
Hey @goldfire, I'm sure you're busy but I'd love to get some feedback on this when you get time 🙂
@goldfire do you have an idea of when you'll get a chance to review this? Thanks!