|
2 | 2 |
|
3 | 3 | .DEFAULT_GOAL := help |
4 | 4 |
|
| 5 | +NPM_BIN = $(shell npm bin) |
| 6 | + |
| 7 | +# Generates a help message. Borrowed from https://github.com/pydanny/cookiecutter-djangopackage. |
5 | 8 | help: ## display this help message |
6 | 9 | @echo "Please use \`make <target>' where <target> is one of" |
7 | | - @perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}' |
| 10 | + @perl -nle'print $& if m{^[\.a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}' |
8 | 11 |
|
9 | 12 | install: ## install requirements |
10 | 13 | npm install |
11 | 14 |
|
12 | 15 | clean: ## remove build artifacts |
13 | | - rm -rf css/ |
14 | | - rm -rf samples/css/ |
15 | | - rm -rf samples/edx-bootstrap/ |
16 | | - |
17 | | -samples: clean ## build the samples |
18 | | - mkdir samples/edx-bootstrap |
19 | | - cp -r sass/ samples/edx-bootstrap/sass |
20 | | - mkdir samples/css |
21 | | - mkdir samples/css/edx |
22 | | - mkdir samples/css/open-edx |
23 | | - ./node_modules/node-sass/bin/node-sass samples/edx/sass --output samples/edx/css --include-path samples --include-path node_modules |
24 | | - ./node_modules/node-sass/bin/node-sass samples/open-edx/sass --output samples/open-edx/css --include-path samples --include-path node_modules |
25 | | - ./node_modules/.bin/opn samples/index.html |
26 | | - |
27 | | -build: clean ## build the npm package |
28 | | - |
29 | | -preview: samples ## build the preview site |
30 | | - aws s3 sync samples s3://${S3_PREVIEW_DOMAIN}/$(shell git rev-parse --abbrev-ref HEAD) |
31 | | - @echo Preview generated to http://${S3_PREVIEW_DOMAIN}/$(shell git rev-parse --abbrev-ref HEAD) |
| 16 | + rm -rf {css,samples/{css,edx-bootstrap}} |
| 17 | + |
| 18 | +build.samples: clean ## build the samples |
| 19 | + $(eval $@_INCLUDE = --include-path samples --include-path node_modules) |
| 20 | + mkdir -p samples/edx-bootstrap |
| 21 | + mkdir -p samples/css/{edx,open-edx} |
| 22 | + cp -R sass/ samples/edx-bootstrap/sass |
| 23 | + $(NPM_BIN)/node-sass samples/edx/sass --output samples/edx/css $($@_INCLUDE) |
| 24 | + $(NPM_BIN)/node-sass samples/open-edx/sass --output samples/open-edx/css $($@_INCLUDE) |
| 25 | + |
| 26 | +samples: clean build.samples ## build and show the samples |
| 27 | + $(NPM_BIN)/opn samples/index.html |
| 28 | + |
| 29 | +preview: build.samples ## build the preview site |
| 30 | + $(eval $@_REF = $(shell git rev-parse --abbrev-ref HEAD)) |
| 31 | + aws s3 sync samples s3://${S3_PREVIEW_DOMAIN}/$($@_REF) |
| 32 | + @echo Preview generated to http://${S3_PREVIEW_DOMAIN}/$($@_REF) |
| 33 | + $(NPM_BIN)/opn http://${S3_PREVIEW_DOMAIN}/$($@_REF) |
32 | 34 |
|
33 | 35 | quality: |
34 | | - ./node_modules/stylelint/bin/stylelint.js sass/**/*.scss samples/**/*.scss |
| 36 | + $(NPM_BIN)/stylelint sass/**/*.scss samples/**/*.scss |
35 | 37 |
|
36 | 38 | fix: |
37 | | - ./node_modules/stylelint/bin/stylelint.js sass/**/*.scss samples/**/*.scss --fix |
| 39 | + $(NPM_BIN)/stylelint sass/**/*.scss samples/**/*.scss --fix |
38 | 40 |
|
39 | | -test: clean quality ## run tests |
| 41 | +test: clean quality build.samples ## run tests |
40 | 42 |
|
41 | 43 | xxx: |
42 | | - echo $(shell git rev-parse --abbrev-ref HEAD) |
| 44 | + echo $$(git rev-parse --abbrev-ref HEAD) |
0 commit comments