This repository has been archived by the owner on Jan 19, 2024. It is now read-only.
forked from Khan/perseus
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
92 lines (69 loc) · 2.5 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
.PHONY: help build server all subperseus put put-js put-css install clean lint test jest
PORT=9000
WEBAPP=../webapp
NPM_BIN=$(shell npm bin)
API_VERSION_MAJOR:=$(shell node node/echo-major-api-version.js)
PERSEUS_BUILD_JS=build/perseus-$(API_VERSION_MAJOR).js
PERSEUS_BUILD_CSS=build/perseus-$(API_VERSION_MAJOR).css
help:
@echo "make dev # (development) compiles into $(PERSEUS_BUILD_JS) and $(PERSEUS_BUILD_CSS)"
@echo "make build # (production) compiles into $(PERSEUS_BUILD_JS) and $(PERSEUS_BUILD_CSS)"
@echo "make watch # use watchify to auto compile perseus"
@echo "make server PORT=9000 # runs the perseus server"
@echo "make ke # build symlink to khan-exercises"
@echo "make all # build perseus into webapp"
dev: prebuild buildcss devjs
build: prebuild buildcss buildjs
watch: prebuild buildcss watchjs
devjs:
@echo "Building js (development) ..."
@npm run dev -s > $(PERSEUS_BUILD_JS)
buildjs:
@echo "Building js (production) ..."
@npm run build -s > $(PERSEUS_BUILD_JS)
watchjs:
@echo "Watching js ..."
@npm run watch -- -o $(PERSEUS_BUILD_JS)
buildcss:
@echo "Building css ..."
@$(NPM_BIN)/lessc stylesheets/exercise-content-package/perseus.less $(PERSEUS_BUILD_CSS)
prebuild:
mkdir -p build
ifeq ("$(wildcard node_modules/react-components/package.json)","")
@echo "Installing npm packages ..."
@npm install --no-optional --silent --no-progress
endif
@# should be fixed by khan/react-components
@sed -i -- 's/reactify/babelify/g' node_modules/react-components/package.json
server: ke
php -S 0.0.0.0:$(PORT)
demo:
git checkout gh-pages
git reset --hard origin/master
make build
git add -f $(PERSEUS_BUILD_JS)
git commit -nm 'demo update'
git checkout master
git push -f origin gh-pages:gh-pages
all: subperseus
subperseus: clean install build put
put: put-js put-css
put-js: build
cp $(PERSEUS_BUILD_JS) "$(WEBAPP)/javascript/perseus-package/"
put-css: build
cp stylesheets/perseus-admin-package/* "$(WEBAPP)/stylesheets/perseus-admin-package"
cp $(PERSEUS_BUILD_CSS) "$(WEBAPP)/stylesheets/exercise-content-package/"
install:
npm install
clean:
-rm -rf build/*
lint:
~/Khan/devtools/khan-linter/runlint.py
test:
find -E src -type f -regex '.*/__tests__/.*\.jsx?' | xargs ./node_modules/.bin/mocha --reporter spec -r node/environment.js
build/ke.js:
(cd ke && ../node_modules/.bin/r.js -o requirejs.config.js out=../build/ke.js)
jest: build/ke.js
./node_modules/.bin/jest
ke:
ln -s ../../khan-exercises $@