-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (41 loc) · 1.84 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
.PHONY: build-RuntimeDependenciesLayer build-lambda-common
.PHONY: build-AuthAtEdge
.PHONY: build-UploadFunction build-UserConfirmFunction build-UploadTriggerFunction build-CreateUserFunction
.PHONY: build-DBMigrationHandler
build-AuthAtEdge:
$(MAKE) HANDLER=src/edge/auth.ts build-lambda-edge
build-UploadFunction:
$(MAKE) HANDLER=src/handlers/upload.ts build-lambda-common
build-UserConfirmFunction:
$(MAKE) HANDLER=src/handlers/userConfirm.ts build-lambda-common
build-UploadTriggerFunction:
$(MAKE) HANDLER=src/handlers/uploadTrigger.ts build-lambda-common
build-CreateUserFunction:
$(MAKE) HANDLER=src/handlers/createUser.ts build-lambda-common
build-DBMigrationHandler:
$(MAKE) HANDLER=src/handlers/dbMigration.ts build-custom-resource
build-lambda-edge:
rm -rf dist
yarn --production --modules-folder dist/edge/node_modules
echo "{\"extends\": \"./tsconfig.json\", \"include\": [\"${HANDLER}\"] }" > tsconfig-only-handler.json
yarn build --build tsconfig-only-handler.json
cp package.json yarn.lock "dist/edge"
cp -r dist "$(ARTIFACTS_DIR)/"
build-lambda-common:
yarn
rm -rf dist
echo "{\"extends\": \"./tsconfig.json\", \"include\": [\"${HANDLER}\"] }" > tsconfig-only-handler.json
yarn build --build tsconfig-only-handler.json
cp -r dist "$(ARTIFACTS_DIR)/"
build-custom-resource:
rm -rf dist
echo "{\"extends\": \"./tsconfig.json\", \"include\": [\"${HANDLER}\"] }" > tsconfig-only-handler.json
yarn build --build tsconfig-only-handler.json
cp package.json yarn.lock "$(ARTIFACTS_DIR)/"
yarn --production --cwd "$(ARTIFACTS_DIR)/"
cp -r dist "$(ARTIFACTS_DIR)/"
build-RuntimeDependenciesLayer:
mkdir -p "$(ARTIFACTS_DIR)/nodejs"
cp package.json yarn.lock "$(ARTIFACTS_DIR)/nodejs/"
yarn --production --cwd "$(ARTIFACTS_DIR)/nodejs/"
rm "$(ARTIFACTS_DIR)/nodejs/package.json" # to avoid rebuilding when changes doesn't relate to dependencies