{"bin":{"ts-creator":"bin/ts-creator"},"dist":{"shasum":"5ba1cdca7b5f7cbe3e47fd63addd5027a83b7eda","tarball":"https://registry.npmjs.org/ts-creator/-/ts-creator-1.2.0-c9e6aafe.tgz","fileCount":24,"integrity":"sha512-8xdLsGvgIb2lbWMvFmR7dZvBWt4ZzDtFFRLjIAJPGqgmD4ZYU4ys7MY//OBHlwniGuhJqbuG40/Qmi4S/oiuYQ==","signatures":[{"sig":"MEUCIAzmMoxjsBKqgCy7wb9PZ2LK+RYbmYZClFJ2j8IGXCj1AiEAmmVrlYuCPWVR6ktlkA1FhY0TPcFerkK1ZGeNxK99gI0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10185719,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcYlt9CRA9TVsSAnZWagAAuRsP/0Trm7UKosCbjOzj3v+t\nMymckXR5Ou5JwJpfyfsx8XCPyOLqGqITt4xyJczBFQGUFKUEgZiOxRzH/8LM\nSLONsJ+wA5oEYktUpTLFY2pfG/j5hulFjTlsZzHqWQTGmW5YMUZCWWANJ+YS\nPnz+tUaFv4WeFA71M3ScXUto4AYMxA8+qfPhIfAfwNmy6218GuxLKu5oZ8sg\n74FJMxKU10+wXRlz7f6UEoB55kL3Tx6obnZSu4zjnEha5K1yFwWTxLGB3BWk\nPYgatJ2fMZKLMVbXWCSvOcT05Y70AEsp/duO5orvXPuzhUasKNqCwlbGwHpy\nceYCmD/HWKnFPbQQhgPSuAIe00UFtu1H8nbqOSKjz4wejW+iJQJ6dekYiZnU\nQMoxgZgDqvR+kFO/u9m23LiXxE3ydna4y1TpWX5AJadn+eHqMO+rq1d7mzu8\nXkgl9kO45gKnalDqBzeFondA+VoRQvhdMXQU61kGS7TbMCHVHIUdpr4ZowUw\nEseFXLsk8vZZ6NY/QVF/pzruzqWbezUhY9b15N9w9W1y9pjamO4lM3k1huGc\nSpuNTF+HhL/r/7qK5GAK/y9xrs9zq/AhxUyVlyo1v5JaQJZ7kVW5nkjLV+5/\npw7tGgGJTzpCZtCzJQbPfP31qcQQR1+zTdBLiKEPVFouhyoqyg2Isy2OQKCi\nvnfR\r\n=p96y\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)\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":"c9e6aafeb9723d0141cc7680973e9a64be56bdb7","license":"MIT","scripts":{"dev":"cross-env NODE_OPTIONS=--max_old_space_size=4096 webpack --config webpack.config.js -w","lint":"prettier --config ./prettier.json --list-different ./src/**/* ./tests/**/*","test":"cross-env NODE_OPTIONS=--max_old_space_size=4096 gulp --gulpfile gulpfile.test.js","build":"cross-env NODE_OPTIONS=--max_old_space_size=4096 NODE_ENV=production webpack --config webpack.config.js","prettier":"prettier --config ./prettier.json --write ./src/**/* ./tests/**/*"},"_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":{"del":"^3.0.0","gulp":"^4.0.0","yargs":"^12.0.5","cardinal":"^2.1.1","prettier":"^1.16.0","through2":"^3.0.0","get-stdin":"^6.0.0","memory-fs":"^0.4.1","uglify-es":"^3.3.9","typescript":"^3.2.2","@types/gulp":"^4.0.5","gulp-uglify":"^3.0.1","gulp-uglify-es":"^1.0.4","webpack-stream":"^5.2.1","gulp-typescript":"^5.0.0","@types/memory-fs":"^0.3.2","require-from-string":"^2.0.2","@types/webpack-stream":"^3.2.10","@types/gulp-typescript":"^2.13.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"webpack":"^4.28.4","cross-env":"^5.2.0","ts-loader":"^5.3.3","@types/node":"^10.12.18","webpack-cli":"^3.2.1","@types/yargs":"^12.0.6","webpack-merge":"^4.2.1","@types/prettier":"^1.15.2","@types/get-stdin":"^5.0.1"},"_npmOperationalInternal":{"tmp":"tmp/ts-creator_1.2.0-c9e6aafe_1549949820986_0.18221415580917255","host":"s3://npm-registry-packages"},"_id":"ts-creator@1.2.0-c9e6aafe","version":"1.2.0-c9e6aafe"}