diff --git a/Makefile b/Makefile index ab95f845..a302ba1f 100644 --- a/Makefile +++ b/Makefile @@ -2,41 +2,43 @@ .DEFAULT_GOAL := help +NPM_BIN = $(shell npm bin) + +# Generates a help message. Borrowed from https://github.com/pydanny/cookiecutter-djangopackage. help: ## display this help message @echo "Please use \`make ' where is one of" - @perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}' + @perl -nle'print $& if m{^[\.a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}' install: ## install requirements npm install clean: ## remove build artifacts - rm -rf css/ - rm -rf samples/css/ - rm -rf samples/edx-bootstrap/ - -samples: clean ## build the samples - mkdir samples/edx-bootstrap - cp -r sass/ samples/edx-bootstrap/sass - mkdir samples/css - mkdir samples/css/edx - mkdir samples/css/open-edx - ./node_modules/node-sass/bin/node-sass samples/edx/sass --output samples/edx/css --include-path samples --include-path node_modules - ./node_modules/node-sass/bin/node-sass samples/open-edx/sass --output samples/open-edx/css --include-path samples --include-path node_modules - ./node_modules/.bin/opn samples/index.html - -build: clean ## build the npm package - -preview: samples ## build the preview site - aws s3 sync samples s3://${S3_PREVIEW_DOMAIN}/$(shell git rev-parse --abbrev-ref HEAD) - @echo Preview generated to http://${S3_PREVIEW_DOMAIN}/$(shell git rev-parse --abbrev-ref HEAD) + rm -rf {css,samples/{css,edx-bootstrap}} + +build.samples: clean ## build the samples + $(eval $@_INCLUDE = --include-path samples --include-path node_modules) + mkdir -p samples/edx-bootstrap + mkdir -p samples/css/{edx,open-edx} + cp -R sass/ samples/edx-bootstrap/sass + $(NPM_BIN)/node-sass samples/edx/sass --output samples/edx/css $($@_INCLUDE) + $(NPM_BIN)/node-sass samples/open-edx/sass --output samples/open-edx/css $($@_INCLUDE) + +samples: clean build.samples ## build and show the samples + $(NPM_BIN)/opn samples/index.html + +preview: build.samples ## build the preview site + $(eval $@_REF = $(shell git rev-parse --abbrev-ref HEAD)) + aws s3 sync samples s3://${S3_PREVIEW_DOMAIN}/$($@_REF) + @echo Preview generated to http://${S3_PREVIEW_DOMAIN}/$($@_REF) + $(NPM_BIN)/opn http://${S3_PREVIEW_DOMAIN}/$($@_REF) quality: - ./node_modules/stylelint/bin/stylelint.js sass/**/*.scss samples/**/*.scss + $(NPM_BIN)/stylelint sass/**/*.scss samples/**/*.scss fix: - ./node_modules/stylelint/bin/stylelint.js sass/**/*.scss samples/**/*.scss --fix + $(NPM_BIN)/stylelint sass/**/*.scss samples/**/*.scss --fix -test: clean quality ## run tests +test: clean quality build.samples ## run tests xxx: - echo $(shell git rev-parse --abbrev-ref HEAD) + echo $$(git rev-parse --abbrev-ref HEAD) diff --git a/package-lock.json b/package-lock.json index 451635ce..54997bd5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@edx/edx-bootstrap", - "version": "0.3.3", + "version": "0.3.4", "lockfileVersion": 1, "requires": true, "dependencies": {