mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2026-09-02 21:03:34 +03:00
# Description of Changes The `pre-commit` commands in this repo are inconsistent with the rest of the dev workflow, as they are impossible to run through Task and they can cause CI to fail with no way for a developer to run the `pre-commit` scripts after they've failed. This PR adds `task pre-commit` (and `task pre-commit:fix`) and then hooks up the existing `pre-commit` hooks and CI to call the Task rule, so if developers are using pre-commit hooks then they should still work, but they're also runnable without using pre-commit at all. I think it'd be worth reviewing what we're actually running at pre-commit in the future because I'm not entirely convinced by all of the scripts that we are running, but this should at least make what we have properly enforced and usable by all devs.
49 lines
1.5 KiB
Batchfile
49 lines
1.5 KiB
Batchfile
@echo off
|
|
REM --------------------------------------------------
|
|
REM Batch script to (re-)generate all requirements
|
|
REM with check for pip-compile and user confirmation
|
|
REM --------------------------------------------------
|
|
|
|
REM Check if pip-compile is available
|
|
pip-compile --version >nul 2>&1
|
|
if %ERRORLEVEL% neq 0 (
|
|
echo ERROR: pip-compile was not found.
|
|
echo Please install pip-tools:
|
|
echo pip install pip-tools
|
|
echo and ensure that pip-compile is in your PATH.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo pip-compile detected.
|
|
|
|
REM Prompt user for confirmation (default = Yes on ENTER)
|
|
set /p confirm="Do you want to generate all requirements? [Y/n] "
|
|
if /I "%confirm%"=="" set confirm=Y
|
|
|
|
if /I not "%confirm%"=="Y" (
|
|
echo Generation cancelled by user.
|
|
pause
|
|
exit /b 0
|
|
)
|
|
|
|
echo Starting generation...
|
|
|
|
echo Generating .github\scripts\requirements_dev.txt
|
|
pip-compile --allow-unsafe --generate-hashes --upgrade --strip-extras ^
|
|
--output-file=".github\scripts\requirements_dev.txt" ^
|
|
".github\scripts\requirements_dev.in"
|
|
|
|
echo Generating .github\scripts\requirements_sync_readme.txt
|
|
pip-compile --generate-hashes --upgrade --strip-extras ^
|
|
--output-file=".github\scripts\requirements_sync_readme.txt" ^
|
|
".github\scripts\requirements_sync_readme.in"
|
|
|
|
echo Generating testing\cucumber\requirements.txt
|
|
pip-compile --generate-hashes --upgrade --strip-extras ^
|
|
--output-file="testing\cucumber\requirements.txt" ^
|
|
"testing\cucumber\requirements.in"
|
|
|
|
echo All done!
|
|
pause
|