{"id":20551396,"url":"https://github.com/generate/generate-install","last_synced_at":"2025-04-14T11:20:38.313Z","repository":{"id":57246117,"uuid":"61634940","full_name":"generate/generate-install","owner":"generate","description":"Generator that automatically detects the dependencies or devDependencies to install based on the templates or includes used. This can be used as a sub-generator or plugin in your own generator.","archived":false,"fork":false,"pushed_at":"2017-09-25T19:31:18.000Z","size":31,"stargazers_count":7,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T02:03:07.779Z","etag":null,"topics":["generate","generator","install","javascript","nodejs","npm","plugin"],"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-06-21T13:13:09.000Z","updated_at":"2022-09-13T09:23:28.000Z","dependencies_parsed_at":"2022-08-24T16:43:47.380Z","dependency_job_id":null,"html_url":"https://github.com/generate/generate-install","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generate%2Fgenerate-install","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generate%2Fgenerate-install/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generate%2Fgenerate-install/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generate%2Fgenerate-install/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/generate","download_url":"https://codeload.github.com/generate/generate-install/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248782273,"owners_count":21160717,"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","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":["generate","generator","install","javascript","nodejs","npm","plugin"],"created_at":"2024-11-16T02:30:37.012Z","updated_at":"2025-04-14T11:20:38.291Z","avatar_url":"https://github.com/generate.png","language":"JavaScript","readme":"# generate-install [![NPM version](https://img.shields.io/npm/v/generate-install.svg?style=flat)](https://www.npmjs.com/package/generate-install) [![NPM monthly downloads](https://img.shields.io/npm/dm/generate-install.svg?style=flat)](https://npmjs.org/package/generate-install)  [![NPM total downloads](https://img.shields.io/npm/dt/generate-install.svg?style=flat)](https://npmjs.org/package/generate-install) [![Linux Build Status](https://img.shields.io/travis/generate/generate-install.svg?style=flat\u0026label=Travis)](https://travis-ci.org/generate/generate-install) [![Windows Build Status](https://img.shields.io/appveyor/ci/generate/generate-install.svg?style=flat\u0026label=AppVeyor)](https://ci.appveyor.com/project/generate/generate-install)\n\n\u003e Generator that automatically detects the dependencies or devDependencies to install based on the templates or includes that are dynamically used by your generator. This can be used as a sub-generator or plugin in your own generator.\n\n## Table of Contents\n\n- [What is \"Generate\"?](#what-is-generate)\n- [How does generate-install work?](#how-does-generate-install-work)\n  * [1. middleware](#1-middleware)\n  * [2. prompt](#2-prompt)\n- [Tasks](#tasks)\n- [About](#about)\n  * [Related projects](#related-projects)\n  * [Contributing](#contributing)\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 command line tool and developer framework for scaffolding out new GitHub projects using [generators](https://github.com/generate/generate/blob/master/docs/generators.md) and [tasks](https://github.com/generate/generate/blob/master/docs/tasks.md).\n\nAnswers to prompts and the user's environment can be used to determine the templates, directories, files and contents to build. Support for [gulp](http://gulpjs.com), [base](https://github.com/node-base/base) and [assemble](https://github.com/assemble/assemble) plugins, and much more.\n\n**For more information**:\n\n* Visit the [generate project](https://github.com/generate/generate/)\n* Visit the [generate documentation](https://github.com/generate/generate/blob/master/docs/)\n* Find [generators on npm](https://www.npmjs.com/browse/keyword/generate-generator) (help us [author generators](https://github.com/generate/generate/blob/master/docs/micro-generators.md))\n\n## How does generate-install work?\n\nThis generator can be [installed](#install) as a dependency and registered with the `.use` method in your own generator.\n\n**Install**\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install generate-install\n```\n\n**Example usage**\n\nIn your own [generator](https://github.com/generate/generate/blob/master/docs/generators.md):\n\n```js\nmodule.exports = function(app) {\n  app.use(require('generate-install'));\n};\n```\n\nOnce registered, generate-install does two things:\n\n* [middleware](#middleware): Adds a middleware for getting dependencies to install\n* [prompt](#prompt): Adds a task for prompting the user to install the detected dependencies\n\n### 1. middleware\n\nAdds a `.postWrite` [middleware](https://github.com/generate/generate/blob/master/docs/middleware.md), which runs after a file is written to the file system to see if an `install` object was defined in [yaml front-matter](https://github.com/generate/generate/blob/master/docs/front-matter.md)).\n\n**Example**\n\nThis example shows a basic `gulpfile.js` template with front-matter that defines `gulp` as a dev dependency.\n\n```js\n---\ninstall:\n  devDependencies: ['gulp']\n---\nvar gulp = require('gulp');\n\ngulp.task('default', function(cb) {\n  // do task stuff\n  cb();\n});\n```\n\nIf the `install` object exists, the middleware will extract the `dependencies` and `devDependencies`, filtering out any deps that are already installed and listed in `package.json`.\n\nThis also works:\n\n```js\n---\ninstall: ['gulp']\n---\nvar gulp = require('gulp');\n\ngulp.task('default', function(cb) {\n  // do task stuff\n  cb();\n});\n```\n\nWhich is normalize to `{devDependencies: ['gulp']}`.\n\n### 2. prompt\n\nThe second thing this generator adds is an optional [task](#tasks) for prompting the user.\n\n**Example usage**\n\nRun after other tasks are finished:\n\n```js\napp.use(require('generate-install'));\napp.task('generate-stuff', function(cb) {\n  cb();\n});\n\napp.generate(['generate-stuff', 'install'], function(err) {\n  if (err) return console.log(err);\n});\n```\n\nThis task is optional, since the user can also install this generator globally and run is directly.\n\n**Example**\n\nIf your generate is named `foo`, the user can do this:\n\n```sh\ngen foo install\n```\n\n## Tasks\n\nVisit Generate's [task documentation](https://github.com/generate/generate/blob/master/docs/tasks.md).\n\n## About\n\n### Related projects\n\n* [generate-eslint](https://www.npmjs.com/package/generate-eslint): Generate a new `.eslintrc.json` or `.eslintignore` file from a pre-defined or user-defined template. Can be… [more](https://github.com/generate/generate-eslint) | [homepage](https://github.com/generate/generate-eslint \"Generate a new `.eslintrc.json` or `.eslintignore` file from a pre-defined or user-defined template. Can be used from the command line when installed globally, or as a plugin in your own generator.\")\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-package](https://www.npmjs.com/package/generate-package): Generate a package.json from a pre-defined or user-defined template. This generator can be used from… [more](https://github.com/generate/generate-package) | [homepage](https://github.com/generate/generate-package \"Generate a package.json from a pre-defined or user-defined template. This generator can be used from the command line when globally installed, or as a plugin or sub-generator in your own generator.\")\n* [generate-travis](https://www.npmjs.com/package/generate-travis): Generate a .travis.yml file to the cwd or specified directory. Install globally and run with… [more](https://github.com/generate/generate-travis) | [homepage](https://github.com/generate/generate-travis \"Generate a .travis.yml file to the cwd or specified directory. Install globally and run with generate's CLI, or use as a component in your own generator.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Running tests\n\nRunning 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:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on September 25, 2017._","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenerate%2Fgenerate-install","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenerate%2Fgenerate-install","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenerate%2Fgenerate-install/lists"}