Files
setup-task/Taskfile.yml
2021-05-10 02:41:27 -07:00

102 lines
2.4 KiB
YAML

version: "3"
tasks:
build:
desc: Build the project
deps:
- task: ts:build
format:
desc: Format all files
deps:
- task: general:format
check:
desc: Check for problems with the project
deps:
- task: ts:test
- task: action:validate
- task: markdown:lint
- task: general:check-spelling
ts:install-deps:
desc: Install TypeScript dependencies
cmds:
- npm install
ts:build:
desc: Build the action's TypeScript code.
deps:
- task: ts:install-deps
cmds:
- npx tsc
- npx ncc build
ts:test:
desc: Test the action's TypeScript code.
deps:
- task: ts:install-deps
cmds:
- npx jest
ts:lint:
desc: Lint TypeScript code
deps:
- task: ts:install-deps
cmds:
- npx eslint --ext .js,.jsx,.ts,.tsx .
ts:fix-lint:
desc: Fix TypeScript code linting violations
deps:
- task: ts:install-deps
cmds:
- npx eslint --ext .js,.jsx,.ts,.tsx --fix .
action:validate:
desc: Validate GitHub Actions metadata against JSON schema
vars:
ACTION_METADATA_SCHEMA_PATH:
sh: mktemp -t github-action-schema-XXXXXXXXXX.json
cmds:
- wget --quiet --output-document="{{.ACTION_METADATA_SCHEMA_PATH}}" https://json.schemastore.org/github-action
- npx ajv-cli validate --strict=false -s "{{.ACTION_METADATA_SCHEMA_PATH}}" -d "action.yml"
markdown:lint:
desc: Check for problems in Markdown files
cmds:
- npx markdownlint-cli "**/*.md"
markdown:check-links:
desc: Check for broken links
cmds:
- |
# NOTE: npx --call uses the native shell, so this task can't be used on Windows.
npx --package=markdown-link-check --call='
STATUS=0
for file in $(find -name "*.md"); do
markdown-link-check \
--quiet \
--config "./.markdown-link-check.json" \
"$file"
STATUS=$(( $STATUS + $? ))
done
exit $STATUS'
general:format:
desc: Format all supported files with Prettier
cmds:
- npx prettier --write .
general:check-spelling:
desc: Check for commonly misspelled words
cmds:
- poetry install --no-root
- poetry run codespell
general:correct-spelling:
desc: Correct commonly misspelled words where possible
cmds:
- poetry install --no-root
- poetry run codespell --write-changes