Introducing fluent-git: A JS/TS library to make using git fluently 😎
Repository
https://github.com/DrSensor/fluent-git
About
fluent-git is a Javascript/Typescript library for operating git client easier yet powerfull by leveraging Fluent API Design. For example if I want to add notes on specific file at specific commit, I need to execute some of git
commands just to get the hash id of that file then use that hash id when adding a notes using git notes add
.
git
commandBy using this library, you can do that easily using this expression:
notes('some long notes').add.atFile('README.md', 'Initial commit')
Current features
Currently this library focus on making git-notes easier yet powerful. This library implement 58% of git-notes subcommands (excluding merge
, prune
, and list
) which each of them can operate on file, folder, and commit message.
Technology Stack
For more details see HACKING.md.
📦 Main Dependencies
I'm using execa for executing the git
commands. I use it because it has better perfomance than most of the methods in child_process module, especially when executed in Windows. However, I will switch that with child_process.execFileSync if it's not running well in electron base app.
✔️ Test Framework/Approach
As usual, I'm using Jest as my testing-framework of choice. As you may guest, this library is pretty much overtested because it support 3 different expression (see the README). Also, I'm not yet test the CLI and atSubmodule
handler which lower the test coverage. Code coverage is a good indicator to indicate if something is missing/deleted but it's not a metric for measuring if the projects are fully tested.
The way I test this project is a bit different.
- I create a git submodule which pointed to this repo.
- I change the working directory where the test is running (see here) by using globalSetup
- Re-fetch (with force) all notes before and after the test is running.
♻️ CI and Build Tools
As usual, I use CircleCI to do the automation test and build. The reason I don't test it in Node v6 is because I use object destructuring in rollup.config.js and I don't know how to babelify the config 😂
Future Plans
- 💪 Implement search notes feature. Probably I will use combination of
git grep
along withgit notes list
🤔 - 🏗 Test it on multiple platform by using AppVeyor (for Windows) and Travis CI (for MacOS).
- 📶 Cache-restore the notes instead of force-update when running the test. I need it in case I want to maintain it when traveling.
- 🤔 Don't know if it's a good idea. I have been thinking making this as a monorepo project using lerna. I want to publish it in multiple npm packages.
- 😋 Create a mocking module just like Enzyme or Vue Test Utils.
How to contribute?
Just DM's me via Discord, make a Github issue/PR, or write a comments below if anyone interested. For guidelines, see Contributing section (contribution is always welcome so don't be afraid to make mistakes 🙂).
Thanks for the contribution, @drsensor! Another crazy, interesting and high quality contribution from you - how do you do it?! Did you use these notes before creating GUC? Personally I had never heard of them or anyone using them before the hackathon, so it's interesting to see what they can be used for. Are there any other practical applications you recommend people should use them for?
Also, are you addicted to emojis? 😋
Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
To view those questions and the relevant answers related to your post, click here.
Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]
Hi @amosbastian
No. I only found about git-notes when Danjell gives an idea about to put comments related to Utopian directly in the files. Seems I got lucky to be able to deduce searching from keyword git comments to git notes 😁
Actually, Github use it before then remove it since only fewer people using the notes. Another software that uses git-notes is Gerrit though I never touch it.
Hahaha... I will use emoji as long as I use VSCode with emojisense installed. Also, I literally use
😋
not:yum:
. There is also a technical reason why I use emoji in my commit description.👉🏽 It's much pleasant and easier to read than using a hyphen(
-
) 👈🏽Thank you for your review, @amosbastian!
So far this week you've reviewed 7 contributions. Keep up the good work!
Hi @drsensor!
Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server
Hey, @drsensor!
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!
Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).
Want to chat? Join us on Discord https://discord.gg/h52nFrV.
Vote for Utopian Witness!