{"id":17999516,"url":"https://github.com/ozum/measy","last_synced_at":"2026-04-12T09:49:41.513Z","repository":{"id":35008932,"uuid":"196037910","full_name":"ozum/measy","owner":"ozum","description":"Create files using any template engine as simple as possible. Just a template and a JSON/YAML file is enough.","archived":false,"fork":false,"pushed_at":"2023-01-06T02:01:09.000Z","size":1447,"stargazers_count":0,"open_issues_count":14,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-18T13:28:05.900Z","etag":null,"topics":["cli","creator","generator","node","template"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/ozum.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":"2019-07-09T15:39:47.000Z","updated_at":"2020-06-08T16:24:53.000Z","dependencies_parsed_at":"2023-01-15T11:55:44.932Z","dependency_job_id":null,"html_url":"https://github.com/ozum/measy","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozum%2Fmeasy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozum%2Fmeasy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozum%2Fmeasy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozum%2Fmeasy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ozum","download_url":"https://codeload.github.com/ozum/measy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247135147,"owners_count":20889421,"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":["cli","creator","generator","node","template"],"created_at":"2024-10-29T22:13:22.153Z","updated_at":"2026-04-12T09:49:36.485Z","avatar_url":"https://github.com/ozum.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# measy\n\nCreate files using any template engine as simple as possible. Just a template and a JSON/YAML file is enough.\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n\n- [Usage](#usage)\n- [Install](#install)\n- [Examples](#examples)\n  - [CLI Example](#cli-example)\n  - [Template Example](#template-example)\n- [Details](#details)\n  - [Front Matter](#front-matter)\n  - [CLI Options](#cli-options)\n  - [Custom Helpers \u0026 Filters](#custom-helpers--filters)\n  - [Supported Template Engines](#supported-template-engines)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n# Usage\n\n```\n$ npx measy README.hbs\n```\n\n# Install\n\n```\n$ npm install measy\n$ yarn add measy\n```\n\n**NOTE**: If you wish to use template engines other than `nunjucks` or `handlebars`, you must install the engines you wish to use: Add them to your package.json dependencies or install globally.\n\n# Examples\n\n## CLI Example\n\n- Create README.md from nunjucks template using `package.json` data:\n\n```\n$ measy README.njk\n```\n\n- without Front Matter, load data from `package.json` and `foo.yaml`\n\n```\n$ measy --context-files package.json,foo.yaml --out README.md README.njk\n```\n\n- Create a text file from handlebars template:\n\n```\n$ measy --context '{ codeName: \"Jay\" }' --out last.txt member.hbs\n```\n\n- Process all templates in a given directory:\n\n```\n$ measy --out docs my-templates\n```\n\n- Get help\n\n```\n$ measy --help\n```\n\n## Template Example\n\nTemplates support `Front Matter` data in YAML format.\n\n**README.njk**, **README.hbs** etc.\n\n```hbs\n---\ncontextFiles: \"package.json\"\ntargetExtension: \"md\"\n---\n# {{ package.name }}\n\n{{ package.description }}\n\n# Examples\n\n...some examples\n```\n\n# Details\n\n`measy` is simple command which creates files from templates combining data from JSON or JavaScript (or TypeScript with the help of `ts-node`) files. JSON files are parsed using [JSON5](https://json5.org/). JS files can be used by exporting an object with `module.exports` or `export default`.\n\n## Front Matter\n\nAny template file may contain a `YAML` front matter block. Data is processed by `measy`. The front matter must be the first thing in the file and must take the form of valid YAML set between triple-dashed (`---`) lines. Here is a basic example:\n\n```yaml\n---\ncontextFiles: \"package.json\"\nrootContextFiles: [\"some.json\", \"lib/my-data.js\"]\npartialDirs: [\"templates/partials\"]\nfunctionFiles: \"helper.js\"\nrootFunctionFiles: \"other-helper.js\"\ntargetExtension: \"md\"\n---\n\n```\n\n| Name              | Type              | Description                                                                                                                                        |\n| ----------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |\n| contextFiles      | `string|string[]` | js, ts, JSON5 or YAML file names or array of file names get context data for template. File name without extension is used as key in context data. |\n| rootContextFiles  | `string|string[]` | js, ts, JSON5 or YAML file name or array of file names to get context data for template. Result is merged into context directly.                   |\n| targetExtension   | `string`          | If there is no out attribute, sets filename extension of output file.                                                                              |\n| functionFiles     | `string|string[]` |  Files to get filter/helper functions prefixed with file name. i.e \"uc()\" func in \"path/helper.js\" becomes \"helperUc\" helper/filter.               |\n| rootFunctionFiles | `string|string[]` | Files to get filter/helper functions prefixed with file name. i.e \"uc()\" func in \"path/helper.js\" becomes \"uc\" helper/filter.                      |\n| partialDirs       | `string|string[]` | Path or array of paths relative to file to get partials from.                                                                                      |\n\n### Example\n\n**package.json**\n\n```json\n{\n  \"name\": \"some-module\",\n  \"version\": \"1.0.0\"\n}\n```\n\n```js\n// contextFiles: \"package.json\"\n{\n  someOtherData: \"Hello\",\n  package: {\n    name: \"some-module\",\n    version: \"1.0.0\"\n  }\n}\n\n// rootContextFiles: \"package.json\"\n{\n  someOtherData: \"Hello\",\n  name: \"some-module\",\n  version: \"1.0.0\"\n}\n\n```\n\n## CLI Options\n\n| Option Name                         | Description                                                                                                                                           |\n| ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `--template-extension (Required)`   | File extension of the templates.                                                                                                                      |\n| `--target-extension \u003cextension\u003e`    | File extension to be used in generated files. If template file has 'extension' meta data (frontmatter), extension in meta data has higher precedence. |\n| `--out \u003cpath\u003e`                      | File path (for templates) or directory path (for directory input) to generate files into. Defaults to \\\u003ctemplate path\u003e.                               |\n| `--context \u003cjson5\u003e`                 | Data to be passed to templates.                                                                                                                       |\n| `--context-files \u003cpaths\u003e`           | js, ts, JSON5 or YAML files to get data to be passed to templates under a key same as file name.                                                      |\n| `--root-context-files`              | js, ts, JSON5 or YAML files to get data to be passed to templates.                                                                                    |\n| `--partial-dirs \u003cpaths csv\u003e`        | Paths of directories which contains partial files.                                                                                                    |\n| `--function-files \u003cpaths csv\u003e`      | Files to get filter/helper functions prefixed with file name. i.e \"uc()\" func in \"path/helper.js\" becomes \"helperUc\" helper/filter.                   |\n| `--root-function-files \u003cpaths csv\u003e` | Files to get filter/helper functions prefixed with file name. i.e \"uc()\" func in \"path/helper.js\" becomes \"uc\" helper/filter.                         |\n| `--exclude-paths \u003cpaths csv\u003e`       | Paths to be excluded (for directory input only)                                                                                                       |\n| `--engine \u003cengine name\u003e`            | Template engine to be used. Supports engines supported by [consolidate](https://www.npmjs.com/package/consolidate).                                   |\n| `--include-meta`                    | Whether to include meta data in generated files.                                                                                                      |\n| `--debug`                           | Print stack trace in errors.                                                                                                                          |\n| `--silence`                         | Prevent console output.                                                                                                                               |\n\n## Custom Helpers \u0026 Filters\n\n`measy` allows you to use your own custom [handlebars helpers](http://handlebarsjs.com/#helpers) and [nunjucks filters](https://mozilla.github.io/nunjucks/api#custom-filters).\n\nEither export functions directly or export an object with names and functions from a JavaScript file.\n\nYou may add helpers/filters either using `--root-function-files` \u0026 `--function-files` CLI options or `rootFunctionFiles` \u0026 `functionFiles` front matter header in templates.\n\n**my-helper.js**\n\n```ts\nexport default {\n  ucFirst: (input) =\u003e input.charAt(0).toUpperCase() + input.slice(1),\n}\n```\n\n**my-helper.js**\n\n```ts\nexport function ucFirst(input) {\n  return input.charAt(0).toUpperCase() + input.slice(1);\n}\n\n```\n\n### Using Helpers/Filters with Front Matter\n\n```\n$ measy README.njk\n```\n\n**README.njk**\n\n```nunjucks\n---\nrootFunctionFiles: \"my-helper.js\"\n---\nHello {{  firstName | ucFirst  }}\n```\n\n**README.hbs**\n\n```handlebars\n---\nrootFunctionFiles: \"my-helper.js\"\n---\nHello {{  ucFirst firstName  }}\n```\n\n### Using Helpers/Filters with Front Matter\n\n```\n$ measy --root-function-files my-helper.js README.njk\n```\n\n**README.njk**\n\n```nunjucks\nHello {{  firstName | ucFirst  }}\n```\n\n**README.hbs**\n\n```handlebars\nHello {{  ucFirst firstName  }}\n```\n\n## Supported Template Engines\n\nThanks to [Consolidate.js](https://www.npmjs.com/package/consolidate)\n\n- [atpl](https://github.com/soywiz/atpl.js)\n- [bracket](https://github.com/danlevan/bracket-template)\n- [doT.js](https://github.com/olado/doT) [(website)](http://olado.github.io/doT/)\n- [dust (unmaintained)](https://github.com/akdubya/dustjs) [(website)](http://akdubya.github.com/dustjs/)\n- [dustjs-linkedin (maintained fork of dust)](https://github.com/linkedin/dustjs) [(website)](http://linkedin.github.io/dustjs/)\n- [eco](https://github.com/sstephenson/eco)\n- [ect](https://github.com/baryshev/ect) [(website)](http://ectjs.com/)\n- [ejs](https://github.com/mde/ejs) [(website)](http://ejs.co/)\n- [haml](https://github.com/visionmedia/haml.js)\n- [haml-coffee](https://github.com/9elements/haml-coffee)\n- [hamlet](https://github.com/gregwebs/hamlet.js)\n- [handlebars](https://github.com/wycats/handlebars.js/) [(website)](http://handlebarsjs.com/)\n- [hogan](https://github.com/twitter/hogan.js) [(website)](http://twitter.github.com/hogan.js/)\n- [htmling](https://github.com/codemix/htmling)\n- [jade](https://github.com/visionmedia/jade) [(website)](http://jade-lang.com/)\n- [jazz](https://github.com/shinetech/jazz)\n- [jqtpl](https://github.com/kof/jqtpl)\n- [JUST](https://github.com/baryshev/just)\n- [liquid](https://github.com/leizongmin/tinyliquid) [(website)](http://liquidmarkup.org/)\n- [liquor](https://github.com/chjj/liquor)\n- [lodash](https://github.com/bestiejs/lodash) [(website)](http://lodash.com/)\n- [marko](https://github.com/marko-js/marko) [(website)](http://markojs.com)\n- [mote](https://github.com/satchmorun/mote) [(website)](http://satchmorun.github.io/mote/)\n- [mustache](https://github.com/janl/mustache.js)\n- [nunjucks](https://github.com/mozilla/nunjucks) [(website)](https://mozilla.github.io/nunjucks)\n- [plates](https://github.com/flatiron/plates)\n- [pug (formerly jade)](https://github.com/pugjs/pug) [(website)](http://jade-lang.com/)\n- [QEJS](https://github.com/jepso/QEJS)\n- [ractive](https://github.com/Rich-Harris/Ractive)\n- [razor](https://github.com/kinogam/kino.razor)\n- [react](https://github.com/facebook/react)\n- [slm](https://github.com/slm-lang/slm)\n- [squirrelly](https://github.com/nebrelbug/squirrelly) [(website)](https://squirrelly.js.org)\n- [swig (maintained fork)](https://github.com/node-swig/swig-templates)\n- [swig (unmaintained)](https://github.com/paularmstrong/swig)\n- [teacup](https://github.com/goodeggs/teacup)\n- [templayed](http://archan937.github.com/templayed.js/)\n- [toffee](https://github.com/malgorithms/toffee)\n- [twig](https://github.com/justjohn/twig.js)\n- [underscore](https://github.com/documentcloud/underscore) [(website)](http://underscorejs.org/#template)\n- [vash](https://github.com/kirbysayshi/vash)\n- [velocityjs](https://github.com/julianshapiro/velocity) [(website)](http://velocityjs.org/)\n- [walrus](https://github.com/jeremyruppel/walrus) [(website)](http://documentup.com/jeremyruppel/walrus/)\n- [whiskers](https://github.com/gsf/whiskers.js)\n\n**NOTE**: If you wish to use template engines other than `nunjucks` or `handlebars`, you must install the engines you wish to use: Add them to your package.json dependencies or install globally.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozum%2Fmeasy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fozum%2Fmeasy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozum%2Fmeasy/lists"}