Closed fnogatz closed 5 years ago
I finished re-implementing all of clocker's current CLI methods. @substack, @BeniRupp and other users, would you please give the new version of the lib branch a try? Just use ./bin/index.js
instead of ./bin/cmd.js
.
@fnogatz I will have a look at your changes as soon as I have a free timeslot for that. 👍
@fnogatz I will have a look at your changes as soon as I have a free timeslot for that. +1
@BeniRupp Already had a chance to look into the changes? :smile_cat:
Yes, but only a quick look. Sorry for that. I hope that I can give you some detailed feedback next week. 🙈
@BeniRupp, ping :grinning:
I'am so sorry! My smartphone reminds me every other day.. 😞 I don't promise anything, but I have it in mind and I want to give you some feedback.
Soo.. I had the change to have a look at your PR this evening. 🙂
First of all, I like the refactoring you made! To use commander
instead of the else-if
hell is a huge benefit in my opinion. Separate functions for the commands are great, too. 👍 And tests are always a good choice! 👏 So you added a lot of improvements to the code. Thanks a lot for that!
One thing that I would reconsider is the length of the files. I prefer short files for a better overview and to separate things that belong together from those which do not.
So my suggestion is:
bin/index.js
into own modules (maybe: basic
, export
, report
, archive
?) so that this file does "only" add all the commands to the commander
instance.test/index.js
I think this would really improve the readability.
I will also add some comments to the code to point out some smaller things I found during the review.
Hopefully this feedback is useful for you. If I am wrong with one of my comments, please let me know! 😉
Hey @fnogatz, thank you for the rework! 🙂 So I think we are ready for merging the feature branch, right? Or do you wait for some other feedback?
There's still one major point from your original post:
One thing that I would reconsider is the length of the files. I prefer short files for a better overview and to separate things that belong together from those which do not.
I see your point in splitting the large files. However, my urge to refactor this is not too big :laughing:
But I am open to your suggestions. Maybe it's a good idea to merge this first, and then you could open a PR with the changes, if you are still interested in? I will happily merge it :)
Sounds good! 👍 Let's do it this way.
Haha, thanks for merging this. I once asked @substack to give you the permissions for this repository, but he never responded. So you are also able to publish the new version at npm?
Yes, he gave it to me. 🙂
Oh, I've never done this. Is it just a npm publish
in the repo root?
I just removed the legacy bin/cmd.js
and bin/usage.txt
and published the new version as v1.15.0
on npm. This is no major semver update, because it should contain no breaking changes, only a changing implementation.
As first discussed 3 years ago in #26, I just started to move the core functionality into a
/lib/index.js
file, so we can split into a library and the CLI. This also allows to provide TAP tests for future development.