-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
55 lines (38 loc) · 1.28 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
default: build
# ===== Directories =====
TEST_DIR = test
PUBLIC_DIR = $(TEST_DIR)/public
BIN_DIR = node_modules/.bin
DIST_DIR = dist
# ===== Files =====
VERSION_FILE = VERSION
PEGCOFFEE_DIST_FILE_DEV = $(DIST_DIR)/pegjs-coffee-plugin-$(VERSION).js
PEGCOFFEE_DIST_FILE_MIN = $(DIST_DIR)/pegjs-coffee-plugin-$(VERSION).min.js
LICENSE_FILE = LICENSE
CHANGELOG_FILE = CHANGELOG.md
README_FILE = README.md
# ===== Executables =====
MOCHA = $(BIN_DIR)/mocha --compilers coffee:coffee-script -u tdd
HTTP_SERVER = $(BIN_DIR)/http-server -p 3000
JSHINT = $(BIN_DIR)/jshint
UGLIFYJS = $(BIN_DIR)/uglifyjs
BROWSERIFY = $(BIN_DIR)/browserify
# ===== Variables =====
VERSION = `cat $(VERSION_FILE)`
build:
$(BROWSERIFY) --standalone "PEGjs-coffee-plugin" -o $(PEGCOFFEE_DIST_FILE_DEV) index.js
test:
$(MOCHA) --ui tdd
test-browser: build
cp $(PEGCOFFEE_DIST_FILE_DEV) $(PUBLIC_DIR)/pegjs-coffee-plugin.js
$(HTTP_SERVER) $(TEST_DIR)
open "http://localhost:3000"
# Prepare dstribution files
dist: build
# Web
$(UGLIFYJS) --ascii -o $(PEGCOFFEE_DIST_FILE_MIN) $(PEGCOFFEE_DIST_FILE_DEV)
# Remove distribution file (created by "dist")
distclean:
rm -rf $(DIST_DIR)
.PHONY: test test-browser build dist distclean
.SILENT: test test-browser build dist distclean