From df73cd5657a9645fb99e6ccc61d7610c278abe7b Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Thu, 29 Sep 2022 12:04:05 +0200 Subject: [PATCH] Fix build-js pre-commit hook Only run when main_inventory is run & discard parameters passed by pre-commit which breaks babel command --- .pre-commit-config.yaml | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 35bfc9bf..8d1307be 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,5 +19,9 @@ repos: hooks: - id: 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 language: node + files: ^ereuse_devicehub/static/js/main_inventory.js diff --git a/package.json b/package.json index 4cb22b4e..21df849b 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "scripts": { "lint:report": "eslint ereuse_devicehub --ext .js --output-file eslint_report.json --format json", "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": [], "author": "",