{"_id":"@3boysdad/serverless-plugin-typescript","_rev":"1-f48d88990037dc15e1e62b42b1e83ff4","name":"@3boysdad/serverless-plugin-typescript","dist-tags":{"latest":"1.2.0"},"versions":{"1.2.0":{"name":"@3boysdad/serverless-plugin-typescript","version":"1.2.0","main":"dist/src/index.js","scripts":{"prepublish":"npm run build","precommit":"npm run test","build":"rm -rf dist && tsc","pretest":"npm run lint","test":"jest","lint":"tslint -c tslint.json 'src/**/*.ts'"},"repository":{"type":"git","url":"git+https://github.com/3boysdad/serverless-plugin-typescript.git"},"keywords":["serverless","serverless plugin","typescript","aws lambda"],"devDependencies":{"@types/fs-extra":"5.0.4","@types/jest":"22.0.1","@types/lodash":"4.14.91","jest":"22.0.4","mock-fs":"4.4.2","ts-jest":"22.0.1","tslint":"5.8.0"},"dependencies":{"fs-extra":"^5.0.0","globby":"^7.0.0","lodash":"^4.17.4","typescript":"^2.2.2"},"jest":{"transform":{".(ts|tsx)":"<rootDir>/node_modules/ts-jest/preprocessor.js"},"testRegex":"(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$","moduleFileExtensions":["ts","tsx","js"]},"gitHead":"0d951e4897e29d66ca8a6d130228f15fe197aacc","description":"[![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com)","bugs":{"url":"https://github.com/3boysdad/serverless-plugin-typescript/issues"},"homepage":"https://github.com/3boysdad/serverless-plugin-typescript#readme","_id":"@3boysdad/serverless-plugin-typescript@1.2.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.1","_npmUser":{"name":"3boysdad","email":"3boysdad@gmail.com"},"dist":{"integrity":"sha512-Q341Lpu+RYBTVf+KHS2ANlNk7mluLIMYNLQEc042tHNOMVIzSquzlrlbYT93504kfHHZgFIKFipZAx3OUvrWfA==","shasum":"a1a1685703cc66502382ea9793bc3ab6e1d405bf","tarball":"https://registry.npmjs.org/@3boysdad/serverless-plugin-typescript/-/serverless-plugin-typescript-1.2.0.tgz","fileCount":16,"unpackedSize":39730,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcV3yyCRA9TVsSAnZWagAAv3UP/jzBttITQHKk2xBzEyMD\nPjFyX1Ak1MK5hqt0rWT4gvYpzgyxhr0RRPYob1QIStkCQ7ilmmuB8e3D9GiD\n3yseRejUo5e27pzu+BocvZQGWhuLEm/QWQ+xcBwyVNEu4+EmYnSFBWJsf5a7\nX0aKWkHJ6lUuBU+KctHmBfJNUg/R2OARNyf/mYiIOyXDuM6Vjl8QBbtM/evz\nmcOXBiALuJ41Qy/ng3EhcfbcibLSOiVjR0f9Ot1yvgSNqs5DT+2BQVFfo42n\n4d2g0etZGfmv05WoKWRz5e3azgor+0Ux3+jYMn3PyY8AdL6bA2ZRW/z2HDXl\ntTGK5XaQtvGic0mBxF1x5UqHpNaanATC6pgVbh+zlyO9eu2DYpHbHGYrMGBn\n455XDb9ryGL6FymQh/EWkNABwxOX0D3xGkEjPkODzMmImTcG3sbyIo5HY/GP\n6qVsiFt32PWd+R0GccH9a4K0/GiNMFWCFp3nh7oLGceGV7tsvXgBua2u3/fI\nEyKkmkt/4yjOX9K74wvWyAoBV1snP6h/e4viKzFq+WgT5Ezuofn432R7yrfE\nThoJ6l62hgJvsDi231R+o5PtEahw2Ma1/F+cVEW5Re4biC8UIylwNOnXlz2o\nE5RdI0TpivqiVFgtPFEh98MWdOtF4n/eu/DKlDIjxIaM2cKkDTOYi0mcTKQb\n65X6\r\n=cTzH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE+nR21xxh5ixoRkstImIjtZpe1JhEQNmZNr4vmRYOqnAiA+QcGiQ9NbRY7Jxy+Sx0PBRCkXfZ5zRwEUlV12kZpecQ=="}]},"maintainers":[{"name":"3boysdad","email":"3boysdad@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/serverless-plugin-typescript_1.2.0_1549237425496_0.9335310611249483"},"_hasShrinkwrap":false}},"time":{"created":"2019-02-03T23:43:45.311Z","1.2.0":"2019-02-03T23:43:45.648Z","modified":"2022-04-04T10:44:30.855Z"},"maintainers":[{"name":"3boysdad","email":"3boysdad@gmail.com"}],"description":"[![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com)","homepage":"https://github.com/3boysdad/serverless-plugin-typescript#readme","keywords":["serverless","serverless plugin","typescript","aws lambda"],"repository":{"type":"git","url":"git+https://github.com/3boysdad/serverless-plugin-typescript.git"},"bugs":{"url":"https://github.com/3boysdad/serverless-plugin-typescript/issues"},"readme":"# serverless-plugin-typescript\r\n[![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com)\r\n\r\nServerless plugin for zero-config Typescript support\r\n\r\n## 3boysdad Update\r\nOriginal NPM Module: http://www.npmjs.com/package/serverless-plugin-typescript\r\n\r\nThis version of `serverless-typescript-plugin` fixes symbolic link issue with Windows OS resulting in the following errors:\r\n\r\n> 1) EPERM: operation not permitted, symlink...\r\n\r\nWhen trying to create symlink to the \"package.json\" file in the build directory.\r\n\r\nI won't create a PR for the original plugin as it seems dead now.\r\nAnd while my solution works, I am pretty sure it's only a hack.\r\n\r\n## Features\r\n\r\n* Zero-config: Works out of the box without the need to install any other compiler or plugins\r\n* Supports ES2015 syntax + features (`export`, `import`, `async`, `await`, `Promise`, ...)\r\n* Supports `sls package`, `sls deploy` and `sls deploy function`\r\n* Supports `sls invoke local` + `--watch` mode\r\n* Integrates nicely with [`serverless-offline`](https://github.com/dherault/serverless-offline)\r\n\r\n## Install\r\n\r\nyarn add --dev @3boysdad/serverless-plugin-typescript\r\n\r\nor\r\n\r\nnpm install --save-dev @3boysdad/serverless-plugin-typescript\r\n\r\nAdd the following plugin to your `serverless.yml`:\r\n\r\n```yaml\r\nplugins:\r\n  - '@3boysdad/serverless-plugin-typescript'\r\n```\r\n\r\n## Configure\r\n\r\nSee [example folder](example) for a minimal example.\r\n\r\n### `tsconfig.json`\r\n\r\nThe default `tsconfig.json` file used by the plugin looks like this:\r\n\r\n```json\r\n{\r\n  \"compilerOptions\": {\r\n    \"preserveConstEnums\": true,\r\n    \"strictNullChecks\": true,\r\n    \"sourceMap\": true,\r\n    \"target\": \"es5\",\r\n    \"outDir\": \".build\",\r\n    \"moduleResolution\": \"node\",\r\n    \"lib\": [\"es2015\"],\r\n    \"rootDir\": \"./\"\r\n  }\r\n}\r\n```\r\n\r\n> Note 1: The `outDir` and `rootDir` options cannot be overwritten.\r\n** mulling over 'fixing' this ** as it seems rather hacky.\r\n\r\n> Note 2: Don't confuse the [`tsconfig.json`](tsconfig.json) in this repository with the one mentioned above.\r\n\r\n### Including extra files\r\n\r\nPersonally rather than this please use and install the plugin - serverless-plugin-include-dependencies.\r\n\r\n## Usage\r\n\r\n### Google Cloud Functions\r\n\r\nWhen using with Google Cloud Functions via the [serverless-google-cloudfunctions](https://github.com/serverless/serverless-google-cloudfunctions)\r\nplugin, you simply have to provide a `main` field in your `package.json`:\r\n\r\n```js\r\n{\r\n  // ...\r\n  \"main\": \"handler.js\",\r\n  // ..\r\n}\r\n```\r\n\r\nAnd this plugin will automatically compile your typescript correctly. Note\r\nthat the field must refer to the compiled file name, namely, ending with a `.js`\r\nextension.\r\n\r\nIf a `main` field was not found, then this plugin will use `index.js`. Before\r\ncompilation begins, it will check to see that the file indicated exists with a\r\n`.ts` extension before actually trying to compile it.\r\n\r\n### Automatic compilation\r\n\r\nThe normal Serverless deploy procedure will automatically compile with Typescript:\r\n\r\n- Create the Serverless project with `serverless create -t aws-nodejs`\r\n- Install Serverless Typescript as above\r\n- Deploy with `serverless deploy`\r\n\r\n### Usage with serverless-offline\r\n\r\nThe plugin integrates very well with [serverless-offline](https://github.com/dherault/serverless-offline) to\r\nsimulate AWS Lambda and AWS API Gateway locally.\r\n\r\nAdd the plugins to your `serverless.yml` file and make sure that `@hewmen/serverless-plugin-typescript`\r\nprecedes `serverless-offline` as the order is important:\r\n```yaml\r\n  plugins:\r\n    ...\r\n    - '@hewmen/serverless-plugin-typescript'\r\n    ...\r\n    - serverless-offline\r\n    ...\r\n```\r\n\r\nRun `serverless offline` or `serverless offline start` to start the Lambda/API simulation.\r\n\r\nIn comparison to `serverless offline`, the `start` command will fire an `init` and a `end` lifecycle hook which is needed for `serverless-offline` and e.g. `serverless-dynamodb-local` to switch off resources (see below)\r\n\r\n#### serverless-dynamodb-local\r\n\r\nConfigure your service the same as mentioned above, but additionally add the `serverless-dynamodb-local`\r\nplugin as follows:\r\n```yaml\r\n  plugins:\r\n    - '@hewmen/serverless-plugin-typescript'\r\n    - serverless-dynamodb-local\r\n    - serverless-offline\r\n```\r\n\r\nRun `serverless offline start`.\r\n\r\n#### Other useful options\r\n\r\nYou can reduce the clutter generated by `serverless-offline` with `--dontPrintOutput` and\r\ndisable timeouts with `--noTimeout`.\r\n\r\n### Run a function locally\r\n\r\nTo run your compiled functions locally you can:\r\n\r\n```bash\r\n$ serverless invoke local --function <function-name>\r\n```\r\n\r\nOptions are:\r\n\r\n- `--function` or `-f` (required) is the name of the function to run\r\n- `--watch` - recompile and run a function locally on source changes\r\n- `--path` or `-p` (optional) path to JSON or YAML file holding input data\r\n- `--data` or `-d` (optional) input data\r\n\r\n### Enabling source-maps\r\n\r\nYou can easily enable support for source-maps (making stacktraces easier to read) by installing and using the following plugin:\r\n\r\n```sh\r\nyarn add --dev source-map-support\r\n```\r\n\r\n```ts\r\n// inside of your function\r\nimport 'source-map-support/register'\r\n```\r\n\r\nIf you are using webpack (most likely). Add `devtool: 'source-map'` to `webpack.config.js`:\r\n```js\r\nmodule.exports = {\r\n  .... snip ....\r\n  devtool: 'source-map',\r\n  .... snip ....\r\n\r\n}\r\n```\r\n\r\n## Help & Community [![Slack Status](https://slack.graph.cool/badge.svg)](https://slack.graph.cool)\r\n\r\nJoin our [Slack community](http://slack.graph.cool/) if you run into issues or have questions. We love talking to you!\r\n\r\n![](http://i.imgur.com/5RHR6Ku.png)\r\n","readmeFilename":"README.md"}