.PHONY: bootstrap setup install test test-e2e test-e2e-firefox lint fmt fmt-check check check-censored docker hooks build build-debug verify-build vendor-blocklist clean dev

# Standard targets are thin shims; the implementations live in script/
# per the scripts-to-rule-them-all pattern (see the Entrypoints section
# of README.md).

bootstrap:
	@script/bootstrap

setup:
	@script/setup

install:
	@yarn install --frozen-lockfile

test:
	@script/test

# Browser end-to-end suites. Both require docker; neither is part of check.
test-e2e:
	@script/test-e2e

test-e2e-firefox:
	@script/test-e2e-firefox

lint:
	@script/lint

fmt:
	@script/fmt

fmt-check:
	@script/fmt-check

check:
	@script/check

# Assert that the competitor name appears nowhere but its documented
# exceptions. Part of check, and re-run against dist/ at the end of a build;
# separate target for re-running it alone.
check-censored:
	@script/check-censored

docker:
	@script/docker

hooks:
	@script/install-precommit

build:
	@echo "Building extension..."
	@yarn run build 2>&1
	@script/verify-build
	@script/check-censored --require-dist

# Development-only build: enables the red DEBUG / INSECURE banner and makes
# the hardcoded test recovery phrase the output of wallet creation. Never
# distribute the artifacts this produces.
build-debug:
	@echo "Building extension (DEBUG)..."
	@AUTISTMASK_DEBUG=1 yarn run build 2>&1
	@AUTISTMASK_DEBUG=1 script/verify-build
	@script/check-censored --require-dist

# Assert the compiled DEBUG state of the bundles already in dist/. Runs at
# the end of build and build-debug; separate target for re-running it alone.
verify-build:
	@script/verify-build

# Refresh src/shared/phishingBlocklist.json from its hash-pinned upstream.
# Run deliberately, land the diff: the extension does no runtime fetching, so
# the shipped list is as fresh as the last vendoring run that was released.
vendor-blocklist:
	@script/vendor-blocklist

clean:
	@rm -rf dist/

dev:
	@echo "Building in watch mode..."
	@yarn run build --watch 2>&1
