Fix build-js pre-commit hook

Only run when main_inventory is run & discard parameters
passed by pre-commit which breaks babel command
This commit is contained in:
Santiago L 2022-09-29 12:04:05 +02:00
parent 7335c04f8e
commit df73cd5657
2 changed files with 5 additions and 1 deletions

View File

@ -19,5 +19,9 @@ repos:
hooks: hooks:
- id: build-js - id: build-js
name: build-js name: build-js
# pre-commit pass as parameters files included on the commit
# so babel command should be wrapped to ignore these files on
# package.json script
entry: npm run babel entry: npm run babel
language: node language: node
files: ^ereuse_devicehub/static/js/main_inventory.js

View File

@ -21,7 +21,7 @@
"scripts": { "scripts": {
"lint:report": "eslint ereuse_devicehub --ext .js --output-file eslint_report.json --format json", "lint:report": "eslint ereuse_devicehub --ext .js --output-file eslint_report.json --format json",
"lint:fix": "eslint ereuse_devicehub --ext .js --fix", "lint:fix": "eslint ereuse_devicehub --ext .js --fix",
"babel": "babel ereuse_devicehub/static/js/main_inventory.js --out-file ereuse_devicehub/static/js/main_inventory.build.js" "babel": "babel ereuse_devicehub/static/js/main_inventory.js --out-file ereuse_devicehub/static/js/main_inventory.build.js && echo 'Ignoring parameters: '"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",