{"id":16410768,"url":"https://github.com/tamino-martinius/template-webpack-typescript-lambda","last_synced_at":"2025-02-24T04:21:13.986Z","repository":{"id":66061112,"uuid":"138741869","full_name":"tamino-martinius/template-webpack-typescript-lambda","owner":"tamino-martinius","description":null,"archived":false,"fork":false,"pushed_at":"2018-07-03T17:40:13.000Z","size":447,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-06T03:21:41.470Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tamino-martinius.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-26T13:25:46.000Z","updated_at":"2018-07-03T17:40:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"b37c7a42-1586-46c6-8ac9-e48217df26a5","html_url":"https://github.com/tamino-martinius/template-webpack-typescript-lambda","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamino-martinius%2Ftemplate-webpack-typescript-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamino-martinius%2Ftemplate-webpack-typescript-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamino-martinius%2Ftemplate-webpack-typescript-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamino-martinius%2Ftemplate-webpack-typescript-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tamino-martinius","download_url":"https://codeload.github.com/tamino-martinius/template-webpack-typescript-lambda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240415646,"owners_count":19797668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T06:43:49.319Z","updated_at":"2025-02-24T04:21:13.963Z","avatar_url":"https://github.com/tamino-martinius.png","language":"TypeScript","readme":"# Webpack Template for Lambda using TypeScript\r\n\r\nThis is a Webpack Template for creating AWS Lambda functions with TypeScript.\r\n\r\n## TOC\r\n\r\n- [Webpack Template for Lambda using TypeScript](#webpack-template-for-lambda-using-typescript)\r\n  - [TOC](#toc)\r\n  - [Initialize your project](#initialize-your-project)\r\n  - [Install SAM CLI](#install-sam-cli)\r\n  - [Add your code](#add-your-code)\r\n  - [Scripts](#scripts)\r\n    - [Build](#build)\r\n    - [Production Build](#production-build)\r\n    - [Watch](#watch)\r\n    - [Create CloudFormation Stack](#create-cloudformation-stack)\r\n    - [Update CloudFormation Stack](#update-cloudformation-stack)\r\n    - [Delete CloudFormation Stack](#delete-cloudformation-stack)\r\n    - [Update Lambda function](#update-lambda-function)\r\n    - [Local Test Invocation](#local-test-invocation)\r\n  - [Modify CloudFormation Stack](#modify-cloudformation-stack)\r\n\r\n## Initialize your project\r\n\r\nCopy this Repository by using the GitHub [Import Repository](https://github.com/new/import) or just [download the source](https://github.com/tamino-martinius/template-webpack-typescript-lambda/archive/master.zip).\r\n\r\nGo to the folder and install dependencies:\r\n\r\n```sh\r\nnpm install\r\n# or\r\nyarn\r\n```\r\n\r\n## Install SAM CLI\r\n\r\nTo run your Lambda function locally you need to have [AWS SAM CLI](https://github.com/awslabs/aws-sam-cli) installed\r\n\r\n```sh\r\npip install --user aws-sam-cli\r\n```\r\n\r\nPlease verify that the `sam` command is working\r\n\r\n*Please note:*\r\n\r\nIf you get the Error `ImportError: No module named ssl_match_hostname` while starting sam, please run:\r\n\r\n```sh\r\npip uninstall backports.ssl-match-hostname\r\npip install -U docker\r\n```\r\n\r\n## Add your code\r\n\r\nThe main handler is expected to be the default export of the `src/index.ts` file. With `node 8.10` you can use an `async` function as default export. With `node 4.3.2` you need to return a callback with the default handler.\r\n\r\nNode 8:\r\n\r\n```ts\r\nexport default async (event: any, context: AWSLambda.Context) =\u003e {\r\n  return 'Hello World';\r\n};\r\n```\r\n\r\nNode 4:\r\n\r\n```ts\r\nexport default (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) =\u003e {\r\n  return 'Hello World';\r\n};\r\n```\r\n\r\nThe `event` can also be typed with `AWSLambda.APIGatewayEvent` or others - depending on your Lambda invocation.\r\n\r\n## Scripts\r\n\r\n### Build\r\n\r\n```sh\r\nnpm run build\r\n```\r\n\r\nBuilds the code and saves it to the `dist` folder.\r\n\r\n### Production Build\r\n\r\n```sh\r\nnpm run build:production\r\n```\r\n\r\nBuilds and minifies the code and saves it to the `dist` folder.\r\n\r\n### Watch\r\n\r\n```sh\r\nnpm run watch\r\n```\r\n\r\nListens to code changes and builds the code and saves it to the `dist` folder every time it detects changes.\r\n\r\n### Create CloudFormation Stack\r\n\r\n```sh\r\nnpm run cf:create\r\n```\r\n\r\nCreates Lambda function with an CloufFormation Stack based on the `package.json` settings and the CloudFormation Template build at the `scripts/env.ts` file.\r\n\r\n### Update CloudFormation Stack\r\n\r\n```sh\r\nnpm run cf:update\r\n```\r\n\r\nUpdates the CloudFormation Stack based on the `package.json` settings and the CloudFormation Template build at the `scripts/env.ts` file. This creates an ChangeSet and applies it immediately.\r\n\r\n### Delete CloudFormation Stack\r\n\r\n```sh\r\nnpm run cf:delete\r\n```\r\n\r\nDeletes the CloudFormation Stack. To prevent errors on rollback the S3 Bucket will get cleared first.\r\n\r\n### Update Lambda function\r\n\r\n```sh\r\nnpm run lambda:update\r\n```\r\n\r\nCompiles the code with production settings and uploads the new code as zip file to Lambda. Code will be applied immediately.\r\n\r\n### Local Test Invocation\r\n\r\n```sh\r\nnpm run sam:invoke\r\n```\r\n\r\nRunsLambda function locally with payload defined in `scripts/samInvoke.ts` This will be changed.\r\n\r\n## Modify CloudFormation Stack\r\n\r\nThe CloudFormation Template is build at `scripts/env.ts`. This will be changed in the future.\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftamino-martinius%2Ftemplate-webpack-typescript-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftamino-martinius%2Ftemplate-webpack-typescript-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftamino-martinius%2Ftemplate-webpack-typescript-lambda/lists"}