{"id":20551477,"url":"https://github.com/generate/generate-target","last_synced_at":"2026-04-20T01:35:12.224Z","repository":{"id":57246209,"uuid":"63647164","full_name":"generate/generate-target","owner":"generate","description":"Generate the files in a declarative \"target\" configuration.","archived":false,"fork":false,"pushed_at":"2016-07-19T19:53:01.000Z","size":16,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-18T08:19:00.023Z","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-07-19T00:46:55.000Z","updated_at":"2017-12-27T13:23:57.000Z","dependencies_parsed_at":"2022-08-24T16:10:50.639Z","dependency_job_id":null,"html_url":"https://github.com/generate/generate-target","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generate%2Fgenerate-target","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generate%2Fgenerate-target/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generate%2Fgenerate-target/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generate%2Fgenerate-target/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/generate","download_url":"https://codeload.github.com/generate/generate-target/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242157191,"owners_count":20081037,"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":[],"created_at":"2024-11-16T02:31:24.086Z","updated_at":"2026-04-20T01:35:07.187Z","avatar_url":"https://github.com/generate.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# generate-target [![NPM version](https://img.shields.io/npm/v/generate-target.svg?style=flat)](https://www.npmjs.com/package/generate-target) [![NPM downloads](https://img.shields.io/npm/dm/generate-target.svg?style=flat)](https://npmjs.org/package/generate-target) [![Build Status](https://img.shields.io/travis/generate/generate-target.svg?style=flat)](https://travis-ci.org/generate/generate-target)\n\nPlugin for automatically creating tasks from declarative `target` configurations. Works with generate, assemble, verb, or any other base application with plugin support.\n\n## Usage\n\nCan be used with any [base](https://github.com/node-base/base) application, including [assemble](https://github.com/assemble/assemble), [generate](https://github.com/generate/generate), and [update](https://github.com/update/update).\n\n```js\nvar target = require('generate-target');\n```\n\n## Example\n\n```js\nvar Base = require('base');\nvar targets = require('base-target');\nvar app = new Base({isApp: true}); \napp.use(targets());\n\n// create a target\napp.target('abc', {\n  src: 'templates/*.hbs',\n  dest: 'site',\n});\n\n// get a target\napp.target('abc')\n  .generate({cwd: 'fo'}) // build the files in a target\n  .on('error', console.error)\n  .on('end', function() {\n    console.log('done!');\n  });\n```\n\nSee the [expand-target](https://github.com/jonschlinkert/expand-target) library for additional information and API documentation.\n\n## API\n\n### [.targetSeries](index.js#L86)\n\nAsynchronously generate files from a declarative [target](https://github.com/jonschlinkert/expand-target) configuration.\n\n**Params**\n\n* `target` **{Object}**: Target configuration object.\n* `next` **{Function}**: Optional callback function. If not passed, `.targetStream` will be called and a stream will be returned.\n\n**Example**\n\n```js\nvar Target = require('target');\nvar target = new Target({\n  options: {cwd: 'source'},\n  src: ['content/*.md']\n});\n\napp.targetSeries(target, function(err) {\n  if (err) console.log(err);\n});\n```\n\n### [.targetStream](index.js#L124)\n\nGenerate files from a declarative [target](https://github.com/jonschlinkert/expand-target) configuration.\n\n**Params**\n\n* `target` **{Object}**: [target](https://github.com/jonschlinkert/expand-target) configuration object.\n* `returns` **{Stream}**: returns a stream with all processed files.\n\n**Example**\n\n```js\nvar Target = require('target');\nvar target = new Target({\n  options: {},\n  files: {\n    src: ['*'],\n    dest: 'foo'\n  }\n});\n\napp.targetStream(target)\n  .on('error', console.error)\n  .on('end', function() {\n    console.log('done!');\n  });\n```\n\n## Tasks\n\nIf the instance has a `task` method, a task is automatically created for each target.\n\n**Example**\n\n```js\napp.target('docs', {src: 'src/docs/*.md', dest: 'docs'});\napp.target('site', {src: 'src/site/*.hbs', dest: 'site'});\n\napp.build(['docs', 'site'], function(err) {\n  if (err) return console.log(err);\n  console.log('done!');\n});\n```\n\n**Disable auto-tasks**\n\nPass options to the plugin to disable this feature.\n\n```js\napp.use(targets({tasks: false}));\n```\n\n## About\n\n### Related projects\n\n* [base-scaffold](https://www.npmjs.com/package/base-scaffold): Base plugin that adds support for generating files from a declarative scaffold configuration. | [homepage](https://github.com/node-base/base-scaffold \"Base plugin that adds support for generating files from a declarative scaffold configuration.\")\n* [base-target](https://www.npmjs.com/package/base-target): Plugin that adds support for defining declarative `target` configurations that directly map to functional tasks. | [homepage](https://github.com/node-base/base-target \"Plugin that adds support for defining declarative `target` configurations that directly map to functional tasks.\")\n* [generate-scaffold](https://www.npmjs.com/package/generate-scaffold): Generate a scaffold from a declarative configuration. | [homepage](https://github.com/generate/generate-scaffold \"Generate a scaffold from a declarative configuration.\")\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\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](https://github.com/generate/generate-target/blob/master/LICENSE).\n\n***\n\n_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on July 19, 2016._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenerate%2Fgenerate-target","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenerate%2Fgenerate-target","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenerate%2Fgenerate-target/lists"}