@@ -29,17 +29,16 @@ install: ## Install CLI dependencies
2929
3030build : build-local # # Build the Lambda function (default local)
3131
32- # TODO: FIX TypeScript deployment
33- # TODO: package runtime dependencies from package.json/node_modules
34- # TODO: run tests before build
35- build-docker : # # Build the Lambda function zip in Docker
36- docker run --platform $(DOCKER_PLATFORM ) --rm -v " $$ (pwd)/hello-world:/app" $(IMAGE ) bash -c " cd /app && zip -r hello-world-javascript.zip ."
37-
38- # TODO: FIX TypeScript deployment
39- # TODO: package runtime dependencies from package.json/node_modules
40- # TODO: run tests before build
32+ build-docker : # # Build the Lambda function zip in Docker
33+ docker run --rm --platform $(DOCKER_PLATFORM ) \
34+ -v " $$ (pwd)/hello-world:/app" $(IMAGE ) \
35+ bash -c " cd /app && npm ci && npm test && npm run build"
36+
4137build-local : # # Build the Lambda function zip locally (Node.js requires)
42- cd hello-world && zip -r hello-world-javascript.zip .
38+ cd hello-world && \
39+ npm ci && \
40+ npm test && \
41+ npm run build
4342
4443build-sam : # # Build the Lambda function via AWS SAM
4544 $(SAM ) build --use-container
@@ -49,14 +48,13 @@ wait: ## Wait until the Lambda function becomes ready to invoke
4948
5049deploy : deploy-aws # # Deploy the Lambda function (default AWS CLI)
5150
52- # TODO: FIX TypeScript deployment
5351deploy-aws : # # Deploy the Lambda function via AWS CLI
5452 $(AWS ) lambda create-function \
5553 --function-name $(FUNCTION_NAME ) \
5654 --runtime $(LAMBDA_RUNTIME ) \
5755 --role arn:aws:iam::000000000000:role/lambda-role \
5856 --handler app.lambdaHandler \
59- --zip-file fileb://hello-world/hello-world-javascript.zip \
57+ --zip-file fileb://hello-world/dist/ hello-world-javascript.zip \
6058 --timeout 2
6159
6260deploy-sam : # # Deploy the Lambda function via AWS SAM CLI
@@ -72,7 +70,7 @@ invoke: ## Invoke the Lambda function and show logs
7270
7371# TODO: avoid having the built zip file in the source directory
7472clean : # # Clean the build directory
75- rm -rf hello-world/hello-world-javascript.zip
73+ cd hello-world && rm -rf ./dist ./node_modules ./coverage
7674
7775start : # # Start LocalStack
7876 IMAGE_NAME=localstack/localstack-pro \
0 commit comments