forked from geojson/schema
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (28 loc) · 833 Bytes
/
Makefile
File metadata and controls
37 lines (28 loc) · 833 Bytes
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
.DELETE_ON_ERROR:
BIN_DIR := ./bin
BUILD_DIR := ./build
SRC_DIR := ./src
SCHEMA_DIR := $(SRC_DIR)/schema
export PATH := $(BIN_DIR):./node_modules/.bin/:$(PATH)
SRC_SCHEMA := $(shell ls $(SCHEMA_DIR)/*.js)
BUILD_SCHEMA := $(patsubst $(SCHEMA_DIR)/%.js,$(BUILD_DIR)/%.json,$(SRC_SCHEMA))
ALL_JS := $(shell find $(SRC_DIR) -type f -name '*.js') $(shell ls $(BIN_DIR)/*)
.PHONY: all
all: $(BUILD_SCHEMA)
# Install dependencies
node_modules/.install: package.json
@npm install
@touch $@
# Build all schema
$(BUILD_SCHEMA): $(SRC_SCHEMA) node_modules/.install
@mkdir -p $(dir $@)
@format.js $(patsubst $(BUILD_DIR)/%.json,$(SCHEMA_DIR)/%.js,./$@) > $@
.PHONY: test
test: $(BUILD_SCHEMA) lint
@node test/test.js
.PHONY: lint
lint: $(ALL_JS) node_modules/.install
@eslint $(ALL_JS);
.PHONY: clean
clean:
@rm -rf $(BUILD_DIR)