<commit_before># General configuration
# --------------------
host = "http://localhost"
port = 3000
sync = true
local-modules = true
admin-cmd = 'sudo'
prod = false
docs = false

ifeq ($(local-modules), true)
	cmd-prefix = $(shell npm bin)/
else
	cmd-prefix = ''
endif

# Build tools
# --------------------
.PHONY: all watch install

all: dist/styles/main.css dist/scripts/main.js dist/scripts/vendor.js

# Watch
# NOTE On OSX, overwrite watch native command:
# brew install watch
# brew info watch # read watch path
# sudo mv <path_to_watch>/bin/watch /usr/local/bin
watch:
ifeq ($(sync), true)
	@ $(cmd-prefix)browser-sync start -p $(host) --port $(port) --files "index.html" "public" --no-open &> /dev/null | \
	watch -t -n 1 "make all && echo '-- Browser-sync listening on $(host):$(port)'"
else
	@ watch -t -n 1 make all
endif

# Concat & minify styles & scripts
dist/styles/main.css: assets/styles/*.scss assets/styles/**/*.scss
	@ $(cmd-prefix)node-sass --output-style=compressed assets/styles/main.scss -o dist/styles/ --source-map dist/styles/
	@ echo "› $@ has been updated"

dist/scripts/main.js: assets/scripts/*.js
	@ $(cmd-prefix)uglifyjs assets/scripts/*.js -o dist/scripts/main.js --source-map dist/scripts/main.js.map -p relative
	@ echo "› $@ has been updated"

dist/scripts/vendor.js: $(VENDOR)
VENDOR = $(shell $(cmd-prefix)bower-files js)
ifeq ($(VENDOR), all)
	@ $(cmd-prefix)uglifyjs $(VENDOR) -o dist/scripts/vendor.js --source-map dist/scripts/vendor.js.map -p relative
	@ echo "› $@ has been updated"
endif

# Install dependencies
install:
	@ echo "› Checking NPM dependencies:"
ifeq ($(local-modules), true)
	@ npm install
else
	@ $(admin-cmd) npm install -g
endif
	@ echo "› Done. Installing frond-end dependencies:"
	@ bower install --allow-root
	@ echo "› Done. Creating folders:"
	@ for dir in "dist/styles" "dist/scripts";do mkdir -p $$dir && echo "$$dir created.";done
ifeq ($(docs), true)
	@ echo "› Building docs/ folder:"
	@ mkdir -p docs/
	@ cp -r dist docs/
	@ mv index.html README.md guidelines.md _coverpage.md docs/
else
	@ rm -f index.html README.md guidelines.md _coverpage.md
endif
	@ echo "› Installation done, start with \"make watch\"."


# Build commands
# --------------------
.PHONY: build styles scripts fonts images

build:
	@ make styles
	@ make scripts
	@ make fonts
	@ make images

styles:
	@ echo "› Building styles:"
	@ rm -rf dist/styles && mkdir -p dist/styles
	@ make dist/styles/main.css
ifeq ($(prod), true)
	@ cat dist/styles/*.css > dist/styles/build.css
endif
	@ echo "› Done."

scripts:
	@ echo "› Building scripts:"
	@ rm -rf dist/scripts && mkdir -p dist/scripts
	@ make dist/scripts/main.js
	@ make dist/scripts/vendor.js
ifeq ($(prod), true)
	@ cat dist/scripts/*.js > dist/styles/build.js
endif
	@ echo "› Done."

fonts:
	@ echo "› Moving fonts:"
	@ rm -rf dist/fonts
	cp -r assets/fonts dist
	@ echo "› Done."

images:
	@ echo "› Optimizing images:"
	@ rm -rf dist/images
	@ for dir in $$(find assets/images -type d);do mkdir -p dist/$${dir#*/} && echo dist/$${dir#*/} && $(cmd-prefix)imagemin $${dir}/* -o dist/$${dir#*/};done
	@ echo "› Done."
<commit_msg>update makefile<commit_after># General configuration
# --------------------
# constants
GLOBAL_MODULES = $(GLOBBOX_GLOBAL || false)
ifeq ($(GLOBAL_MODULES), true)
	NPM_PREFIX = ''
else
	NPM_PREFIX = 'node_modules/.bin/'
endif

# browser-sync
host = "http://localhost"
port = 3000
sync = true

# install
docs = false



# Dev tools
# --------------------
.PHONY: all watch install

all: dist/styles/main.css dist/scripts/main.js

# Watch
# NOTE On OSX, overwrite watch native command:
# brew install watch
# brew info watch # read watch path
# sudo mv <path_to_watch>/bin/watch /usr/local/bin
watch:
ifeq ($(sync), true)
	@ $(NPM_PREFIX)browser-sync start -p $(host) --port $(port) --files "index.html" "public" --no-open &> /dev/null | \
	watch -t -n 1 "make all && echo '-- Browser-sync listening on $(host):$(port)'"
else
	@ watch -t -n 1 make all
endif

# Concat & minify styles & scripts
dist/styles/main.css: assets/styles/*.scss assets/styles/**/*.scss
	@ $(NPM_PREFIX)node-sass --output-style=compressed assets/styles/main.scss -o dist/styles/ --source-map dist/styles/
	@ echo "› $@ has been updated"

dist/scripts/main.js: assets/scripts/*.js
	@ $(NPM_PREFIX)uglifyjs assets/scripts/*.js -o dist/scripts/main.js --source-map dist/scripts/main.js.map -p relative
	@ echo "› $@ has been updated"

# Install dependencies
install:
ifeq ($(GLOBAL_MODULES), true)
	@ echo "› Checking NPM dependencies:"
	@ npm install
else
	@ echo "› Global mode: make sure NPM dependencies are installed globally (check package.json)."
endif
	@ echo "› Done. Installing frond-end dependencies:"
	@ bower install --allow-root
	@ echo "› Done. Creating folders:"
	@ for dir in "dist/styles" "dist/scripts";do mkdir -p $$dir && echo "$$dir created.";done
ifeq ($(docs), true)
	@ echo "› Building docs/ folder:"
	@ mkdir -p docs/
	@ cp -r dist docs/
	@ mv index.html README.md guidelines.md _coverpage.md docs/
else
	@ rm -f index.html README.md guidelines.md _coverpage.md
endif
	@ echo "› Installation done, start with \"make watch\"."



# Build commands
# --------------------
.PHONY: build styles scripts vendor fonts images

build:
	@ make styles
	@ make scripts
	@ make fonts
	@ make images

styles:
	@ echo "› Building styles:"
	@ rm -rf dist/styles && mkdir -p dist/styles
	@ make dist/styles/main.css
	@ echo "› Done."

scripts:
	@ echo "› Building scripts:"
	@ rm -rf dist/scripts && mkdir -p dist/scripts
	@ make dist/scripts/main.js
	@ make vendor
	@ echo "› Done."

vendor:
	@ echo "› Building vendor scripts:"
	@ $(NPM_PREFIX)uglifyjs $(shell $(NPM_PREFIX)bower-files js) -o dist/scripts/vendor.js --source-map dist/scripts/vendor.js.map -p relative
	@ echo "› dist/scripts/vendor.js has been updated"

fonts:
	@ echo "› Moving fonts:"
	@ rm -rf dist/fonts
	cp -r assets/fonts dist
	@ echo "› Done."

images:
	@ echo "› Optimizing images:"
	@ rm -rf dist/images
	@ for dir in $$(find assets/images -type d);do mkdir -p dist/$${dir#*/} && echo dist/$${dir#*/} && $(NPM_PREFIX)imagemin $${dir}/* -o dist/$${dir#*/};done
	@ echo "› Done."

{'fraction_non_alphanumeric': 0.1792667099286178, 'fraction_numerical': 0.001946787800129786, 'mean_word_length': 3.2664359861591694, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '991764', 'n_tokens_mistral': 2206, 'n_tokens_neox': 2171, 'n_words': 667}