{"name":"generify","version":"3.0.1","description":"A reusable project generator","main":"generify.js","scripts":{"test":"standard | snazzy && tap 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":{"osenv":"^0.1.0","pre-commit":"^1.2.2","rimraf":"^2.2.8","snazzy":"^7.1.1","standard":"^11.0.0","tap":"^12.0.0"},"dependencies":{"mkdirp":"^0.5.0","pump":"^3.0.0","split2":"^2.0.0","walker":"^1.0.6"},"gitHead":"6540af923d2a029e481cdea724afd1d9d8dc60a6","_id":"generify@3.0.1","_npmVersion":"6.1.0","_nodeVersion":"8.11.3","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"integrity":"sha512-LrG/ldzO1VPRUD7JA7yF9RQSLKOUrcdMbN7sj6O5aG5O99YxsAKMLZbk5Nb+YuG5qoMRsg8XswgkGXP5axcb6A==","shasum":"39b480099b0a6f22200e05d05df3fc1a0daf977e","tarball":"http://registry-npm.ywwl.com/generify/download/generify-3.0.1.tgz","fileCount":19,"unpackedSize":10921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbR5LICRA9TVsSAnZWagAAhO4P/RDVu3ci/6cMdAw+FQWY\nB+XOGiYxIV9WiwpUvzV/62cMSNnYWn7RXCp9LWAmnmgvntw+nKa9ibzW1KLr\ndsYxsqpKZcraYqpX1xIzdhWX0xTLvGhs7wwGz5nQOU0mEj2kVcUTtrK0SErj\nZwu+eIc3XCzbNOic/yYM7tA4yt6s1yrSpe1s2G17O2SCXWC2jpKVViloy5vf\nfxnUiJxs80KHO2pkVuzV14vQSZErDA+EstJ+w6HwsJtfGvnwbdcKBBcR1zq0\nokjpBiUpzZ4xbx6x3YYwOTAAzuuEwb5siD77z9bD18bwCXr+/ZpwsiEPu3z7\nbRS0O8sp23lKFPJ06cZf0QVY8AFQcBz1KgFN0OJddzcyAefK/yXu0U/CaCaT\nFLWjnx0PXoiS6npwTc3xm1hlpP+YizOI6Hdv5fsrbtFmr0iDyjoE6McobKcH\nfZAeZG9zcWdcQ8RwsSQC5TiJdIJ3+AsDEy3eAQA5+ZAg3Ga7QA02GFEQD/vm\n5/j/hQfQqPjHUdGg6+XX/puF0JWscyJ6yBrKhX0w64x2RT6mG0Gne9eg82p8\npzjQ7nV5WngJCBvS6YFtWAMnGbSe7gsisAiSCPFibZAR1hlNjQDmNVmK/w5X\nkVQ1F5k6H2NbfVM2aRAWnHpQAUxWvVP6HkdnSaHSImeWWUKVGkrC0FXox1Lv\nJjZb\r\n=mbRn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCDtJxK18Y+1dbH4MfvA/tdf2kHIphgKA62KdsAkh6rhwIgYbOJQNZTzOPrcv84oeTMSfsT03a58/3rNExwhsPDcA0="}],"size":4060,"noattachment":false,"key":"/generify/-/generify-3.0.1.tgz"},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/generify_3.0.1_1531417288769_0.7526186894750859"},"_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":1531417288916,"_cnpm_publish_time":1531417288916,"dist-tags":{"latest":"4.2.0"}}