-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (44 loc) · 1.96 KB
/
Makefile
File metadata and controls
58 lines (44 loc) · 1.96 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
.PHONY: all generate-schemas build cross-compile test test-integration typecheck lint format size-check clean
all: build
# Detect biome binary (handle Rosetta x64/arm64 mismatch)
BIOME := $(shell command -v biome 2>/dev/null || \
([ -f node_modules/@biomejs/cli-darwin-arm64/biome ] && echo node_modules/@biomejs/cli-darwin-arm64/biome) || \
([ -f node_modules/@biomejs/cli-linux-x64/biome ] && echo node_modules/@biomejs/cli-linux-x64/biome) || \
echo "bunx biome")
CLI_VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
CLI_GIT_COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
CLI_BUILD_DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
DEFINE_FLAGS = \
--define "CLI_VERSION='$(CLI_VERSION)'" \
--define "CLI_GIT_COMMIT='$(CLI_GIT_COMMIT)'" \
--define "CLI_BUILD_DATE='$(CLI_BUILD_DATE)'"
generate-schemas:
bun run scripts/generate-schemas.ts
build: generate-schemas
bun build src/index.ts --compile --outfile n8n-cli --minify $(DEFINE_FLAGS)
cross-compile:
bun build src/index.ts --compile --target=bun-darwin-arm64 --outfile dist/n8n-cli-darwin-arm64 --minify $(DEFINE_FLAGS)
bun build src/index.ts --compile --target=bun-darwin-x64 --outfile dist/n8n-cli-darwin-x64 --minify $(DEFINE_FLAGS)
bun build src/index.ts --compile --target=bun-linux-x64 --outfile dist/n8n-cli-linux-x64 --minify $(DEFINE_FLAGS)
bun build src/index.ts --compile --target=bun-windows-x64 --outfile dist/n8n-cli-windows-x64 --minify $(DEFINE_FLAGS)
test:
bun test
test-integration:
bun test tests/cli/
typecheck:
bunx tsc --noEmit
lint:
$(BIOME) check src/ tests/
format:
$(BIOME) format --write src/ tests/
size-check:
@size=$$(stat -f%z n8n-cli 2>/dev/null || stat -c%s n8n-cli 2>/dev/null); \
limit=104857600; \
if [ "$$size" -gt "$$limit" ]; then \
echo "ERROR: Binary size $${size} bytes exceeds 100MB limit"; exit 1; \
else \
echo "OK: Binary size $${size} bytes (limit: $${limit})"; \
fi
clean:
rm -f n8n-cli
rm -rf dist/