Skip to content

Commit

Permalink
This should fix the build
Browse files Browse the repository at this point in the history
We'll handle the TS transpiling ourself and point sam's esbuild at the compiled JS.
  • Loading branch information
tmclaugh committed Oct 21, 2024
1 parent 031d383 commit 1cba019
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,16 @@ jobs:

# TODO: Need to run tests when we have them

- name: Compile Typescript
run: yarn run build

- name: Build artifact
run: yarn run sam:build

# TODO: SAM uses esbuild and installs dependencies using npm.. Should configure oput how
# to both tools.
- name: Package & Upload SAM artifact
id: upload-sam-template
shell: bash
run: |
yarn run sam:package \
--template template.yaml \
--s3-bucket aws-sam-cli-sourcebucket-346402060170-us-east-1 \
--s3-prefix ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_URL }}/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}/${{ env.GITHUB_REF_SLUG_URL }} \
--region us-east-1 \
--output-template-file packaged-template.yaml
- name: Store Artifacts
uses: ServerlessOpsIO/gha-store-artifacts@v1
with:
use_aws_sam: true

deploy:
needs:
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "serverlessops-catalog-api",
"version": "0.0.1",
"description": "ServerlessOps Catalog API for Backstage",
"type": "module",
"repository": {
"type": "git",
"url": "[email protected]:ServerlessOpsIO/serverlessops-catalog-api.git"
Expand All @@ -25,7 +26,8 @@
"test": "npm run compile && npm run unit",
"test:unit": "jest",
"sam:build": "sam build --parallel",
"sam:package": "sam package"
"sam:package": "sam package",
"sam:deploy": "sam deploy"
},
"devDependencies": {
"@backstage/catalog-model": "^1.7.0",
Expand Down
14 changes: 10 additions & 4 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ Resources:
CreateEntityFunction:
Type: AWS::Serverless::Function
Properties:
Handler: src/handlers/CreateEntity/function.handler
CodeUri: ./dist/handlers/CreateEntity
Handler: function.handler
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref DdbTable
Expand All @@ -79,8 +80,10 @@ Resources:
Minify: true
Target: "es2020"
Sourcemap: !Ref EnableSourceMaps
OutExtension:
- .js=.mjs
EntryPoints:
- src/handlers/CreateEntity/function.ts
- function.js

CreateEntityFunctionInvokePermission:
Type: AWS::Lambda::Permission
Expand All @@ -93,7 +96,8 @@ Resources:
GetEntityFunction:
Type: AWS::Serverless::Function
Properties:
Handler: src/handlers/GetEntity/function.handler
CodeUri: ./dist/handlers/GetEntity
Handler: function.handler
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref DdbTable
Expand All @@ -103,8 +107,10 @@ Resources:
Minify: true
Target: "es2020"
Sourcemap: !Ref EnableSourceMaps
OutExtension:
- .js=.mjs
EntryPoints:
- src/handlers/GetEntity/function.ts
- function.js

GetEntityFunctionInvokePermission:
Type: AWS::Lambda::Permission
Expand Down

0 comments on commit 1cba019

Please sign in to comment.