-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
83 lines (75 loc) · 3.13 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
SHELL:=/bin/bash
export bin=@pact-foundation/pact-cli
export pkg_version?=$(shell cat package.json | jq -r .version)
supported_platforms = "linux-x64" "linux-arm64" "darwin-x64" "darwin-arm64" "windows-x64"
export STANDALONE_VERSION=$(shell grep "PACT_STANDALONE_VERSION = '" standalone/install.ts | grep -E -o "'(.*)'" | cut -d"'" -f2)
# https://github.com/npm/npm/issues/17722
# https://github.com/npm/cli/issues/4828
# https://github.com/orhun/packaging-rust-for-npm
# https://blog.orhun.dev/packaging-rust-for-npm/
clean:
rm -rf @pact-foundation
libs: clean
bash script/download-libs.sh
all: libs
for supported_platform in $(supported_platforms); do \
IFS='-' read -r node_os node_arch <<< "$$supported_platform"; \
export node_os=$$node_os; \
export node_arch=$$node_arch; \
export node_pkg=$(bin)-$$node_os-$$node_arch; \
export standalone_package=standalone/$$node_os-$$node_arch-$(STANDALONE_VERSION); \
if [ "$$node_os" = "windows" ]; then \
export node_os="win32"; \
fi; \
echo "Building for $$node_os-$$node_arch"; \
echo "Building $$node_pkg"; \
mkdir -p "$$node_pkg/standalone"; \
mv "$$standalone_package" "$$node_pkg/standalone"; \
envsubst < package.json.tmpl > "$$node_pkg/package.json"; \
(cd $$node_pkg && npm publish --access public --dry-run;)\
done
update_opt_deps:
@for supported_platform in $(supported_platforms); do \
IFS='-' read -r node_os node_arch <<< "$$supported_platform"; \
export node_pkg=$(bin)-$$node_os-$$node_arch; \
jq '.optionalDependencies."'$$node_pkg'" = "$(pkg_version)"' package.json > package-new.json; \
mv package-new.json package.json; \
done
dry_run: all
set -eu; for supported_platform in $(supported_platforms); do \
IFS='-' read -r node_os node_arch <<< "$$supported_platform"; \
export node_os=$$node_os; \
export node_pkg=$(bin)-$$node_os-$$node_arch; \
export node_arch=$$node_arch; \
export standalone_package=standalone/$$node_os-$$node_arch-$(STANDALONE_VERSION); \
if [ "$$node_os" = "windows" ]; then \
export node_os="win32"; \
fi; \
echo "Building $$node_pkg for $$node_os-$$node_arch (dry-run)"; \
(cd $$node_pkg && npm publish --access public --dry-run;)\
done
publish: all
set -eu; for supported_platform in $(supported_platforms); do \
IFS='-' read -r node_os node_arch <<< "$$supported_platform"; \
export node_os=$$node_os; \
export node_arch=$$node_arch; \
export node_pkg=$(bin)-$$node_os-$$node_arch; \
export standalone_package=standalone/$$node_os-$$node_arch-$(STANDALONE_VERSION); \
if [ "$$node_os" = "windows" ]; then \
export node_os="win32"; \
fi; \
echo "Building for $$node_os-$$node_arch"; \
echo "Building $$node_pkg for $$node_os-$$node_arch"; \
(cd $$node_pkg && npm publish --access public;)\
done
link:
set -eu; for supported_platform in $(supported_platforms); do \
IFS='-' read -r node_os node_arch <<< "$$supported_platform"; \
export node_os=$$node_os; \
export node_arch=$$node_arch; \
export node_pkg=$(bin)-$$node_os-$$node_arch; \
(cd $$node_pkg && npm link || echo "cannot link for platform";);\
npm link $$node_pkg || echo "cannot link for platform";\
done
vers:
@echo $(STANDALONE_VERSION)