Skip to content


Repository files navigation


build GitHub package.json version Coverage Status NPM version

Generate LICENSE file for your project using Yeoman.

yo license

Getting started

  • Make sure you have yo installed: npm install -g yo
  • Install the generator: npm install -g generator-license
  • Run: yo license, enter your full name and choose a license

The generator will generate the LICENSE file and fill the license field of the package.json.

Compose with generator license in your own generator

generator-license can be easily embedded into your own generator using Yeoman composability.

First, install generator-license as a dependency of your own generator.

npm install --save generator-license

Then call it from your generator.

this.composeWith(require.resolve('generator-license'), {
  name: 'John Doe', // (optional) Owner's name
  email: '', // (optional) Owner's email
  website: '', // (optional) Owner's website
  year: '1945', // (optional) License year (defaults to current year)
  licensePrompt: 'Which license do you want to use?', // (optional) customize license prompt text
  defaultLicense: 'MIT', // (optional) Select a default license
  license: 'MIT', // (optional) Select a license, so no license prompt will happen, in case you want to handle it outside of this generator

All the options are optional; the generator will prompt for answers when information is not provided.

Supported licenses

For Creative Commons Licenses (useful for media files, documentation and other creative works) you can use generator-license-cc.


MIT License