thanc is a Node.js program that lets you to star the whole dependency tree of a given project containing a package.json manifest or a package-lock.json file.It helps to say thanks to every dependency you’ve used in your projects by starring it on Github.
A couple of days before Christmas, a friend of mine told me about thanks, a Symfony package to:
Give thanks (in the form of a GitHub ⭐) to your fellow PHP package maintainers (not limited to Symfony components)!
That was a gorgeous idea and I wanted to have it for Javascript as well.The only problem was that two packages, named thank and thanks, already exist on NPM and I needed to find something else because, you know, naming things is actually important.Well, it turned out that the ancient word in English to say thank is thanc (or thancian): I liked it, so I chose it.
It was Saturday, December 23, few minutes past midnight when I started coding.Firstly, I designed the workflow of thanc, step by step:
It was quite simple and at 4:00 am I was able to commit the very first working prototype**.**I didn’t expect that: I missed those wonderful nights, spent working on pet projects, when I was studying at the university. Great times!But suddenly, it happened! I was thrilled and galvanised!
Now that I’m writing, it’s the 31st of December, 8 days, 53 commits, 19 releases later.thanc evolved quickly but the workflow is quite the same.It supports both basic and user token authentications and it continues to rely on package-lock.json: if it doesn’t exist, thanc generates a temporary one on the fly, so even older projects built with Node.js 0.10 can be thanked.thanc is also transpiled to ES5 so it can be ran with older versions of Node.js: in fact, the source code is written in plain ES6+.chalk has been used to make it more user friendly and funny, like the vast usage of emojis: elm-thanks inspired me a lot 👊
I think the most important characteristic of thanc is the capability to thank the whole dependency tree and not just the first level defined inside the package.json manifest.In fact, when thanc is launched against a project, it scans the package-lock.json file, parsing every dependency, eventually reaching the tree leaves (those nodes without dependencies).
The very first user of thanc was me and not just for testing but also because I needed it.I’ve been working with Node.js since version 0.10 and I’ve accumulated so many projects that it would be impossible for me starring all the dependencies and sub-dependencies listed inside the many package.json files.Before starting with thanc, I’ve had 1291 starred repos on Github (collected in several years): then, 3294.
2000 stars in few days… astonishing 😲I think you’ll notice how many packages your repos are using and maybe just for a very tiny part: yep, sometimes is just our fault.
Anyway, thanc is quite simple to use 🙌Just install it with NPM:
$ npm i -g thanc
Create a new user token on your Github account, then put it into an environment variable called GITHUB_TOKEN and you’re done:
$ export GITHUB_TOKEN=<your_github_token>$ thanc
The very first thing you can do to contribute is to thank thanc itself:
$ thanc --me
thanc is open source and I’m sure you’ve plenty of great ideas to share and to propose: so, don’t forget to PR and to raise new issues!
If you enjoyed this article, please 👏 and share it with your mates 🤘