feat: add cli commands to help with setup #29
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/29/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This work started small but slowly went a bit out of control. Excuse the huge diff. ^-^'
CLI
I want the project to be as simple to set up as possible (or at least as practical). I've added common CLI libraries in the Node.js ecosystem like
commander,@inquirer, andyocto-spinnerto offer a fairly modern experience.All commands that use them allow input to be specified through arguments or interactively. If arguments are specified, it disabled all interaction for that input, including any validation or fluff. I opted to treat it so that:
This isn't a conventional rule. It's just my way of trying to offer a positive UX, while also having a way to use it that stays out of your way.
I introduce four commands:
initconfig.ymlor where the user specified for the user to fill out.bot-tokentwitch-idrunI'm tempted to make a "test" feature as well, which will just try to do a bit of everything and report back any issues. For example, could it login, can it post messages, can it receive payloads from Twitch, etc. But I have not made this yet.
The
initcommand is the only one that writes directly to a file. The rest provide information to the user to insert into their file manually. I'll reconsider this later, but it seems annoying to edit their config file while ensuring we maintain formatting and comments. This is probably possible if we use a YAML library that exposes tokens rather than a POJO.Config
langis nowprocess.env.LANG. So the system language. This can easily be overridden by the user of course.matrix.homeserverUrlforhttps://matrix.org. I don't recall where I got the original value from, butmatrix.orgachieves the same thing and is more widely known.Docs
CI
coveragetask which will report code coverage to GitLab so we can put the badge at the top. We'll work on fleshing out more tests.Node.js v24
Upgrades to Node.js v24 so that I can use
t.mock.propertywhich is only available from Node.js v24.3.0 onwards.Given this is a standalone application and has had no official releases, I see no problem with requiring a very recent version. The production run should still work with v22, but for convenience we'll only support v24 on onwards anyway.
Chores
.gitignorefile. I used to just inline one from github.com/github/gitignore, but it contains too much noise. I'll still start from the GitHub one, but will clear things out that are not relevant to the project.node:.Related
mentioned in commit
60efa172c2