{"bin":{"ts-creator":"bin/ts-creator"},"nyc":{"all":true,"exclude":["**/*.d.ts"],"include":["src/**/*.ts"],"reporter":["text","lcov"],"extension":[".ts"]},"dist":{"shasum":"8ab3b85f388090ccfd3949fdb6db619e90f7f355","tarball":"https://registry.npmjs.org/ts-creator/-/ts-creator-1.2.5-add0acdf.tgz","fileCount":25,"integrity":"sha512-B6R25Nd70fy76woNmEDfK9MhHkKFBiNra7mN67ZNdi2jGbqkBJSVBXlo/NYLe8twkb02jz1FSEr4U3fkeKlVdw==","signatures":[{"sig":"MEUCIQC5qyU/ycVVcJO1auBk8zzBkJ5AgZfI01hE5TCzc5hk6wIgLyUSr+o5DES28kLjZx1AIJ4Ui73KEGMAt0uGSEwu8IY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":22358830,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJck1wcCRA9TVsSAnZWagAAdU4P+gNb5h6jVG2+kDw8e0kB\nhffFqnRJFDbtBOfKMGyrQNgojFz4v0/UWtB7gq5wRidp0VCSiBm5igv4PpsO\nxyMJqxF5ID6CCvpAXVyxRLTpRWE+4Me30q4FQIgakhuEtVD/i8XfW10eCuN1\nv1W1SCxX2633Y/8XhXTu5KgeWvlQfAofCoCrugq0WKobXXVqW8tnVut1BFXk\nzbKxSHkENCAMjCqlkfcprqdB4ueW05eFIvwr2rdJ7FCfL8Ul3VhitmZPepGv\nznJspIV1TDdZH6ywsA0UbuL4PFLLZlnxI2ccvVggyB92vTHwX9d3Mrl2e6+Z\nJKzqkpqgVEqpfD998qMKp8uJIdx9tfrpwG8LN3AaJQZNK9tgUpL1/xXrOdQR\n6hQzAi6pj+8J11hBDBR580p1ddHibI5YaMgqet5qofowtqDYa0Rk8L8JtGNp\nKfAK2oJfoCXLYuuZwhU9bivNR9wkIknp0Y8tTiV7kt/qPdhPGvFU4xs5EilL\nhUt2RJLo9zoqIuW9OPUzoet6b7i7JOEutFXIpBnDmRxgGFhAVWlkLagauIDx\nEWzAYbhfntnxiN99+gPwnABCbYd0E4wCgrENYY4fhjFGTnDN99hJ7PUAAixd\n3S3uea04rtrP2uSsEA8o6dc9KFcDWI16sB6Rgv3RW+hVeY/JKGUWMCWkSc5m\nuzKK\r\n=AW4o\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","name":"ts-creator","types":"dist/types/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| --target, -t | generate targets | Enum { `expression`, `runnable`, `esmodule`, `commonjs` } | `expression` |\n| --output, -o | output to filepath | String | `undefined` |\n| --tsx | tsx support | Boolean | `false` |\n| --color | colorful print | Boolean | `true` |\n| --semi | print semicolons at the ends of statements | Boolean | `false` |\n| --single-quote | use single quotes instead of double quotes | Boolean | `true` |\n| --jsx-single-quote | use single quotes in JSX | Boolean | `false` |\n| --bracket-spacing | print spaces between brackets in object literals | Boolean | `true` |\n| --tab-width | pecify the number of spaces per indentation-level | Number | `2` |\n| --use-tabs | indent lines with tabs instead of spaces | Boolean | `false` |\n| --trailing-comma | print trailing commas wherever possible | Enum { `none`, `es5`, `all` } | `none` |\n| --prose-wrap | how to wrap output | Enum { `always`, `never`, `preserve` } | `preserve` |\n| --version, -v | show ts-creator versions | Boolean | `false` |\n| --help, -h | show helper | Boolean | `false` |\n\n## TODO:\n\n- [ ] JSDoc\n","gitHead":"add0acdf8fd9f5107bf47aeccc1a6f87387a8ddb","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.7.0","description":"A code generator to generate TypeScript code generator from TypeScript code","directories":{},"maintainers":[{"name":"kingwl","email":"kingwenlu@gmail.com"}],"_nodeVersion":"11.12.0","dependencies":{"yargs":"^12.0.5","cardinal":"^2.1.1","prettier":"^1.16.0","get-stdin":"^6.0.0","typescript":"^3.4.0-dev.20190313"},"_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.5-add0acdf_1553161243901_0.7140972029080155","host":"s3://npm-registry-packages"},"_id":"ts-creator@1.2.5-add0acdf","version":"1.2.5-add0acdf"}