Giter Site home page Giter Site logo

generate / generate-license Goto Github PK

View Code? Open in Web Editor NEW
86.0 6.0 10.0 950 KB

Generate a license file from the command line when Generate is installed globally, or use this generator as a plugin or sub-generator in your own generator project.

License: MIT License

JavaScript 100.00%
license mit generate generator scaffolder scaffolding scaffold yeoman yo project init create template

generate-license's Introduction

Generate a license file. Choose any of the licenses supported by https://github.com/github/choosealicense.com.

generate-license

NPM version NPM monthly downloads Build Status

generate-license demo

(TOC generated by verb using markdown-toc)

Install

To run this generator from the command line you must install both generate and generate-license:

# install generate and generate-license
$ npm install --global generate generate-license
# install only generate-license
$ npm install --global generate-license

Generate a license

Use generate's CLI to write a license file to the current working directory:

# prompts you to choose a license to generate
$ gen license

The file is automatically named according to preferences defined at GitHub's choosealicense.com repository (usually it's LICENSE, but not always. See the license files in that repository for more details).

Specify the license to generate

If you don't want to be prompted, you can specify the license up front:

$ gen license:<license name>
# example
$ gen license:mit

Specify output directory

# write a license file to "some-folder/LICENSE"
$ gen license -d some-folder

API

Visit generate's documenatation to learn how to use this generator as a plugin or sub-generator.

Getting started

Install

Installing the CLI

To run the readme generator from the command line, you'll need to install Generate globally first. You can do that now with the following command:

$ npm install --global generate

This adds the gen command to your system path, allowing it to be run from any directory.

Install generate-license

Install this module with the following command:

$ npm install --global generate-license

CLI

Run this generator's default task with the following command:

$ gen readme

What you should see in the terminal

If completed successfully, you should see both starting and finished events in the terminal, like the following:

[00:44:21] starting ...
...
[00:44:22] finished ✔

If you do not see one or both of those events, please let us know about it.

Help

To see a general help menu and available commands for Generate's CLI, run:

$ gen help

Available tasks

All available tasks for this generator.

The default task prompts you to choose the LICENSE to generate. All licenses from github/choosealicense.com are available.

Example

$ gen license
$ gen license --dest ./docs
# or
$ gen license:choose
$ gen license:choose --dest ./docs

Visit Generate's documentation for tasks.

Next steps

Running unit tests

It's never too early to begin running unit tests. When you're ready to get started, the following command will ensure the project's dependencies are installed then run all of the unit tests:

$ npm install && test

Publishing your generator

If you're tests are passing and you're ready to publish your generator to npm, you can do that now with the following command:

Are you sure you're ready?!

Let's go!

$ npm publish

About

What is "Generate"?

Generate is a command line tool and developer framework for scaffolding out new GitHub projects using generators and tasks.

Answers to prompts and the user's environment can be used to determine the templates, directories, files and contents to build. Support for gulp, base and assemble plugins, and much more.

For more information:

Related projects

  • generate-eslint: Generate a new .eslintrc.json or .eslintignore file from a pre-defined or user-defined template. Can be… more | homepage
  • generate-install: Generator that automatically detects the dependencies or devDependencies to install based on the templates or… more | homepage
  • generate-package: Generate a package.json from a pre-defined or user-defined template. This generator can be used from… more | homepage

Community

Bigger community means more plugins, better support and more progress. Help us make Generate better by spreading the word:

  • Show your love by starring the project
  • Tweet about Generate. Mention using @generatejs, or use the #generatejs hashtag
  • Get implementation help on StackOverflow with the generatejs tag
  • Discuss Generate with us on Gitter
  • If you publish a generator, to make your project as discoverable as possible, please add the unique keyword generategenerator to your project's package.json.

Contributors

Commits Contributor
78 jonschlinkert
10 pointnet
4 doowb

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on October 17, 2017.

generate-license's People

Contributors

doowb avatar jonschlinkert avatar pointnet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

generate-license's Issues

year is not defined

