<commit_before>PROJECT = "Frontend Dev Tools"

FDT_DIR ?= .
PATH  := $(FDT_DIR)/node_modules/.bin:$(PATH)
SHELL := /bin/bash

ifndef VERBOSE
	Q := @
	NIL := > /dev/null 2>&1
endif

NO_COLOR=\033[0m
OK_COLOR=\033[32;01m
OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)
AWK_CMD = awk '{ printf "%-30s %-10s\n",$$1, $$2; }'
PRINT_OK = printf "$@ $(OK_STRING)\n" | $(AWK_CMD)
NODE_ENV_STRING = $(OK_COLOR)[$(NODE_ENV)]$(NO_COLOR)
PRINT_ENV = printf "$@ $(NODE_ENV_STRING)\n" | $(AWK_CMD)


all: install lint test-once build
.PHONY: all

.PHONY: server-stage
server-stage: export NODE_ENV = stage
server-stage: build server

.PHONY: server-prod
server-prod: export NODE_ENV = production
server-prod: build server

.PHONY: server
server: export NODE_ENV ?= development
server:
	$(Q) node ${FDT_DIR}/dist/server

.PHONY: schema
schema:
	$(Q) node ${FDT_DIR}/dist/bin/updateRelaySchema

.PHONY: install
install:
	$(Q) npm install --loglevel error
	@$(PRINT_OK)

.PHONY: build
build: export NODE_ENV ?= stage
build: clean-dist
	@$(PRINT_ENV)
	$(Q) webpack --config ${FDT_DIR}/dist/webpack.config.js
	@$(PRINT_OK)

.PHONY: browser
browser:
	$(Q) wdio ${FDT_DIR}/dist/wdio.conf.js
	@$(PRINT_OK)

.PHONY: test-watch
test-watch: export BABEL_ENV=watch
test-watch: export TEST_ENV=watch
test-watch: test

.PHONY: test-ci
test-ci: export BABEL_ENV=ci
test-ci: export TEST_ENV=ci
test-ci: test

.PHONY: test-once
test-once: export BABEL_ENV=single
test-once: export TEST_ENV=single
test-once: test

.PHONY: test
test: export NODE_ENV ?= development
test:
	$(Q) karma start ${FDT_DIR}/dist/karma.config.js
	@$(PRINT_OK)

.PHONY: lint
lint:
	$(Q) eslint src --ext .js,.jsx
	@$(PRINT_OK)

.PHONY: clean
clean: clean-dist clean-deps
	@$(PRINT_OK)

.PHONY: clean-dist
clean-dist:
	$(Q) rm -rf dist
	@$(PRINT_OK)

.PHONY: clean-deps
clean-deps:
	$(Q) rm -rf node_modules
	@$(PRINT_OK)

.PHONY: update
update:
	$(Q) david
	@$(PRINT_OK)

.PHONY: upgrade
upgrade:
	$(Q) david update
	@$(PRINT_OK)

.PHONY: travis-before-script
travis-before-script:
	export DISPLAY=:99.0
	sh -e /etc/init.d/xvfb start
	sleep 3

.PHONY: travis-script
travis-script: lint test-ci

.PHONY: travis-after-success
travis-after-success:
	bash <(curl -s https://codecov.io/bash)

.PHONY: travis-docker-upload
travis-docker-upload:
ifdef DOCKER_IMAGE
	docker build -t ${DOCKER_IMAGE} .
<commit_msg>build ui before tests/docker<commit_after>PROJECT = "Frontend Dev Tools"

FDT_DIR ?= .
PATH  := $(FDT_DIR)/node_modules/.bin:$(PATH)
SHELL := /bin/bash

ifndef VERBOSE
	Q := @
	NIL := > /dev/null 2>&1
endif

NO_COLOR=\033[0m
OK_COLOR=\033[32;01m
OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)
AWK_CMD = awk '{ printf "%-30s %-10s\n",$$1, $$2; }'
PRINT_OK = printf "$@ $(OK_STRING)\n" | $(AWK_CMD)
NODE_ENV_STRING = $(OK_COLOR)[$(NODE_ENV)]$(NO_COLOR)
PRINT_ENV = printf "$@ $(NODE_ENV_STRING)\n" | $(AWK_CMD)


all: install lint test-once build
.PHONY: all

.PHONY: server-stage
server-stage: export NODE_ENV = stage
server-stage: build server

.PHONY: server-prod
server-prod: export NODE_ENV = production
server-prod: build server

.PHONY: server
server: export NODE_ENV ?= development
server:
	$(Q) node ${FDT_DIR}/dist/server

.PHONY: schema
schema:
	$(Q) node ${FDT_DIR}/dist/bin/updateRelaySchema

.PHONY: install
install:
	$(Q) npm install --loglevel error
	@$(PRINT_OK)

.PHONY: build
build: export NODE_ENV ?= stage
build: clean-dist
	@$(PRINT_ENV)
	$(Q) webpack --config ${FDT_DIR}/dist/webpack.config.js
	@$(PRINT_OK)

.PHONY: browser
browser:
	$(Q) wdio ${FDT_DIR}/dist/wdio.conf.js
	@$(PRINT_OK)

.PHONY: test-watch
test-watch: export BABEL_ENV=watch
test-watch: export TEST_ENV=watch
test-watch: test

.PHONY: test-ci
test-ci: export BABEL_ENV=ci
test-ci: export TEST_ENV=ci
test-ci: test

.PHONY: test-once
test-once: export BABEL_ENV=single
test-once: export TEST_ENV=single
test-once: test

.PHONY: test
test: export NODE_ENV ?= development
test:
	$(Q) karma start ${FDT_DIR}/dist/karma.config.js
	@$(PRINT_OK)

.PHONY: lint
lint:
	$(Q) eslint src --ext .js,.jsx
	@$(PRINT_OK)

.PHONY: clean
clean: clean-dist clean-deps
	@$(PRINT_OK)

.PHONY: clean-dist
clean-dist:
	$(Q) rm -rf dist
	@$(PRINT_OK)

.PHONY: clean-deps
clean-deps:
	$(Q) rm -rf node_modules
	@$(PRINT_OK)

.PHONY: update
update:
	$(Q) david
	@$(PRINT_OK)

.PHONY: upgrade
upgrade:
	$(Q) david update
	@$(PRINT_OK)

.PHONY: travis-before-script
travis-before-script:
	export DISPLAY=:99.0
	sh -e /etc/init.d/xvfb start
	NODE_ENV=production make build
	sleep 3

.PHONY: travis-script
travis-script: lint test-ci

.PHONY: travis-after-success
travis-after-success:
	bash <(curl -s https://codecov.io/bash)

.PHONY: travis-docker-upload
travis-docker-upload:
ifdef DOCKER_IMAGE
	docker build -t ${DOCKER_IMAGE} .

{'fraction_non_alphanumeric': 0.16239135043459826, 'fraction_numerical': 0.009751960992156031, 'mean_word_length': 4.51812865497076, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '149775', 'n_tokens_mistral': 2058, 'n_tokens_neox': 2020, 'n_words': 454}