{"name":"generify","version":"4.1.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.3.3","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":"a6c8e03d9aea47331e7e248e7e155fa44ef0c1e9","_id":"generify@4.1.0","_nodeVersion":"12.16.1","_npmVersion":"6.14.3","dist":{"integrity":"sha512-E35yDxzdptzGJIyhg620Nt0UMbO6nQaYm1/EzC083BQmVnu7No9uo9ELs0oKUvxoYwygv5e3lzJjGgh8iNhjQw==","shasum":"4a1986114696774d01e55eec9e91bfb3f45d63f0","tarball":"http://registry-npm.ywwl.com/generify/download/generify-4.1.0.tgz","fileCount":26,"unpackedSize":19014,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeexlmCRA9TVsSAnZWagAALi8P/1VhDMCUEpK7Jh9Gw/PR\nhOVr5zLLezT3I9PDQjIPXHYBoFverLzNG6GZ+VwmTbgdRocVrPaJdTZM/EHC\nkJ2HYYzs2VV2P1edezGSbQs2NRXLDdf3Io3y+zCy1YcCa0JhYCmPmu6t15zL\nhfeDQ3cC+M7gnRtKRZnJsgbmGEAGlzEXbR9DSDF72ecv0LIxCpu94shNuaHX\nQYcRyVtaxbuAUfIHuUs+T+bul2AQC9BB5dLaskQKn1H4PMkPPiYEgHnj3MHn\neuZ0D5Ee6WvH7duI57arfZJG/daovZ1lH4qWnMrD9t2i94KqXNXmWP7vUXyx\nzKvdAF9svRVWcRRm6AiHUVjErooiSjVUz29evcUmlwkgHd47LrnopfjmZmZF\nv4fBJ5rgnDMVsLJuT0SNOOtxOGQEYXfBDv7yuByZREH0p/SnV5d4rBhgBhnF\nI7vJ6pgvrxhZLlNDzXo9pntyMCvRwCYVxFrjvIZamIXBBFMoZnO2KW+dX+UR\npdqNlQqbdTEnwe+PXlg6/nT6hgTcvoiA2Z7Img3tcRBZvRebo1sC0aG7ttxz\nRI4QAhaVV265UiSDOfxrOY2ftgW9LH1DlN4YVg5KdMp5BaVmDkgpjTy9j6K4\nWNSjufOrA/SMN0YtwlUtZmRcigmjFzyv+/EBhw0a4NM/2UEVLFH30B1EKPfV\nvDlT\r\n=5gYe\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHA34qzIj609Gdu9jUFCjpn67sFQJuCur3xOvPFcIvs/AiAc9y7tZaa1SsAuei23w81wKeiAlRfGlap5eHb4efr0ow=="}],"size":10507,"noattachment":false,"key":"/generify/-/generify-4.1.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.1.0_1585125734269_0.6089190530960544"},"_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":1585125734361,"_cnpm_publish_time":1585125734361,"dist-tags":{"latest":"4.2.0"}}