[master●] % gen license
[03:56:28] starting generate
[03:56:29] ✔ running tasks: [ 'license' ]
[03:56:29] starting license 
[03:56:29] starting license:default task 
[03:56:29] starting license:license task 
[03:56:29] starting license 
[03:56:29] starting license:choose task 
? Choose the license to generate license-mit
[03:56:31] starting license 
{ ReferenceError: year is not defined
    at eval (engine.templateSources[1]:9:11)
    at renderSync (/home/jamen/.nvm/versions/node/v6.5.0/lib/node_modules/generate-license/node_modules/engine-base/index.js:135:12)
    at render (/home/jamen/.nvm/versions/node/v6.5.0/lib/node_modules/generate-license/node_modules/engine-base/index.js:173:14)
    at /home/jamen/.nvm/versions/node/v6.5.0/lib/node_modules/generate/node_modules/engine-cache/index.js:244:7
    at Object.engineRender [as render] (/home/jamen/.nvm/versions/node/v6.5.0/lib/node_modules/generate/node_modules/engine-cache/index.js:280:7)
    at /home/jamen/.nvm/versions/node/v6.5.0/lib/node_modules/generate/node_modules/templates/lib/plugins/render.js:313:16
    at /home/jamen/.nvm/versions/node/v6.5.0/lib/node_modules/generate/node_modules/base-routes/index.js:168:9
    at /home/jamen/.nvm/versions/node/v6.5.0/lib/node_modules/generate/node_modules/base-routes/index.js:168:9
    at /home/jamen/.nvm/versions/node/v6.5.0/lib/node_modules/generate/node_modules/en-route/lib/index.js:576:15
    at next (/home/jamen/.nvm/versions/node/v6.5.0/lib/node_modules/generate/node_modules/en-route/lib/index.js:161:14)
  files: [ <File "LICENSE" <Buffer 54 68 65 20 4d 49 54 20 4c 69 63 65 6e 73 65 20 28 4d 49 54 29 0a 0a 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 3c 25 3d 20 79 65 61 72 20 25 3e 20 3c ... >> ],
  handled: [ <File "LICENSE" <Buffer 54 68 65 20 4d 49 54 20 4c 69 63 65 6e 73 65 20 28 4d 49 54 29 0a 0a 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 3c 25 3d 20 79 65 61 72 20 25 3e 20 3c ... >> ],
  view: <File "LICENSE" <Buffer 54 68 65 20 4d 49 54 20 4c 69 63 65 6e 73 65 20 28 4d 49 54 29 0a 0a 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 3c 25 3d 20 79 65 61 72 20 25 3e 20 3c ... >>,
  path: '/home/jamen/.nvm/versions/node/v6.5.0/lib/node_modules/generate-license/templates/LICENSE' }

After choosing MIT.

Generating GPLv3 license leaves placeholder fields verbatim

Hello,

When generating a gpl3 LICENSE file, it's contents contain the following blocks (lines 634 and 655):

    {one line to give the program's name and a brief idea of what it does.}
    Copyright (C) {year}  {name of author}
    {project}  Copyright (C) {year}  {fullname}
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

I think this tool should ask me for these values and populate them in my stead.

generate-license version 1.0.0, as reported by my package lock.

Windows Gen-License Failed

Specifications

OS: Windows
Shell: PowerShell
Terminal Emulator: Windows Terminal
nvm version: 1.1.12
nodejs version: [lts] 20.11.0

Replicate

npm install -g generate generate-license
gen readme

image

Copyright License

Didn't find any "all rights reserved" license template here.

Maybe smth like that?

All Rights Reserved

Copyright (c) ${year} ${owner}

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Not working with npx

Instead of installing anything globally, I've moved to use npx which comes with npm 5, which is default with node 8

Expected this to work:

$ npx -p generate -p generate-license gen license

Instead I get this error trace

$ npx -p generate -p generate-license gen license
npx: installed 1432 in 18.068s
[14:41:45] starting generate
[14:41:45] ✔ running tasks: [ 'license' ]
Error: Cannot find generator: "license" in "/home/grahamm/<project_dir>"
    at Generate.<anonymous> (/home/grahamm/.npm/_npx/7206/lib/node_modules/generate/node_modules/base-generators/index.js:499:18)
    at iterate (/home/grahamm/.npm/_npx/7206/lib/node_modules/generate/node_modules/async-each-series/index.js:8:5)
    at Function.module.exports (/home/grahamm/.npm/_npx/7206/lib/node_modules/generate/node_modules/async-each-series/index.js:20:3)
    at Generate.generate (/home/grahamm/.npm/_npx/7206/lib/node_modules/generate/node_modules/base-generators/index.js:492:15)
    at /home/grahamm/.npm/_npx/7206/lib/node_modules/generate/node_modules/base-generators/index.js:475:18
    at iterate (/home/grahamm/.npm/_npx/7206/lib/node_modules/generate/node_modules/async-each-series/index.js:8:5)
    at Function.module.exports (/home/grahamm/.npm/_npx/7206/lib/node_modules/generate/node_modules/async-each-series/index.js:20:3)
    at Generate.generate (/home/grahamm/.npm/_npx/7206/lib/node_modules/generate/node_modules/base-generators/index.js:474:24)
    at Generate.generate (/home/grahamm/.npm/_npx/7206/lib/node_modules/generate/node_modules/base-generators/index.js:463:23)
    at /home/grahamm/.npm/_npx/7206/lib/node_modules/generate/bin/generate.js:117:11

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.