-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (63 loc) · 3.04 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
.DEFAULT_GOAL := help
.PHONY: install
install: ## Install the dependencies
python3 -m pip install --upgrade pip
python3 -m pip install -e .
.PHONY: jsinstall
jsinstall: ## Install the JS dependencies
npm install
npm run vendors
.PHONY: develop
develop: ## Install the test and dev dependencies
python3 -m pip install -e .[dev]
.PHONY: pretty-templates
pretty-templates: ## Prettify template files
djlint umap_dsfr/templates --reformat
.PHONY: lint-templates
lint-templates: ## Lint template files
djlint umap_dsfr/templates --lint
.PHONY: dsfr-lite
dsfr-lite: ## Copy DSFR pertinent files and purge the huge CSS
mkdir -p umap_dsfr/static/umap/dsfr-lite
cp -R node_modules/@gouvfr/dsfr/dist/fonts umap_dsfr/static/umap/dsfr-lite
cp -R node_modules/@gouvfr/dsfr/dist/icons umap_dsfr/static/umap/dsfr-lite
cp -R node_modules/@gouvfr/dsfr/dist/artwork/pictograms umap_dsfr/static/umap/dsfr-lite
cp -R node_modules/@gouvfr/dsfr/dist/dsfr.module.js umap_dsfr/static/umap/dsfr-lite
gsed -i '/^\/\/ import/d' umap_dsfr/static/umap/dsfr-lite/dsfr.module.js
cp -R node_modules/@gouvfr/dsfr/dist/dsfr.module.js.map umap_dsfr/static/umap/dsfr-lite
./node_modules/purgecss/bin/purgecss.js --config purgecss.config.js
# Maybe not Linux-compatible? https://stackoverflow.com/a/22122819
sed -i '' 's/..\/..\///g' umap_dsfr/static/umap/dsfr-lite/icons.min.css
sed -i '' 's/#E1000F/#009081/g' umap_dsfr/static/umap/dsfr-lite/pictograms/map/map.svg
sed -i '' 's/#E1000F/#009081/g' umap_dsfr/static/umap/dsfr-lite/pictograms/map/location-france.svg
sed -i '' 's/#E1000F/#009081/g' umap_dsfr/static/umap/dsfr-lite/pictograms/digital/avatar.svg
# See https://github.com/GouvernementFR/dsfr/issues/617
sed -i '' 's/ \/\*! media sm \*\///g' umap_dsfr/static/umap/dsfr-lite/dsfr.min.css
sed -i '' 's/ \/\*! media md \*\///g' umap_dsfr/static/umap/dsfr-lite/dsfr.min.css
sed -i '' 's/ \/\*! media lg \*\///g' umap_dsfr/static/umap/dsfr-lite/dsfr.min.css
sed -i '' 's/ \/\*! media xl \*\///g' umap_dsfr/static/umap/dsfr-lite/dsfr.min.css
sed -i '' 's/ \/\*! media sm \*\///g' umap_dsfr/static/umap/dsfr-lite/icons.min.css
sed -i '' 's/ \/\*! media md \*\///g' umap_dsfr/static/umap/dsfr-lite/icons.min.css
sed -i '' 's/ \/\*! media lg \*\///g' umap_dsfr/static/umap/dsfr-lite/icons.min.css
sed -i '' 's/ \/\*! media xl \*\///g' umap_dsfr/static/umap/dsfr-lite/icons.min.css
.PHONY: help
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
# See https://daniel.feldroy.com/posts/autodocumenting-makefiles
define PRINT_HELP_PYSCRIPT # start of Python section
import re, sys
output = []
# Loop through the lines in this file
for line in sys.stdin:
# if the line has a command and a comment start with
# two pound signs, add it to the output
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
output.append("\033[36m%-20s\033[0m %s" % (target, help))
# Sort the output in alphanumeric order
output.sort()
# Print the help result
print('\n'.join(output))
endef
export PRINT_HELP_PYSCRIPT # End of python section