{"name":"generify","version":"4.0.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":"^14.0.0","tap":"^14.0.0"},"dependencies":{"isbinaryfile":"^4.0.2","mkdirp":"^0.5.0","pump":"^3.0.0","split2":"^3.0.0","walker":"^1.0.6"},"gitHead":"677ae009b685e76e8a8e82aef745490a7bbe5b2f","_id":"generify@4.0.0","_nodeVersion":"12.13.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-ZJICgZ3saK5U9LGUpejq8wAsoH+Mzm6TbbWHwqU48Yujmorc8NT0wqO/n9uh/ngapDYcaJ00nivr4ITOY5X/zg==","shasum":"45cc730624c3ce113e0427d24ab9c08a633e65ba","tarball":"http://registry-npm.ywwl.com/generify/download/generify-4.0.0.tgz","fileCount":24,"unpackedSize":18235,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeAKGkCRA9TVsSAnZWagAAwNwP/1R0koC4btw798K0em6J\nKVuf6u0+TYVRJvoJvws21+W3ruw12AdmT0rHyvNivmq5GT0+uf+S7o51MN4c\nH8wyBxsx7Gvfj1KAwuz4VEjlWO0H7ZG3X29xrt+EU2BsCIg9UaXrXjZJ/kEN\nQ15CDiN5GRpiOMLRobTL2RRt5GX0GLPKOKoD8BV7OmYhHDZI+ROeB2Bbbxgb\nBNUBTxHPtNtNpuguvErGRmwbDOYHFFvDqD8awOkIXy9bwOl3KPZPe/E0Ujds\nmaVnwz89qb9hoiEoU1xeTkMsK6bL18f1kGoaCsYw04ZvjCxcCtrrmbR/Yjnu\nMr6TOllsvUAxljBKoEb0UsjpCly/DJaW7+G8DZNCzaiukNS1rPzY/XYLDLgW\n76w0ZKNbBI912xh8gqk8pf9inhI0lzGGbu1wYz1narHZRFS6OyE4qza5boc+\n0OKhxNphAZ5dm5e0UU4uVOlSlzu6soaE0o/1TS6VkJ3w0jvGYmh1Wz/70Ehv\nexj6dyDGmRMmjwmG6YYitd0G+XyTsgdcIwbXRImVq5qMTPoy/88hXxM/kITu\n168FCCIrZRoxoHLsLSZsI8Hw3WycsOuioxVPh4Jc4IAprQaEiS6sqlJprVX/\nQJFDTSpd6YiYHRvu9zsJBQhqmPwLrE2U1UTaRwM++kQnIYT5/GAWSe2SRdHF\n2xQv\r\n=LVnP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICYIbNizNWdxgHXuXrprkHIQCnzpowmfaHCUsbTPyMJRAiEAqRS2pOq4nQSJJS38yttIB8NN9KsARioln8eFHks6YV8="}],"size":10122,"noattachment":false,"key":"/generify/-/generify-4.0.0.tgz"},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/generify_4.0.0_1577099683567_0.8485504750976396"},"_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":1577099683795,"_cnpm_publish_time":1577099683795,"dist-tags":{"latest":"4.2.0"}}