{"name":"generify","version":"4.2.0","description":"A reusable project generator","main":"generify.js","scripts":{"test":"standard | snazzy && tap --no-esm --no-ts --no-jsx test/*.js"},"bin":{"generify":"generify.js"},"repository":{"type":"git","url":"git+https://github.com/mcollina/generify.git"},"keywords":["project","generator","module"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/generify/issues"},"homepage":"https://github.com/mcollina/generify","devDependencies":{"pre-commit":"^1.2.2","rimraf":"^3.0.0","snazzy":"^8.0.0","standard":"^16.0.0","tap":"^14.0.0"},"dependencies":{"isbinaryfile":"^4.0.2","pump":"^3.0.0","split2":"^3.0.0","walker":"^1.0.6"},"gitHead":"2287238739e9c374c43ed59fd64f4a2f6016cdb2","_id":"generify@4.2.0","_nodeVersion":"12.20.0","_npmVersion":"6.14.10","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"integrity":"sha512-b4cVhbPfbgbCZtK0dcUc1lASitXGEAIqukV5DDAyWm25fomWnV+C+a1yXvqikcRZXHN2j0pSDyj3cTfzq8pC7Q==","shasum":"19416c3e956a5ec3c6f205ddeaf261e1f258a97b","tarball":"http://registry-npm.ywwl.com/generify/download/generify-4.2.0.tgz","fileCount":34,"unpackedSize":20141,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf91MeCRA9TVsSAnZWagAA2CoQAKAnNL7YFceJf5b4hDY2\neTRkdBCLBajiwoeQzhpstFxCckxlNMv9XYP7j98zB7BK9Bkq+FLWZArSRong\nC7db15m4ZReJ0A62gVmx/woNKbjFYCeHWsnZN33Agvl75pb8LHUM3x5nkgtg\nAubMub6NeKFJ0XW82qHjGzD3ZI9R+jZXd+bTL/dKFtzKUP7onk4opFdeAGA9\ny+LSkQIqTsS2t/1FQAYDRzXm52byu+mmmoPIJDj76Sbt7tjq/O4GPUyk/4VM\nh9n+gF2bQiXE8HiWlSkXRazXhFMnjnw9R7oOSK94iLxLff/YO3HKPQd8QAiM\nOg1qMDL71tcDwnQ4zOYWpw5MQee3PC5ewli8rNZ4WiRbtj4XwQmuMsjfFJk+\nfuWeGcMnlT9zyclfZzcZ8WeSTJEOjlUoGXYX+rRs4vETUfRz7fW6iFADytJG\nRgE7ZTMLLLRYg5OabsAv8oZ8XlzbHq4dhNE53CBGlap02OH3s0eZBFTuSsGW\nPYPX/iDCHx1sdaRY3mvdJQquFDbdCzoM2jQCrWzUD5sk5DRH8xDBsaFkA8E3\n+AOeVaN/VhH7hGCrUNOlhyhN5F2O91Ltl222zmxKKqHli8LF7v4iKDXSgSLt\nyU7Yns+hCNLT6CmPNCdly3yAXQP+E1ELqggsA18b865nlCg1rMlRb5C0Y1gS\nwtiZ\r\n=5Fq2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF8gFNuBSPYPY9NiZltM0BqZ4Wjq/e/scEXkKKBdXT9UAiByy4CEA49pTGUHYixkt/cC9SSopYGcbSL6RRiAlWg4sQ=="}],"size":11045,"noattachment":false,"key":"/generify/-/generify-4.2.0.tgz"},"directories":{},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/generify_4.2.0_1610044189643_0.8320577901420618"},"_hasShrinkwrap":false,"readme":"# generify&nbsp;&nbsp;![Build Status](https://github.com/mcollina/generify/workflows/ci/badge.svg)\n\nA reusable project generator that _copies file recursively_, while\nreplacing keywords from passed data.\n\n## Example\n\n```js\n'use strict'\n\nconst generify = require('generify')\nconst source = './template'\nconst dest = '/tmp/generify-test'\nconst data = { hello: 'hello world' }\n\n// without notification\ngenerify(source, dest, data, function (err) {\n  if (err) {\n    console.log(err)\n  } else {\n    console.log('ok!')\n  }\n})\n\n// with notification\ngenerify(source, dest, data, onData, done)\n\nfunction onData (file) {\n  console.log('writing file')\n}\n\nfunction done (err) {\n  if (err) {\n    console.log(err)\n  } else {\n    console.log('ok!')\n  }\n}\n```\n\nThis will replace all the `__hello__` patterns found in all files\nwith the `'hello world'` string.\n\nIf the supplied `data` has a key `transforms`, with a hash of tranformation\nfunctions, then the found tokens will be used to run a corresponding\ntransform on the supplied data. Example:\n\n```js\nconst data = {\n  transforms: { foo: (data, context) => data.toUpperCase() },\n  foo: 'foo'\n}\n\n// __foo__ => foo_transform(data = 'foo') => 'FOO'\n```\n\nThe `context` object contains properties: `source` (input file path),\n`dest` (output file path), `key` (the matched key).\n\n### Files and Directories\n\nfiles and directories located in the template folder may also be replaced. File and folder names wrapped with `@` delimiters will be replaced.\n\n#### Example\n\nGiven a template with:\n\n`/template/@foo@/@bar@.txt`\n\nand data:\n\n```js\nconst data = {\n  foo: 'hello',\n  bar: 'world'\n}\n```\n\nThe outputted file will be:\n\n`<dest>/hello/world.txt`\n\n### `__` handling\n\nIf a file begins with `__` that will be automatically converted into a\n`.`. This is useful for generating `.gitignore` files.\n\nIf the supplied `data` has a key `copyAsNamed`, with an array of names, then\nthe filenames in that list will not be processed through this rule. Each file\nname in the list should not include a path,\ne.g. `['__do-not-replace-underscores.js']`.\n\n## Executable\n\n__generify__ also offers an executable that can be called with:\n\n  Usage: generify template destination [json file]\n\nWhere the json file contains the data to be replaced.\n\n## Acknowledgements\n\nThis project was kindly sponsored by [nearForm](http://nearform.com).\n\n## License\n\nMIT\n","publish_time":1610044189809,"_cnpm_publish_time":1610044189809,"dist-tags":{"latest":"4.2.0"}}