{"id":20551412,"url":"https://github.com/generate/generate-node","last_synced_at":"2025-07-28T15:08:41.038Z","repository":{"id":57246153,"uuid":"57172951","full_name":"generate/generate-node","owner":"generate","description":"Generate a generic node.js project, with everything you need to begin writing code and easily publish the project to npm.","archived":false,"fork":false,"pushed_at":"2016-06-27T17:53:20.000Z","size":1096,"stargazers_count":9,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-28T01:41:08.587Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/generate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-27T01:13:19.000Z","updated_at":"2022-04-29T00:13:31.000Z","dependencies_parsed_at":"2022-08-24T16:10:50.630Z","dependency_job_id":null,"html_url":"https://github.com/generate/generate-node","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/generate/generate-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generate%2Fgenerate-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generate%2Fgenerate-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generate%2Fgenerate-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generate%2Fgenerate-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/generate","download_url":"https://codeload.github.com/generate/generate-node/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generate%2Fgenerate-node/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267534874,"owners_count":24103189,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T02:30:44.350Z","updated_at":"2025-07-28T15:08:40.998Z","avatar_url":"https://github.com/generate.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# generate-node [![NPM version](https://img.shields.io/npm/v/generate-node.svg?style=flat)](https://www.npmjs.com/package/generate-node) [![NPM downloads](https://img.shields.io/npm/dm/generate-node.svg?style=flat)](https://npmjs.org/package/generate-node) [![Build Status](https://img.shields.io/travis/generate/generate-node.svg?style=flat)](https://travis-ci.org/generate/generate-node)\n\nGenerate a node.js project, with everything you need to begin writing code and easily publish the project to npm.\n\n## TOC\n\n- [What is generate?](#what-is-generate)\n- [CLI](#cli)\n- [Usage as a sub-generator](#usage-as-a-sub-generator)\n- [Usage as a plugin](#usage-as-a-plugin)\n- [Tasks](#tasks)\n- [API](#api)\n  * [Install](#install)\n  * [Usage](#usage)\n- [Docs](#docs)\n  * [CLI](#cli-1)\n  * [Tasks](#tasks-1)\n  * [API](#api-1)\n- [Related projects](#related-projects)\n- [Contributing](#contributing)\n- [Building docs](#building-docs)\n- [Running tests](#running-tests)\n- [Author](#author)\n- [License](#license)\n\n_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_\n\n## What is generate?\n\nGenerate is a new, open source developer framework for rapidly initializing and scaffolding out new code projects, offering an intuitive CLI, and a powerful and expressive API that makes it easy and enjoyable to use.\n\nVisit the [getting started guide](https://github.com/generate/getting-started) or the [generate](https://github.com/generate/generate) project and documentation to learn more.\n\n## CLI\n\n**Installing the CLI**\n\nTo run the `node` generator from the command line, you'll need to install [generate](https://github.com/generate/generate) globally first. You can that now with the following command:\n\n```sh\n$ npm i -g generate\n```\n\nThis adds the `gen` command to your system path, allowing it to be run from any directory. Visit the [generate](https://github.com/generate/generate) project and documentation to learn more.\n\n**Run the `node` generator from the command line**\n\nOnce both [generate](https://github.com/generate/generate) and `generate-node` are installed globally, you can run the generator with the following command:\n\nRun the `node` generator from the command line:\n\n```sh\n$ gen node\n```\n\n## Usage as a sub-generator\n\nYou can use generate-node as a [sub-generator](https://github.com/generate/generate){docs/sub-generators}. See the [generate](https://github.com/generate/generate) docs for more details.\n\n```js\napp.register('foo', require('generate-node'));\n```\n\nThis adds the namespace `foo` to\n\n## Usage as a plugin\n\nExtend your generator with the features and settings of this generator.\n\n**Example**\n\n```js\napp.use(require('generate-node'));\n\n// use any task from `generate-node`!\napp.task('default', ['files']);\n```\n\n## Tasks\n\n### [mit](generator.js#L78)\n\nGenerate a `MIT` license file. Runs the `default` task from [generate-license](https://github.com/generate/generate-license).\n\n**Example**\n\n```sh\n$ gen node:mit\n```\n\n### [git](generator.js#L93)\n\nInitialize a git repository, and add files and first commit. Runs the `default` task from [generate-git](https://github.com/generate/generate-git).\n\n**Example**\n\n```sh\n$ gen node:git\n```\n\n### [mocha](generator.js#L107)\n\nGenerate a mocha unit test file. Runs the `default` task from [generate-mocha](https://github.com/generate/generate-mocha).\n\n**Example**\n\n```sh\n$ gen node:mocha\n```\n\n### [npm](generator.js#L121)\n\nInstall the latest `dependencies` and `devDependencies` in package.json.\n\n**Example**\n\n```sh\n$ gen node:npm\n```\n\n### [tasks](generator.js#L138)\n\nAsks you to choose which tasks to run.\n\n**Example**\n\n```sh\n$ gen node:tasks\n```\n\n### [prompt](generator.js#L156)\n\nPrompt the user and pass answers to rendering engine to use as context in templates. Specify questions to ask with the `--ask` flag. See [common-questions](https://github.com/generate/common-questions) for the complete list of available built-in questions.\n\n**Example**\n\n```sh\n$ gen node:prompt\n# ask all `author` questions\n$ gen node:prompt --ask=author\n# ask `author.name`\n$ gen node:prompt --ask=author.name\n```\n\n### [prompt-mocha](generator.js#L175)\n\nAsks if you'd like to generate mocha unit tests. Runs the `default` task from [generate-mocha](https://github.com/generate/generate-mocha).\n\n**Example**\n\n```sh\n$ gen node:prompt-mocha\n```\n\n### [prompt-git](generator.js#L189)\n\nAsks if you'd like to initialize a git repository (also does git `add` and first commit). If true the [first-commit](#first-commit) task is run.\n\n**Example**\n\n```sh\n$ gen node:prompt-git\n```\n\n### [prompt-npm](generator.js#L203)\n\nAsks if you'd like install the latest `devDependencies` in package.json. If true, the [npm](#npm) task is run.\n\n**Example**\n\n```sh\n$ gen node:prompt-npm\n```\n\n### [choices](generator.js#L218)\n\nAsks if you want to save your choices from user prompts and automatically use them without asking again the next time the generator is run. If you change your mind, just run `gen node:choices` and you'll be prompted again.\n\n**Example**\n\n```sh\n$ gen node:choices\n```\n\n### [post-generate](generator.js#L245)\n\nAsks if you want to use the same \"post-generate\" choices next time this generator is run. If you change your mind, just run `gen node:choices` and you'll be prompted again.\n\nIf `false`, the [prompt-mocha](#prompt-mocha), [prompt-npm](#prompt-npm), and [prompt-git](#prompt-git) tasks will be\nrun after files are generated then next time the generator is run.\nIf `true`, the [mocha](#mocha), [npm](#npm), and [git](#git) tasks will be run (and you will not\nbe prompted) after files are generated then next time the generator is run.\n\n**Example**\n\n```sh\n$ gen node:post-generate\n```\n\n### [project](generator.js#L290)\n\nGenerate a complete a node.js project, with all of the necessary files included.\n\n_(Note that this task does not initialize a [git](#git) repository, generate [mocha](#mocha)\nunit tests or install [npm](#npm) dependencies. If you want these things you can either\nrun the [default task](#default), or run the tasks individually.)_\n\n**Example**\n\n```sh\n$ gen node:project\n```\n\n### [default](generator.js#L315)\n\nGenerate a complete node.js project, then optionally install npm dependecies, mocha unit tests, and initialize a git repository.\n\n**Example**\n\n```sh\n$ gen node\n# or\n$ gen node:default\n```\n\n## API\n\nTo use this generator as a node.js module, as a plugin or sub-generator, you must first install the generator locally.\n\n### Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install generate-node\n```\n\n### Usage\n\nThen use in your project:\n\n```js\nvar node = require('generate-node');\n```\n\n**Use as a plugin**\n\nIn your [generate](https://github.com/generate/generate) project:\n\n```js\nvar generate = require('generate');\nvar app = generate();\n\napp.use(node);\n```\n\n**Use as a generator plugin**\n\nIn your [generate](https://github.com/generate/generate) generator:\n\n```js\nmodule.exports = function(app) {\n  app.use(node);\n};\n```\n\n**Use as a sub-generator**\n\nIn your [generate](https://github.com/generate/generate) generator:\n\n```js\nmodule.exports = function(app) {\n  // name the sub-generator whatever you want\n  app.register('foo', require('generate-node'));\n};\n```\n\n## Docs\n\n### CLI\n\n**Installing the CLI**\n\nTo run the `node` generator from the command line, you'll need to install [generate](https://github.com/generate/generate) globally first. You can do that now with the following command:\n\n```sh\n$ npm i -g generate\n```\n\nThis adds the `gen` command to your system path, allowing it to be run from any directory.\n\n**Help**\n\nGet general help and a menu of available commands:\n\n```sh\n$ gen help\n```\n\n**Running the `node` generator**\n\nOnce both [generate](https://github.com/generate/generate) and `generate-node` are installed globally, you can run the generator with the following command:\n\n```sh\n$ gen node\n```\n\nIf completed successfully, you should see both `starting` and `finished` events in the terminal, like the following:\n\n```sh\n[00:44:21] starting ...\n...\n[00:44:22] finished ✔\n```\n\nIf you do not see one or both of those events, please [let us know about it](../../issues).\n\n### API\n\nThis updater can also be used as a node.js library in your own updater. To do so you must first install generate-node locally.\n\n**Install**\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save generate-node\n```\n\n**Use as a plugin in your generator**\n\nUse as a plugin if you want to extend your own generator with the features, settings and tasks of generate-node, as if they were created on your generator.\n\nIn your `generator.js`:\n\n```js\nmodule.exports = function(app) {\n  app.use(require('generate-node'));\n\n  // specify any tasks from generate-node. Example:\n  app.task('default', ['node']);\n};\n```\n\n**Use as a sub-generator**\n\nUse as a sub-generator if you want expose the features, settings and tasks from generate-node on a _namespace_ in your generator.\n\nIn your `generator.js`:\n\n```js\nmodule.exports = function(app) {\n  // register the generate-node generator (as a sub-generator with an arbitrary name)\n  app.register('foo', require('generate-node'));\n\n  app.task('minify', function(cb) {\n    // minify some stuff\n    cb();\n  });\n\n  // run the \"default\" task on generate-node (aliased as `foo`), \n  // then run the `minify` task defined in our generator\n  app.task('default', function(cb) {\n    app.generate(['foo:default', 'minify'], cb);\n  });\n};\n```\n\nTasks from `generate-node` will be available on the `foo` namespace from the API and the command line. Continuing with the previous code example, to run the `default` task on `generate-node`, you would run `gen foo:default` (or just `gen foo` if `foo` does not conflict with an existing task on your generator).\n\nTo learn more about namespaces and sub-generators, and how they work, [visit the getting started guide](https://github.com/generate/getting-started).\n\n## Related projects\n\nYou might also be interested in these projects:\n\n* [generate](https://www.npmjs.com/package/generate): The Santa Claus machine for GitHub projects. Scaffolds out new projects, or creates any kind… [more](https://github.com/generate/generate) | [homepage](https://github.com/generate/generate \"The Santa Claus machine for GitHub projects. Scaffolds out new projects, or creates any kind of required file or document from any given templates or source materials.\")\n* [generate-git](https://www.npmjs.com/package/generate-git): Generator for initializing a git repository and adding first commit. | [homepage](https://github.com/generate/generate-git \"Generator for initializing a git repository and adding first commit.\")\n* [generate-license](https://www.npmjs.com/package/generate-license): Generate a license file for a GitHub project. | [homepage](https://github.com/generate/generate-license \"Generate a license file for a GitHub project.\")\n* [generate-mocha](https://www.npmjs.com/package/generate-mocha): Generate mocha test files. | [homepage](https://github.com/generate/generate-mocha \"Generate mocha test files.\")\n\n## Contributing\n\nThis document was generated by [verb-readme-generator](https://github.com/verbose/verb-readme-generator) (a [verb](https://github.com/verbose/verb) generator), please don't edit directly. Any changes to the readme must be made in [.verb.md](.verb.md). See [Building Docs](#building-docs).\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). Or visit the [verb-readme-generator](https://github.com/verbose/verb-readme-generator) project to submit bug reports or pull requests for the readme layout template.\n\n## Building docs\n\nGenerate readme and API documentation with [verb](https://github.com/verbose/verb):\n\n```sh\n$ npm install -g verb verb-readme-generator \u0026\u0026 verb\n```\n\n## Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm install -d \u0026\u0026 npm test\n```\n\n## Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)\n\n## License\n\nCopyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT license](LICENSE).\n\n***\n\n_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on June 15, 2016._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenerate%2Fgenerate-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenerate%2Fgenerate-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenerate%2Fgenerate-node/lists"}