Generate LICENSE file for your project using Yeoman.
yo license
- 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
.
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: '[email protected]', // (optional) Owner's email
website: 'https://example.com', // (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.
- Apache 2 License
- MIT License
- Mozilla Public License 2.0
- BSD 2-Clause (FreeBSD) License
- BSD 3-Clause (NewBSD) License
- Internet Systems Consortium (ISC) License
- GNU AGPL 3.0 License
- GNU GPL 3.0 License
- Unlicense
- UNLICENSED
For Creative Commons Licenses (useful for media files, documentation and other creative works) you can use generator-license-cc.