-
-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (48 loc) · 1.87 KB
/
Copy pathMakefile
File metadata and controls
63 lines (48 loc) · 1.87 KB
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
53
54
55
56
57
58
59
60
61
62
63
.PHONY: clean
ARCH = $(shell uname -m | sed 's/x86_64/x64/' | sed 's/aarch64/arm64/')
clean:
rm -rf chromium.zip _/amazon/code/nodejs _/amazon/handlers/node_modules
pretest:
unzip chromium.$(ARCH).zip -d _/amazon/code
npm install --prefix _/amazon/handlers puppeteer-core@latest --bin-links=false --fund=false --omit=optional --omit=dev --package-lock=false --save=false
test:
sam local invoke --template _/amazon/template.yml --event _/amazon/events/example.com.json node24
test22:
sam local invoke --template _/amazon/template.yml --event _/amazon/events/example.com.json node22
test20:
sam local invoke --template _/amazon/template.yml --event _/amazon/events/example.com.json node20
presource:
cp -R bin/$(ARCH)/* bin
postsource:
rm -f bin/chromium.br bin/al2023.tar.br bin/swiftshader.tar.br
define build-zip
npm install --fund=false --package-lock=false
npm run build
mkdir -p nodejs
npm install --prefix nodejs/ tar-fs@3.1.2 --bin-links=false --fund=false --omit=optional --omit=dev --package-lock=false --save=false
cp -R bin/$(1)/* bin
npm pack
rm -f bin/chromium.br bin/al2023.tar.br bin/swiftshader.tar.br
mkdir -p nodejs/node_modules/@sparticuz/chromium/
tar --directory nodejs/node_modules/@sparticuz/chromium/ --extract --file sparticuz-chromium-*.tgz --strip-components=1
npx clean-modules --directory nodejs "**/*.d.ts" "**/@types/**" "**/*.@(yaml|yml)" --yes
rm sparticuz-chromium-*.tgz
mkdir -p $(dir $@)
zip -9 --filesync --move --recurse-paths $@ nodejs
endef
%.x64.zip:
$(call build-zip,x64)
%.arm64.zip:
$(call build-zip,arm64)
define build-pack
cd bin/$(1) && \
cp ../fonts.tar.br . && \
tar -cvf chromium-pack.$(1).tar al2023.tar.br chromium.br fonts.tar.br swiftshader.tar.br && \
rm fonts.tar.br && \
mv chromium-pack.$(1).tar ../..
endef
pack-x64:
$(call build-pack,x64)
pack-arm64:
$(call build-pack,arm64)
.DEFAULT_GOAL := chromium.x64.zip