Add licenses using command line with NodeJS

Before releasing a new software you need to make sure the licenses for the application. We have many license types such as MIT, GNU , BSD etc. As we know there are many examples available on internet but, Its time consuming to find the correct license. Of course we need to create file then paste that text into file. But what if you can do that using single line command? Sound interesting? So today I will show you how you can  Add licenses using command line with  NodeJS.

Basically we are going to user legit module to generate license in any project.

What is legit?

legit is a command line application that allows you to automatically generate a LICENSE file for the current working directory that you are in.


You can use following command to install legit globally so that we can use it later in any project:

npm install --global @captainsafia/legit 

How to use legit?

We have to options in legit module:

  1. Listing available licenses
  2. Add license to project

We can use following command to list all available licenses:

 legit  list l 

It will print all available list something like this.

How we can Add licenses using command line  using NodeJS? NodeJS license generator module. Open source license generator.  Node module to generate license.

Now we can chose any license from available list for our project. We can use following command for add license:

legit put|p <license> [user] [year] 

So basically if you want to add MPL license it will be something like this:

legit put mpl-2.0 mohit 2017 

That’s all. Hope you enjoy the post. Keep sharing.


One Comment

  1. Amit March 14, 2017 Reply

Add a Comment

Your email address will not be published. Required fields are marked *