mirror of
https://github.com/sbrl/Nibriboard.git
synced 2018-01-10 21:33:49 +00:00
Start working on es6 validation bash script that uses acorn
This commit is contained in:
parent
56b1cb5148
commit
23af3da0df
2 changed files with 18 additions and 0 deletions
|
@ -18,6 +18,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"test": "echo There aren\\'t any tests yet!",
|
||||
"prebuild": "./validate.sh",
|
||||
"build": "browserify $npm_package_main -t rollupify -o $npm_package_config_bundle_file"
|
||||
},
|
||||
"repository": {
|
||||
|
|
17
Nibriboard/ClientFiles/validate.sh
Normal file
17
Nibriboard/ClientFiles/validate.sh
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
find . -name "*.js" -not -path "./node_modules/*" | while read filename;
|
||||
do
|
||||
validate_result=$(node_modules/.bin/acorn --module --silent $filename 2>&1);
|
||||
validate_exit_code=$?;
|
||||
validate_output=$([[ ${validate_exit_code} -eq 0 ]] && echo ok || echo ${validate_result});
|
||||
echo ${filename}: ${validate_output}
|
||||
# TODO: Use /dev/shm here since apparently while is in a subshell, so it can't modify variables in the main program O.o
|
||||
if ! [ ${validate_exit_code} -eq 0 ]; then
|
||||
echo incrementing ${error_count} \($(expr ${error_count} + 1)\)
|
||||
error_count=$(expr ${error_count} + 1);
|
||||
fi
|
||||
done
|
||||
|
||||
echo
|
||||
echo Errors: $error_count
|
Loading…
Reference in a new issue