mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-03 19:56:22 -07:00
Add eslint to build.py
This commit is contained in:
parent
cb4d3f4e82
commit
9cc115f0d8
1 changed files with 22 additions and 1 deletions
21
build.py
21
build.py
|
@ -382,6 +382,16 @@ def js(watch=False):
|
|||
print("JS transpiling failed with status", status)
|
||||
sys.exit(status)
|
||||
|
||||
def eslint(fix=False):
|
||||
print("Running eslint")
|
||||
npm_cmd = "npm --prefix frontend/ run eslint"
|
||||
if fix:
|
||||
npm_cmd += " --fix"
|
||||
|
||||
status = run_cmd(npm_cmd, True, True, True)[1]
|
||||
if status != 0:
|
||||
print("ESLint failed with status", status)
|
||||
sys.exit(status)
|
||||
|
||||
def release(goos):
|
||||
set_vars(goos)
|
||||
|
@ -504,7 +514,18 @@ if __name__ == "__main__":
|
|||
"--watch",
|
||||
action="store_true",
|
||||
help="automatically rebuild when you change a file (keeps running)")
|
||||
parser.add_argument(
|
||||
"--eslint",
|
||||
action="store_true",
|
||||
help="Run eslint on the JavaScript code to check for possible problems")
|
||||
parser.add_argument(
|
||||
"--eslint-fix",
|
||||
action="store_true",
|
||||
help="Run eslint on the JavaScript code to check for and try to fix possible problems (overrides --eslint)")
|
||||
args = parser.parse_args()
|
||||
if(args.eslint or args.eslint_fix):
|
||||
eslint(args.eslint_fix)
|
||||
else:
|
||||
js(args.watch)
|
||||
elif action == "release":
|
||||
parser.add_argument(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue