forked from TBXark/ChatGPT-Telegram-Workers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
22 lines (19 loc) · 809 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
TIMESTAMP_FILE := ./dist/timestamp # 兼容旧版更新逻辑
BUILD_INFO_JSON := ./dist/buildinfo.json
OUTPUT_FILE := ./dist/index.js
ENTRY_FILE := main.js
ESLINT := ./node_modules/.bin/eslint
ESBUILD := ./node_modules/.bin/esbuild
.PHONY: build
build: clean
COMMIT_HASH=$$(git rev-parse --short HEAD) && \
TIMESTAMP=$$(date +%s) && \
echo "$$TIMESTAMP" > $(TIMESTAMP_FILE) && \
echo "{\"sha\": \"$$COMMIT_HASH\", \"timestamp\": $$TIMESTAMP}" > $(BUILD_INFO_JSON) && \
$(ESBUILD) $(ENTRY_FILE) --bundle --outfile=$(OUTPUT_FILE) --format=esm --define:process.env.BUILD_VERSION="'$$COMMIT_HASH'" --define:process.env.BUILD_TIMESTAMP="$$TIMESTAMP"
.PHONY: clean
clean:
rm -f $(TIMESTAMP_FILE) $(BUILD_INFO_JSON) $(OUTPUT_FILE)
.PHONY: lint
lint:
$(ESLINT) --fix --ext .js,.jsx,.mjs main.js src adapter