Skip to content

Commit

Permalink
Replace tox with taskfile as build tool
Browse files Browse the repository at this point in the history
As neither tox nor npm are really suitable as build build, especially
for mixed (ts/py) projects, we start using a task.

Related: ansible/vscode-ansible#511
Related: ansible/schemas#311
  • Loading branch information
ssbarnea committed Jun 12, 2022
1 parent 19c3dc6 commit 0b574e4
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 192 deletions.
1 change: 1 addition & 0 deletions .config/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ autoupdate
backticks
cacheable
chronographer
cmds
codeclimate
codecov
commitish
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ change-notes-*.md
# Ignored because we support multiple versions and switch between them
.nvmrc
.node-version
.task
130 changes: 130 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# see https://taskfile.dev/#/
version: "3"
output: group
vars:
VERSION:
sh: node -p "require('./package.json').version"
tasks:
default:
desc: Run most commands
deps:
- lint
# - package
cmds:
- echo Done {{.VERSION}}!
docs:
desc: Build the documentation
vars:
envdir: ../.tox/docs
temp_dir: ../.tox/docs/tmp
sphinx_common_args: '-j auto --color -a -n -W --keep-going -T -d "{{.temp_dir}}/.doctrees" . "{{.envdir}}/docs_out"'
dir: docs
cmds:
- python3 -m venv .tox/docs
- >
source ../.tox/docs/bin/activate &&
pip install "..[docs]" &&
python -m sphinx -b html {{.sphinx_common_args}}
setup:
desc: Install dependencies
cmds:
- bash ./tools/test-setup.sh
- python3 -m pip install --user pre-commit
- npm ci
sources:
- bash tools/test-setup.sh
- package.json
- package-lock.json
build:
desc: Build the project
deps:
- setup
cmds:
- npm run compile && sleep 1
sources:
- package-lock.json
- package.json
- src/
- tsconfig.json
- webpack.config.js
code:
desc: Forced install of extension in your code instance
deps:
- package
cmds:
- npm run package && code --force --install-extension *.vsix
deps:
desc: Update dependencies
deps:
- setup
cmds:
- bash -c "PIP_CONSTRAINTS= pip-compile -q --extra docs --extra test --strip-extras --no-annotate setup.cfg -o requirements.txt"
- python3 -m pre_commit autoupdate
# bumps some developments dependencies
- npx ncu -u --dep dev
# running install after ncu is needed in order to update the lock file
- npm install
lint:
desc: Lint the project
deps:
- setup
env:
PRE_COMMIT_COLOR: always
cmds:
- python3 -m pre_commit run -a
silent: true
sources:
- "*.*"
- .config
- .github
- .vscode
- doc
- examples
- images
- src
- syntaxes
- test
- tools
test:
desc: Run all tests
deps:
- setup
cmds:
- npm run test
interactive: true
test-with-ee:
desc: Run only ee tests
deps:
- setup
cmds:
- npm run test-with-ee
interactive: true
test-without-ee:
desc: Run only non-ee tests
deps:
- setup
cmds:
- npm run test-without-ee
interactive: true
package:
desc: Package extension
deps:
- build
sources:
- CHANGELOG.md
- README.md
- package*.json
- out/
generates:
- "*.vsix"
cmds:
- rm -f *.tgz
- npm pack
silent: false
pr:
desc: Opens a pull request using gh
deps:
- lint
cmds:
- gh pr create
interactive: true
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@
"clean": "rimraf out/server && rimraf lib",
"compile": "tsc -p .",
"coverage": "nyc report --reporter=text-lcov > out/coverage.lcov",
"deps": "ncu -u && npm install",
"lint": "pre-commit run -a",
"prepack": "npm ci && npm run compile",
"//prepare": "Prepare is needed for installation from source",
"prepare": "npm run compile",
Expand Down
190 changes: 0 additions & 190 deletions tox.ini

This file was deleted.

0 comments on commit 0b574e4

Please sign in to comment.