Today I published a new package on npm: xcfg.
It’s a cross-platform config file management package that’s fairly simple, but pretty useful for those who write Node.js applications such as command-line utilities or desktop software in the form of Electron apps.
Since all the details of the project are on the package page, this entry will just cover the technology I used to create it.
Case in point: I started writing xcfg yesterday evening and finished up the remaining tests and documentation this evening before finally pushing the project onto GitHub and running
npm publish. It’s a small package, so that’s obviously why I was able to finish it in such a short amount of time, but the process of setting up a package.json and publishing to the npm registry was an absolute breeze. Publishing added only a very minimal amount of time and effort on top of coding, writing documentation, and adding unit tests.
Documentation and Testing
As far as documentation goes, I put some basic usage info in the project’s README and used ESDoc for the API docs. ESDoc looks great by default and has a familiar set of tags so it wasn’t difficult to use, despite never having used it previously. The only problem is, out of the box, it doesn’t work for Node.js projects but that was easily fixable with the esdoc-node development package.
For the unit tests, I used a combination of Mocha and Chai and at version 1.0.1, there are 10 unit tests (all passing, of course). I thought Mocha was pretty good but I may explore other assert libraries for my next project because Chai has a strange API and was a little annoying to validate with my chosen style guide, which brings me to my chosen…
npm run lint. I found that I agreed with all of its rules, even the more controversial decision to disallow extraneous (in other words, most) semicolons.
And that concludes my technical overview of xcfg 1.0.1. If you find any value in this package, please take a moment to star the GitHub repo.