chore: rework Makefile to not depend on direnv

This commit is contained in:
Steven Arcangeli 2024-11-10 16:38:45 -08:00
parent 2f5d4353ee
commit 3499e26ef4
4 changed files with 33 additions and 7 deletions

1
.envrc
View file

@ -1 +1,2 @@
export VIRTUAL_ENV=venv
layout python

1
.gitignore vendored
View file

@ -44,6 +44,7 @@ __pycache__
.direnv/
.testenv/
venv/
doc/tags
scripts/nvim_doc_tools
scripts/nvim-typecheck-action

View file

@ -1,19 +1,37 @@
.PHONY: all doc test lint fastlint clean
## help: print this help message
.PHONY: help
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
## all: generate docs, lint, and run tests
.PHONY: all
all: doc lint test
doc: scripts/nvim_doc_tools
python scripts/main.py generate
python scripts/main.py lint
venv:
python3 -m venv venv
venv/bin/pip install -r scripts/requirements.txt
## doc: generate documentation
.PHONY: doc
doc: scripts/nvim_doc_tools venv
venv/bin/python scripts/main.py generate
venv/bin/python scripts/main.py lint
## test: run tests
.PHONY: test
test:
./run_tests.sh
## lint: run linters and LuaLS typechecking
.PHONY: lint
lint: scripts/nvim-typecheck-action fastlint
./scripts/nvim-typecheck-action/typecheck.sh --workdir scripts/nvim-typecheck-action lua
fastlint: scripts/nvim_doc_tools
python scripts/main.py lint
## fastlint: run only fast linters
.PHONY: fastlint
fastlint: scripts/nvim_doc_tools venv
venv/bin/python scripts/main.py lint
luacheck lua tests --formatter plain
stylua --check lua tests
@ -23,5 +41,7 @@ scripts/nvim_doc_tools:
scripts/nvim-typecheck-action:
git clone https://github.com/stevearc/nvim-typecheck-action scripts/nvim-typecheck-action
## clean: reset the repository to a clean state
.PHONY: clean
clean:
rm -rf scripts/nvim_doc_tools scripts/nvim-typecheck-action
rm -rf scripts/nvim_doc_tools scripts/nvim-typecheck-action venv .testenv

4
scripts/requirements.txt Normal file
View file

@ -0,0 +1,4 @@
pyparsing==3.0.9
black
isort
mypy