-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
54 lines (42 loc) · 1.35 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
# Variables
NAME = Noiseclapper
DOMAIN = JordanViknar
DIST_DIR = dist
LOCALE_DIR = locale
SCHEMA_DIR = schemas
UI_DIR = ui
SOURCE_FILES = src/extension.ts src/prefs.ts src/indicator.ts src/common.ts
JS_FILES = $(DIST_DIR)/extension.js $(DIST_DIR)/prefs.js $(DIST_DIR)/indicator.js $(DIST_DIR)/common.js
UI_FILES = $(UI_DIR)/prefs.blp
# Phony targets
.PHONY: all pack install clean locale
# Default target
all: $(JS_FILES)
# Dependencies
node_modules: package.json
bun install
touch $@
# Check TypeScript files with biome
check:
bunx biome ci .
# Compile TypeScript files
$(DIST_DIR)/%.js: $(SOURCE_FILES) node_modules
tsc
# Generate pot file for translation
$(LOCALE_DIR)/$(NAME).pot: $(SOURCE_FILES) $(UI_FILES)
xgettext --from-code=UTF-8 --output=$@ $^ --add-comments --keyword=_ --keyword=C_:1c,2 --language=JavaScript
locale: $(LOCALE_DIR)/$(NAME).pot
# Compile UI files
$(DIST_DIR)/prefs.ui: $(UI_FILES)
blueprint-compiler compile $^ > $@
# Pack extension
$(NAME)@$(DOMAIN).zip: $(JS_FILES) $(DIST_DIR)/prefs.ui $(LOCALE_DIR)/$(NAME).pot
cp -r locale dist/
cp -r schemas dist/
cp metadata.json dist/
cd dist && zip ../$(NAME)@$(DOMAIN).zip -9r . --exclude=locale/\*.pot --exclude=locale/\*.po --exclude=\*.blp
pack: $(NAME)@$(DOMAIN).zip
install: $(NAME)@$(DOMAIN).zip
gnome-extensions install $< --force
clean:
rm -rf $(DIST_DIR) $(NAME)@$(DOMAIN).zip