feat: add preset resolver

This commit is contained in:
2023-03-21 20:19:27 +03:00
parent 81c704576a
commit 265c80f082
12 changed files with 183 additions and 126 deletions
@@ -0,0 +1,18 @@
[presets.nodejs]
conditions = ["file(package.json)"]
[presets.nodejs.tasks.setup.npm]
conditions = ["file(package-lock.json)"]
commands = ["npm install-clean --legacy-peer-deps"]
[presets.nodejs.tasks.setup.npm-legacy]
conditions = ["file(package-lock.json) | not"]
commands = ["npm install --legacy-peer-deps"]
[presets.nodejs.tasks.test.jest]
conditions = ["file(node_modules/jest)"]
commands = ["npx jest"]
[presets.nodejs.tasks.clean.node_modules]
conditions = ["file(node_modules)"]
commands = ["rm -rf node_modules"]
@@ -0,0 +1,33 @@
[presets.python]
conditions = ["file(pyproject.toml)"]
[presets.python.tasks.setup.poetry]
conditions = [
"file(pyproject.toml) | get(build-system.build-backend) | equal(poetry.core.masonry.api)",
]
variables.python_version = "file(pyproject.toml) | get(tool.poetry.dependencies.python) | search((\\d.\\d))"
commands = ["poetry env use {python_version}", "poetry install"]
[presets.python.tasks.test.pytest]
conditions = ["file(.venv/bin/pytest)"]
commands = [".venv/bin/pytest -p no:warnings"]
[presets.python.tasks.lint.isort]
conditions = ["file(.venv/bin/isort)"]
commands = [".venv/bin/isort --profile black --check-only ./"]
[presets.python.tasks.format.isort]
conditions = ["file(.venv/bin/isort)"]
commands = [".venv/bin/isort ./"]
[presets.python.tasks.lint.black]
conditions = ["file(.venv/bin/black)"]
commands = [".venv/bin/black --check --diff ./"]
[presets.python.tasks.format.black]
conditions = ["file(.venv/bin/black)"]
commands = [".venv/bin/black ./"]
[presets.python.tasks.clean.venv]
conditions = ["file(.venv)"]
commands = ["rm -rf .venv"]