DEV Community

T. Paul
T. Paul

Posted on

The easiest way to add a license file to your project

Adding a license file to your project is a good practice. It helps others understand how they can use your code and what are the limitations. In this article, we will see how to add a license file to your project in the easiest way possible using the @katistix/license-cli package.

View the original blog post on my site

What is a license file? 🤔

A license file is a file that contains the terms and conditions for how others can use, modify, and distribute your code. It is a good practice to include a license file in your project, especially if you are planning to share it with others.

What is @katistix/license-cli?

@katistix/license-cli is a command-line tool that I built using Node.js and Typescript that helps you add a license file to your project in the easiest way possible. It is a simple and easy-to-use tool that can be used to add a license file to your project in just a few seconds.

For more information, you can check out the official GitHub repository: katistix/license-cli.

What licenses are supported right now?

As of the time of writing this article, @katistix/license-cli supports the following licenses:

  • MIT
  • Apache 2.0
  • GNU GPLv3
  • The Unlicense

With more licenses like BSD 3-Clause, BSD 2-Clause, Mozilla Public License 2.0, GNU LGPLv3 and many more to be added in the future.

You can see an up-to-date list of supported licenses on the official GitHub repository.

How to use @katistix/license-cli?

Prerequisites

Before you begin, you need to have Node.js and npm or yarn installed on your system. If you don't have them installed, you can download and install them from the official website: Node.js.

Step 1: Install the package

You can install the package using npm or yarn:

npm install -g @katistix/license-cli

# or

yarn global add @katistix/license-cli
Enter fullscreen mode Exit fullscreen mode

This will automatically install the package globally on your system.

Step 2: Add a license file to your project

Open your terminal and navigate to the root directory of your project. Then run the following command:

license <license_type>
Enter fullscreen mode Exit fullscreen mode

Replace <license_type> with the type of license you want to add to your project. For example, if you want to add the MIT license, you can run:

license mit
Enter fullscreen mode Exit fullscreen mode

This will create a LICENSE file in the root directory of your project with the MIT license text.

Step 3: Done!

That's it! You have successfully added a license file to your project using @katistix/license-cli. You can now share your project with others, and they will know how they can use your code.

💖 Support my projects

I love open source and I love programming. If you want to show your appreciation for my work, consider supporting me on the following platforms. This way I can continue to create awesome projects and share them with everyone. Thank you! ❤️

"Buy Me A Coffee"
Patreon
Ko-Fi

Top comments (0)