Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,22 @@ def run_command(command):
sys.exit(returncode)


def run_command_loose(command):
print(f"Running '{command}'")
process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
for c in iter(lambda: process.stdout.read(1), b""):
sys.stdout.buffer.write(c)

returncode = process.wait()
if returncode != 0:
print(f"Warning: '{command}' failed with exit code {returncode}")


run_command('make all')
run_command('make lock')
run_command('make chores')

chore_targets = ['ruff_fixes', 'black_fixes', 'prettier_fixes', 'tomlsort_fixes']
if INCLUDE_SQLALCHEMY:
chore_targets.append('document_schema')
for target in chore_targets:
run_command_loose(f'make {target}')
2 changes: 2 additions & 0 deletions {{cookiecutter.__package_slug}}/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ black_fixes:

.PHONY: prettier_fixes
prettier_fixes:
@command -v npx >/dev/null 2>&1 || { echo >&2 "Error: npx is not installed. Please install Node.js (https://nodejs.org/) to use prettier."; exit 1; }
npx --yes prettier --write . --log-level warn

.PHONY: tomlsort_fixes
Expand Down Expand Up @@ -114,6 +115,7 @@ mypy_check:

.PHONY: prettier_check
prettier_check:
@command -v npx >/dev/null 2>&1 || { echo >&2 "Error: npx is not installed. Please install Node.js (https://nodejs.org/) to use prettier."; exit 1; }
npx --yes prettier --check . --log-level warn

.PHONY: tomlsort_check
Expand Down