{"id":15092059,"url":"https://github.com/busterc/microgen","last_synced_at":"2026-04-02T01:50:53.033Z","repository":{"id":57296634,"uuid":"56731529","full_name":"busterc/microgen","owner":"busterc","description":":recycle: micro-generator for individual files, easy like sunday morning :sunrise:","archived":false,"fork":false,"pushed_at":"2018-08-25T21:49:14.000Z","size":58,"stargazers_count":88,"open_issues_count":1,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-26T01:41:29.231Z","etag":null,"topics":["generator","plop","scaffolding","templates","yeoman","yo"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/busterc.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-21T01:06:11.000Z","updated_at":"2024-01-21T16:01:59.000Z","dependencies_parsed_at":"2022-09-01T06:40:21.482Z","dependency_job_id":null,"html_url":"https://github.com/busterc/microgen","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/busterc%2Fmicrogen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/busterc%2Fmicrogen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/busterc%2Fmicrogen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/busterc%2Fmicrogen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/busterc","download_url":"https://codeload.github.com/busterc/microgen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248227919,"owners_count":21068575,"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":["generator","plop","scaffolding","templates","yeoman","yo"],"created_at":"2024-09-25T11:00:47.526Z","updated_at":"2026-04-02T01:50:53.007Z","avatar_url":"https://github.com/busterc.png","language":"JavaScript","readme":"# microgen [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url]\n\n\u003e micro-generator for individual files, easy like sunday morning\n\n## Yet another generator; how's it different?\n\n- any **file**, anywhere on disk can be a template\n  - no need to _install_ templates (like heavy weight project generators)\n- easiest way to fill in templates, using simple [handlebars placeholders](http://handlebarsjs.com/)\n- no data files required (like other handlebars cli's)\n  - you'll be prompted to fill in the data at runtime\n\n## Installation\n\n```sh\n$ npm install microgen # --global\n```\n\n## Usage\n\n```sh\n$ microgen --help\n\n  Usage: microgen \u003ctemplate-file\u003e [output-file]\n\n  Options:\n\n    -h, --help      show usage help\n    -p, --pipe      pipe output to stdout, instead of writing to file\n\n    output-file     if not specified, it will be $PWD/\u003ctemplate-file\u003e\n                    * if \u003ctemplate-file\u003e has an \".hbs\" extension,\n                      it will be removed from the output-file name\n\n```\n\n## How does it work?\n\nA microgen template is any **file** that can have [handlebars placeholders](http://handlebarsjs.com/). Microgen will scan the template for placeholders and prompt you to fill in a value for each one.\n\nSupported placeholders:\n- Variable `{{some-value}}`\n- Block `{{#some-boolean}}something{{else}}something else{{/some-boolean}}`\n  - `{{^}}` is the same as `{{else}}`\n  - You can use string literals, e.g. `{{#\"Are you happy\"}}great{{/\"Are you happy\"}}`\n- Comment `{{!some string to display when prompting}}`\n  - `{{!--x--}}` is the same as `{{!x}}`\n  - `{{!}}` just adds a newline to the display\n\nFor example, say you have a `package.json` _template_ file:\n\n```js\n{{!\n== Let the Good Times Roll ==\n}}\n{\n  \"name\": \"{{name}}\",\n  \"repository\": \"{{owner}}/{{name}}\",\n  \"description\": \"{{description}}\",\n{{!}}{{#\"Include Dependencies\"}}\n  \"dependencies\": {\n{{#assert-dotenv}}\n    \"assert-dotenv\": \"3.0.0\",{{/assert-dotenv}}{{!}}{{#\"Use a CLI Helper [meow, inquirer, commander]\"}}{{#meow}}\n    \"meow\": \"^3.0.0\",{{else}}{{#inquirer}}\n    \"inquirer\": \"^1.0.2\",{{^}}{{#commander}}\n    \"commander\": \"^2.9.0\",{{/commander}}{{/inquirer}}{{/meow}}{{/\"Use a CLI Helper [meow, inquirer, commander]\"}}\n  }\n{{/\"Include Dependencies\"}}\n}\n```\n\nMicrogen will prompt you like so:\n\n```sh\n\n\n== Let the Good Times Roll ==\n\nname: smile\nowner: busterc\ndescription: writes :) to stdout\n\nInclude Dependencies (Y/n): y\n  assert-dotenv (Y/n): y\n  \n  Use a CLI Helper [meow, inquirer, commander] (Y/n): y\n    meow (Y/n): n\n      inquirer (Y/n): n\n        commander (Y/n): y\n```\n\n...and the resulting output file will contain:\n\n```json\n{\n  \"name\": \"smile\",\n  \"repository\": \"busterc/smile\",\n  \"description\": \"writes :) to stdout\",\n\n  \"dependencies\": {\n    \"assert-dotenv\": \"3.0.0\",\n    \"commander\": \"^2.9.0\",\n  }\n}\n```\n\n## Respect\n\n**microgen** was inspired by [`khaos`](https://github.com/segmentio/khaos)\n\n_If you need heavy weight project scaffolding generators, then look into [`plop`](https://github.com/amwmedia/plop) and [`yo`](https://github.com/yeoman/yo)_\n\n## License\n\nISC © [Buster Collings](https://about.me/buster)\n\n\n[npm-image]: https://badge.fury.io/js/microgen.svg\n[npm-url]: https://npmjs.org/package/microgen\n[travis-image]: https://travis-ci.org/busterc/microgen.svg?branch=master\n[travis-url]: https://travis-ci.org/busterc/microgen\n[daviddm-image]: https://david-dm.org/busterc/microgen.svg?theme=shields.io\n[daviddm-url]: https://david-dm.org/busterc/microgen\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbusterc%2Fmicrogen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbusterc%2Fmicrogen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbusterc%2Fmicrogen/lists"}