{"bin":{"ts-creator":"bin/ts-creator"},"nyc":{"all":true,"exclude":["**/*.d.ts"],"include":["src/**/*.ts"],"reporter":["text","lcov"],"extension":[".ts"]},"dist":{"shasum":"3ea7a4feb0782c93afba74168107584407c29fe0","tarball":"https://registry.npmjs.org/ts-creator/-/ts-creator-1.2.0-8a3b6645.tgz","fileCount":23,"integrity":"sha512-aWitjL2v80upXLwu0/gPIMScsht7dVBbw6LV0xd29p+1zMwMj1ds+ip8fHSwBOag4ExCzZhB6IPag1hnkKcWHA==","signatures":[{"sig":"MEUCIQDJWydGNkGFz9TOdYAbIGeGOVKtNYFQWvCU2bnBFR9wAQIgUNTeZboRTs/O3pM6YNTPJsMr39f97aLBcAxXn9P5XII=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":22933207,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZSuJCRA9TVsSAnZWagAAXLAP+gPUbcVZwg9OLG7yjV4Z\nYf47EwGD7S4qBEht3JecYa8AQk7Li1xikALQhm+CCpxrIDDBf8NbHbstpmC/\n1io/Re1iRoPi1ZGSzk6In2IxkK0JBh4DrJG2b6hmmUiR0NSBnv/217RxkG69\ntidsgfDP5pAlelNQPHfiZoAu2taiQRoMTT1LuVIYoS/z3a2jC56Suy0oIHMR\nv5BfxqhBPu8kx6F6B/5c8abz2Tf2H183tRZzUnP2pX849uFNtkEBCO9BQF+F\noqPUk0K8E14IeGGCVx8N2IZmUWdfVUPDqhDmO3iYrryQ3yYH6IeQM8xLjATh\nrpGeeobtE0vdTR6j3noNZuQQMuL0Lhe62zsa9BI66ori0XfYwoxnatRDi46N\n08yBEv2bfXNLZa7siOscAptPltzuRRtt3kZVMiIfw9737X8Q4d7P2YSWK+//\niyS5Oa4Dp+TA92ixpnl0tKgLPmHphEggpe/tAQpPsJP6yg/Aw3g1IhtTwsHq\nS1NSVl50XrgRugRuaw5C48URi7o4kZiXW2TjFNtvTT982hjTp4Q/qh1YN+g2\n4wt14VeJj4QbWKBguPzONL9savOdARo5kQKBh3je/ysex+HY7GnshGz0wWvW\nWCGoOmG88oK0ddfapqiMhfh0pb1lU4v1zLaVJtIcu++ZPddNK1JLXjDRf94B\n+HmG\r\n=AWnn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","name":"ts-creator","types":"dist/types/src/index.d.ts","author":{"name":"kingwl"},"readme":"<div align=\"center\">\n  <img width=\"520\" src=\"./media/Logo.svg\">\n  \n  # ts-creator \n  \n  A code generator to generate TypeScript code generator from TypeScript code\n\n  [![Build Status](https://travis-ci.com/HearTao/ts-creator.svg?branch=master)](https://travis-ci.com/HearTao/ts-creator)  [![NPM version](https://img.shields.io/npm/v/ts-creator.svg)](https://www.npmjs.com/package/ts-creator)   [![codecov](https://codecov.io/gh/HearTao/ts-creator/branch/master/graph/badge.svg)](https://codecov.io/gh/HearTao/ts-creator)\n\n  👉 [Try It!](https://ts-creator.js.org/) 👈\n</div>\n\n\n## How to use it:\n\n```shell\nnpm install ts-creator\n```\n\n\n### 1. generate from code\n\n```ts\nimport creator from 'ts-creator'\n\nconst generatedFactoryCode = creator(`const foo = \"your code here\"`)\n```\n\n### 2. transform source file\n\n```ts\nimport { transformSourceFile } from 'ts-creator'\n\ndeclare const file: ts.SourceFile\nconst factoryFile = transformSourceFile(file)\n```\n\n### 3. transform node\n\n```ts\nimport { transformNode } from 'ts-creator'\n\ndeclare const node: ts.Expression\nconst factoryNode = transformNode(node)\n```\n\n## How does it work?\n\nIf you want to write a TypeScript codegen.\n\nYou got TypeScript code: \n\n```ts\nfunction foo(bar: number): number {\n  return bar + 1\n}\n```\n\nts-creator generate TypeScript factory from given code to:\n\n```ts\nts.createFunctionDeclaration(\n  undefined,\n  undefined,\n  undefined,\n  ts.createIdentifier('foo'),\n  undefined,\n  [\n    ts.createParameter(\n      undefined,\n      undefined,\n      undefined,\n      ts.createIdentifier('bar'),\n      undefined,\n      ts.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n      undefined\n    )\n  ],\n  ts.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n  ts.createBlock(\n    [\n      ts.createReturn(\n        ts.createBinary(\n          ts.createIdentifier('bar'),\n          ts.createToken(ts.SyntaxKind.PlusToken),\n          ts.createNumericLiteral('1')\n        )\n      )\n    ],\n    true\n  )\n)\n\n```\n\nResult after run the generated factory code: \n\n```ts\nfunction foo(bar: number): number {\n    return bar + 1;\n}\n```\n\n## Cli usage\n\nUse `ts-creator` cli to generate code:\n\n```sh\nts-creator <input> [options]\n```\n\nSimple usage:\n\n```sh\n# print generate code\nts-creator foo.ts\n\n# or read data from pipeline\necho 42 | ts-creator\ncat foo.ts | ts-creator\nts-creator < foo.ts\n\n# write to file\nts-creator foo.ts -o foo.js\nts-creator foo.ts > foo.js\n```\n\n### Installation\n\nYou can install `ts-creator` globally.\n\n```sh\nnpm i -g ts-creator\n# or yarn\nyarn global add ts-creator\n```\n\nIf you install locally, may prepend `npx` or `yarn` you need. \n\n```sh\n# use npm\nnpm i ts-creator\nnpx ts-creator -h\n\n# use yarn\nyarn add ts-creator\nyarn ts-creator -h\n```\n\n### Cli options\n\n| option | description | type | default |\n|---|---|---|---|\n| --color | colorful print | boolean | false |\n| --output, -o | output to filepath | string | undefined |\n| --version, -v | show ts-creator version | boolean | false |\n| --help, -h | show help | boolean | false |\n\n\n## TODO:\n\n- [ ] JSDoc\n","gitHead":"8a3b6645ec491556d4b3b9d9aeb44c20efa52956","license":"MIT","scripts":{"lint":"prettier --config ./prettier.json --list-different ./types/**/* ./src/**/* ./tests/**/* ./gulpfile.js ./webpack.config.js ./update-next.js","test":"cross-env NODE_OPTIONS=--max_old_space_size=4096 gulp test","build":"cross-env NODE_OPTIONS=--max_old_space_size=4096 gulp","coverage":"cross-env NODE_OPTIONS=--max_old_space_size=4096 nyc gulp coverage","prettier":"prettier --config ./prettier.json --write ./types/**/* ./src/**/* ./tests/**/* ./gulpfile.js ./webpack.config.js ./update-next.js"},"_npmUser":{"name":"kingwl","email":"kingwenlu@gmail.com"},"_npmVersion":"6.5.0","description":"A code generator to generate TypeScript code generator from TypeScript code","directories":{},"maintainers":[{"name":"kingwl","email":"kingwenlu@gmail.com"}],"_nodeVersion":"11.9.0","dependencies":{"yargs":"^12.0.5","cardinal":"^2.1.1","prettier":"^1.16.0","get-stdin":"^6.0.0","typescript":"^3.2.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"del":"^3.0.0","nyc":"^13.2.0","diff":"^4.0.1","gulp":"^4.0.0","codecov":"^3.1.0","webpack":"^4.28.4","through2":"^3.0.0","cross-env":"^5.2.0","memory-fs":"^0.4.1","ts-loader":"^5.3.3","@types/diff":"^4.0.1","@types/gulp":"^4.0.5","@types/node":"^10.12.18","@types/yargs":"^12.0.6","gulp-prettier":"^2.1.0","webpack-merge":"^4.2.1","webpack-stream":"^5.2.1","@types/prettier":"^1.15.2","gulp-typescript":"^5.0.0","@types/get-stdin":"^5.0.1","@types/memory-fs":"^0.3.2","require-from-string":"^2.0.2","@types/webpack-merge":"^4.1.3","@types/webpack-stream":"^3.2.10","@types/gulp-typescript":"^2.13.0","istanbul-instrumenter-loader":"^3.0.1"},"_npmOperationalInternal":{"tmp":"tmp/ts-creator_1.2.0-8a3b6645_1550134152965_0.7506385700991587","host":"s3://npm-registry-packages"},"_id":"ts-creator@1.2.0-8a3b6645","version":"1.2.0-8a3b6645"}