mirror of
https://github.com/imjasonh/apidiff-action
synced 2026-07-06 22:52:43 +00:00
- Add Node version check to build-dist pre-commit hook - Create helper script to switch to Node 20 - Update documentation with clear instructions - Fix YAML syntax in pre-commit config This ensures dist is always built with Node 20, preventing CI failures due to version mismatches. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
44 lines
1.4 KiB
YAML
44 lines
1.4 KiB
YAML
repos:
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: v4.5.0
|
|
hooks:
|
|
- id: trailing-whitespace
|
|
exclude: ^dist/
|
|
- id: end-of-file-fixer
|
|
exclude: ^dist/
|
|
- id: check-yaml
|
|
- id: check-added-large-files
|
|
exclude: ^dist/
|
|
- id: check-json
|
|
- id: pretty-format-json
|
|
args: ['--autofix']
|
|
exclude: ^package-lock\.json$
|
|
|
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
|
rev: v3.1.0
|
|
hooks:
|
|
- id: prettier
|
|
exclude: ^(dist/|.*\.md$)
|
|
|
|
- repo: https://github.com/pre-commit/mirrors-eslint
|
|
rev: v8.56.0
|
|
hooks:
|
|
- id: eslint
|
|
files: \.js$
|
|
args: ['--fix']
|
|
exclude: ^dist/
|
|
|
|
- repo: local
|
|
hooks:
|
|
- id: build-dist
|
|
name: Build dist
|
|
entry: bash -c 'node_version=$(node --version); if [[ ! "$node_version" =~ ^v20\. ]]; then echo "Error - Node.js v20 is required (found $node_version). Use nvm to switch to Node 20."; exit 1; fi; npm run build'
|
|
language: system
|
|
pass_filenames: false
|
|
files: ^(index\.js|lib/.*\.js)$
|
|
- id: check-dist
|
|
name: Check dist is up to date
|
|
entry: bash -c 'if [ -n "$(git status --porcelain dist)" ]; then echo "dist is out of date. Run npm run build and commit the changes."; exit 1; fi'
|
|
language: system
|
|
pass_filenames: false
|
|
always_run: true
|