First CLI tool with NodeJS
Introduction
Briefly speaking, NodeJS is like using JS on back-end stuff. Its really cooooooool and exctied for every JS developer !!!
I just started to learn Node, and in order to learn it better, I made a small cli tool for myself, it’s quit helpful actually.
Meet Baby
I named this tool as ‘baby’ with a lot of reasons… :)
What it can do ? It can do a lot and also the power of it is increasing everyday :) since I always put my repeatly work together and build a command for that :)
Here list a few of them:
- edit: you can set your favorite editor in the config file, and then you can use
baby e file_name
to edit it, why you want to do that? why not just use my favorite editor? Because baby can monitor your changes!!! And if you enable the ‘global summary’, it can record all you modifications and tell you how many changes you made in total :); - ssh: this is just for myself, since I always need to log in my aws server or digital ocean server with a pem file a secret settings, so I wrote this and made it simple(with short names);
- npm: I love npm! And also I use yeoman to build my webapp workflow, one thing is that as time goes on, you will find that all you modules will become outdated or not the latest version, so I used a script to loop over all outdated packages and updated them to wanted version or to latest version;
- tool: this is a collection of small commands, like the only one I have now is print the structure of the files under the current path;
- todo: I always made a todo app when I first learn some new languages or frameworks, so I did again for node, you can add, edit, mark as done or mark as undone and also clean or empty the tasks list, next I will make a webpage for it using angularJS since I am learning that now :)
- serve: will create a server with current path and look for the index.html file by default;
- cdn: since I am a web developer, so I always need to search the JS modules or plugins, so I download all the names and links from the cdnjs, and build a trie tree for the names, now I can just use
baby cdn name
to show the matches and links;
….
There are and will be a lot new features added to my baby, you can check it out from my github - baby
Bye
Next post I will talk about how to make a cli tool for yourself with nodejs. :)