{"id":13903101,"url":"https://github.com/howardroark/pollinate","last_synced_at":"2025-04-09T22:10:39.496Z","repository":{"id":21003405,"uuid":"24293986","full_name":"howardroark/pollinate","owner":"howardroark","description":"Template your base files and generate new projects from Git(Hub).","archived":false,"fork":false,"pushed_at":"2019-08-14T22:20:18.000Z","size":1763,"stargazers_count":228,"open_issues_count":9,"forks_count":14,"subscribers_count":6,"default_branch":"develop","last_synced_at":"2025-04-02T07:03:49.304Z","etag":null,"topics":["boilerplate","cli","generator","git","github","nunjucks","parsing","project","scaffolding","schema","skeleton","templates","yeoman"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/howardroark.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":"2014-09-21T15:02:11.000Z","updated_at":"2025-02-21T03:23:31.000Z","dependencies_parsed_at":"2022-07-31T05:48:00.632Z","dependency_job_id":null,"html_url":"https://github.com/howardroark/pollinate","commit_stats":null,"previous_names":["everysquare/pollinate"],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howardroark%2Fpollinate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howardroark%2Fpollinate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howardroark%2Fpollinate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howardroark%2Fpollinate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/howardroark","download_url":"https://codeload.github.com/howardroark/pollinate/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119294,"owners_count":21050755,"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":["boilerplate","cli","generator","git","github","nunjucks","parsing","project","scaffolding","schema","skeleton","templates","yeoman"],"created_at":"2024-08-06T22:01:37.216Z","updated_at":"2025-04-09T22:10:39.476Z","avatar_url":"https://github.com/howardroark.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","cli"],"sub_categories":[],"readme":"# ![Pollinate](https://raw.githubusercontent.com/howardroark/pollinate/develop/media/readme.png)\n\nGenerate a new project directly from Git(Hub) using a simple schema.\n\n[![npm version](https://badge.fury.io/js/pollinate.svg)](https://badge.fury.io/js/pollinate)  [![Build Status](https://travis-ci.org/howardroark/pollinate.svg?branch=develop)](https://travis-ci.org/howardroark/pollinate) [![Dependency Status](https://david-dm.org/howardroark/pollinate.svg)](https://david-dm.org/howardroark/pollinate)\n\n## What?\n\nIt is a command that takes a templated tree of files and generates them for new\nprojects using data defined by a simple schema. The data can define an output\n`name`, files to `discard`, files to `parse` with the data, and files to `move`\nor rename. The template can supply the default data, and that data can be\nextended for each project.  You can throw in any other data you'd like to be\npassed to the template context as well.\n\nAll templates are parsed with [Nunjucks](http://mozilla.github.io/nunjucks/) aka\n[Jinja](http://jinja.pocoo.org/) and [Twig](http://twig.sensiolabs.org/).\n\n## Why?\n\nWhen starting new projects the quickest way is often to just copy the last project and\nfiddle with it until it works. This can introduce many unwanted issues, like having one\nclient's name appear in place of the other's. This project's goal is to offer an elegant\nand efficient way of working with a base set of files that can be understood by looking\nat a single example.\n\n## Install\n\n```\n$ npm install -g pollinate\n```\n\n## An example\n\n```\n$ pollinate howardroark/webapp --name newproject --image alpine --description=\"A thing that does something.\"\n```\n[Skip to more examples...](#more-options)\n\n##### The GitHub sourced template\n\n```\n.\n├── PROJECT-README\n├── README.md\n├── Dockerfile\n├── project-name\n└── template.json\n```\n\n###### `template.json` (optional)\n\n```\n{\n  // Core schema\n  \"name\": \"webapp\",\n  \"parse\": [\n    \"PROJECT-README\",\n    \"Dockerfile\"\n  ],\n  \"discard\": [\n    \"README.md\",\n    \"template.json\"\n  ],\n  \"move\": [\n    { \"PROJECT-README\": \"README.md\" },\n    { \"project-name\": \"{{ name }}.txt\" }\n  ],\n  // Custom defaults\n  \"image\": \"debian\",\n  \"description\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\"\n}\n```\n\nYou can omit any or all of `discard`, `parse` and `move`. \n\n###### `PROJECT-README`\n\n```\n# {{ name }}\n\n{{ description }}\n```\n\n###### `Dockerfile`\n\n```\nFROM {{ image }}\n```\n\n##### The project data\n\n```\n{\n  \"name\": \"newproject\",\n  \"image\": \"alpine\",\n  \"description\": \"A thing that does something.\"\n}\n```\n\n##### The data after extending and parsing\n\n```\n{\n  \"name\": \"newproject\",\n  \"parse\": [\n    \"Dockerfile\",\n    \"PROJECT-README\"\n  ],\n  \"discard\": [\n    \"README.md\",\n    \"template.json\"\n  ],\n  \"move\": [\n    { \"PROJECT-README\": \"README.md\" },\n    { \"project-name\": \"newproject.txt\" }\n  ],\n  \"image\": \"alpine\",\n  \"description\": \"A thing that does something.\"\n}\n```\n\n##### The result\n\n```\n.\n└── newproject\n   ├── README.md\n   ├── newproject.txt\n   └── Dockerfile\n```\n\n###### `README.md`\n\n```\n# newproject\n\nA thing that does something.\n```\n\n###### `Dockerfile`\n\n```\nFROM alpine\n```\n\n## More options\n\nYou can specify template files as a local directory (.git will be removed)\n```\n$ pollinate ./template --name newproject --image ubuntu\n```\n\nYou can use any Git url (.git will be removed)\n```\n$ pollinate https://github.com/howardroark/webapp.git --name newproject --image ubuntu\n```\n\nYou can pass project data as a file\n```\n$ pollinate howardroark/webapp data.json\n```\n\nYou can pass project data as a JSON string\n```\n$ pollinate howardroark/webapp '{\"name\":\"newproject\",\"image\":\"alpine\",\"description\":\"A thing that does a thing.\"}'\n```\n\nYou can pass project data as a JSON endpoint\n```\n$ pollinate howardroark/webapp https://example.com/json/data\n```\n\nYou can generate from the default data in the template\n```\n$ pollinate howardroark/webapp\n```\n\nYou can override data as CLI options\n```\n$ pollinate howardroark/webapp data.json --name=alternate --image=ubuntu\n```\n\nYou can specify a command to run on completion\n```\n{\n  \"complete\": \"git init {{ name }}\"\n}\n```\n\nYou can supply user specific data each time with a `~/.pollen` defaults file\n\n```\n{\n  \"api_key\":\"secret\"\n}\n```\n\nYou can preserve the commit history from the skeleton project with the `--keep-history` CLI option or:\n\n```\n{\n  keepHistory: true\n}\n```\n\n## Filters\n\nYou can supply custom [Nunjucks `filter`](https://mozilla.github.io/nunjucks/templating.html#filters) functions (files must be included within template)\n\n```\n{\n  \"filters\": {\n    \"markdown\": \"filters/markdown.js\"\n  }\n}\n```\n\n##### `filters/markdown.js`\n\n```\nvar markdownParser = function() { ... }\n\nmodule.exports = function(markdownText) {\n  var html = markdownParser(markdownText)\n  return '\u003cdiv class=\"markdown\"\u003e'+html+'\u003c/div\u003e'\n}\n```\n\n## Parse\n\nAll `parse` paths are first passed to [globby](https://github.com/sindresorhus/globby)\n\n```\n{\n  \"parse\": [\"*\"]\n}\n```\n```\n{\n  \"parse\": [\n    \"*\",\n    \"!templates\"\n  ]\n}\n```\n\n## Merge\n\nYou can specify `.json` files to merge\n\n#### `package.json`\n```json\n{\n  \"name\": \"@howardroark/webapp\",\n  \"version\": \"1.0.0\",\n  \"description\": \"project for testing pollinate with merge\",\n  \"main\": \"index.js\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/howardroark/webapp.git\"\n  },\n  \"author\": \"Andy Edwards\",\n  \"license\": \"ISC\",\n  \"bugs\": {\n    \"url\": \"https://github.com/howardroark/webapp/issues\"\n  },\n  \"homepage\": \"https://github.com/howardroark/webapp#readme\",\n  \"dependencies\": {\n    \"lodash\": \"^4.17.4\"\n  }\n}\n```\n\n#### `PROJECT-package.json`\n```json\n{\n  \"name\": \"@{{ organization }}/{{ name }}\",\n  \"version\": \"1.0.0\",\n  \"description\": \"{{ description }}\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/{{ organization }}/{{ name }}.git\"\n  },\n  \"author\": \"{{ author }}\",\n  \"bugs\": {\n    \"url\": \"https://github.com/{{ organization }}/{{ name }}/issues\"\n  },\n  \"homepage\": \"https://github.com/{{ organization }}/{{ name }}#readme\",\n}\n```\n\n#### `template.json`\n```json\n{\n  \"name\": \"webapp\",\n  \"description\": \"project for testing pollinate with merge\",\n  \"organization\": \"howardroark\",\n  \"author\": \"Andy Edwards\",\n  \"parse\": [\n    \"PROJECT-package.json\"\n  ],\n  \"merge\": [\n    [\"package.json\", \"PROJECT-package.json\"]\n  ],\n  \"discard\": [\n    \"PROJECT-package.json\"\n  ]\n}\n```\n\n#### command\n```\npollinate howardroark/webapp#merge-test --name myapp --description 'my new app' --organization myorg --author Me\n```\n\nThis will overwrite `package.json` with the contents of `package.json` and `PROJECT-package.json` merged with\n`lodash.merge`.  This is useful when you want to keep template variables out of `package.json`, since they would cause\ncertain `npm` commands to fail.\n\n#### Resulting `package.json`\n```json\n{\n  \"name\": \"@myorg/myapp\",\n  \"version\": \"1.0.0\",\n  \"description\": \"my new app\",\n  \"main\": \"index.js\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/myorg/myapp.git\"\n  },\n  \"author\": \"Me\",\n  \"license\": \"ISC\",\n  \"bugs\": {\n    \"url\": \"https://github.com/myorg/myapp/issues\"\n  },\n  \"homepage\": \"https://github.com/myorg/myapp#readme\",\n  \"dependencies\": {\n    \"lodash\": \"^4.17.4\"\n  }\n}\n```\n\n### Thanks\n\n- [@binhood](https://dribbble.com/binhood) for the fantastic work on the logo!\n- [@jedwards1211](https://github.com/jedwards1211) for the handy object `merge` option :)\n- [@ben657](https://github.com/ben657) for refactoring a bunch of stuff :o\n\n[0]: https://img.shields.io/badge/stability-stable-green.svg?style=flat-square\n[1]: https://nodejs.org/api/documentation.html#documentation_stability_index\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhowardroark%2Fpollinate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhowardroark%2Fpollinate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhowardroark%2Fpollinate/lists"}