mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
add prettier, tidy up makefile
This commit is contained in:
parent
ecc5cb3c80
commit
d7d0d9bf88
4 changed files with 107 additions and 53 deletions
140
Makefile
140
Makefile
|
@ -10,6 +10,9 @@ RUNARGS :=
|
||||||
|
|
||||||
$(shell mkdir -p .build)
|
$(shell mkdir -p .build)
|
||||||
|
|
||||||
|
# Installing
|
||||||
|
######################
|
||||||
|
|
||||||
.PHONY: all install uninstall
|
.PHONY: all install uninstall
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
@ -45,56 +48,10 @@ uninstall:
|
||||||
@echo
|
@echo
|
||||||
@echo "Uninstall complete."
|
@echo "Uninstall complete."
|
||||||
|
|
||||||
.PHONY: clean build run
|
# Prerequisites
|
||||||
|
######################
|
||||||
|
|
||||||
clean:
|
REQS := .build/pyrunreqs .build/pydevreqs .build/jsreqs
|
||||||
rm -rf .build
|
|
||||||
rm -rf $(JSDEPS)
|
|
||||||
|
|
||||||
build: reqs .build/ui .build/js
|
|
||||||
|
|
||||||
.build/ui: $(shell find designer -name '*.ui')
|
|
||||||
./tools/build_ui.sh
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
run: build
|
|
||||||
./runanki ${RUNARGS}
|
|
||||||
|
|
||||||
CHECKDEPS := build $(shell find anki aqt -name '*.py')
|
|
||||||
|
|
||||||
.PHONY: check mypy test lint pytype
|
|
||||||
|
|
||||||
check: mypy test lint pytype
|
|
||||||
mypy: .build/mypy
|
|
||||||
test: .build/test
|
|
||||||
lint: .build/lint
|
|
||||||
pytype: .build/pytype
|
|
||||||
|
|
||||||
.build/mypy: $(CHECKDEPS)
|
|
||||||
mypy anki aqt
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
.build/test: $(CHECKDEPS)
|
|
||||||
./tools/tests.sh
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
.build/lint: $(CHECKDEPS)
|
|
||||||
pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=PyQt5 anki aqt
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
.build/pytype: $(CHECKDEPS)
|
|
||||||
pytype --config pytype.conf
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
TSDEPS := $(wildcard ts/src/*.ts)
|
|
||||||
JSDEPS := $(patsubst ts/src/%.ts, web/%.js, $(TSDEPS))
|
|
||||||
|
|
||||||
.build/js: $(TSDEPS)
|
|
||||||
(cd ts && ./node_modules/.bin/tsc --build)
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
.PHONY: reqs
|
|
||||||
reqs: .build/pyrunreqs .build/pydevreqs .build/jsreqs
|
|
||||||
|
|
||||||
.build/pyrunreqs: requirements.txt
|
.build/pyrunreqs: requirements.txt
|
||||||
pip install -r $<
|
pip install -r $<
|
||||||
|
@ -107,3 +64,88 @@ reqs: .build/pyrunreqs .build/pydevreqs .build/jsreqs
|
||||||
.build/jsreqs: ts/package.json
|
.build/jsreqs: ts/package.json
|
||||||
(cd ts && npm i)
|
(cd ts && npm i)
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
|
# Building
|
||||||
|
######################
|
||||||
|
|
||||||
|
BUILDDEPS := $(REQS) .build/ui .build/js
|
||||||
|
|
||||||
|
.build/ui: $(shell find designer -name '*.ui')
|
||||||
|
./tools/build_ui.sh
|
||||||
|
touch $@
|
||||||
|
|
||||||
|
.build/js: $(TSDEPS)
|
||||||
|
(cd ts && npm run build)
|
||||||
|
touch $@
|
||||||
|
|
||||||
|
.PHONY: build clean
|
||||||
|
|
||||||
|
build: $(BUILDDEPS)
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -rf .build
|
||||||
|
rm -rf $(JSDEPS)
|
||||||
|
|
||||||
|
# Running
|
||||||
|
######################
|
||||||
|
|
||||||
|
.PHONY: run
|
||||||
|
run: build
|
||||||
|
./runanki ${RUNARGS}
|
||||||
|
|
||||||
|
# Checking
|
||||||
|
######################
|
||||||
|
|
||||||
|
.PHONY: check
|
||||||
|
check: mypy pytest pylint pytype checkpretty
|
||||||
|
|
||||||
|
# Checking python
|
||||||
|
######################
|
||||||
|
|
||||||
|
PYCHECKDEPS := $(BUILDDEPS) $(shell find anki aqt -name '*.py')
|
||||||
|
|
||||||
|
.build/mypy: $(PYCHECKDEPS)
|
||||||
|
mypy anki aqt
|
||||||
|
touch $@
|
||||||
|
|
||||||
|
.build/pytest: $(PYCHECKDEPS)
|
||||||
|
./tools/tests.sh
|
||||||
|
touch $@
|
||||||
|
|
||||||
|
.build/pylint: $(PYCHECKDEPS)
|
||||||
|
pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=PyQt5 anki aqt
|
||||||
|
touch $@
|
||||||
|
|
||||||
|
.build/pytype: $(PYCHECKDEPS)
|
||||||
|
pytype --config pytype.conf
|
||||||
|
touch $@
|
||||||
|
|
||||||
|
.PHONY: mypy pytest pylint pytype
|
||||||
|
mypy: .build/mypy
|
||||||
|
pytest: .build/pytest
|
||||||
|
pylint: .build/pylint
|
||||||
|
pytype: .build/pytype
|
||||||
|
|
||||||
|
# Typescript source
|
||||||
|
######################
|
||||||
|
|
||||||
|
TSDEPS := $(wildcard ts/src/*.ts)
|
||||||
|
JSDEPS := $(patsubst ts/src/%.ts, web/%.js, $(TSDEPS))
|
||||||
|
|
||||||
|
# Checking typescript
|
||||||
|
######################
|
||||||
|
|
||||||
|
TSCHECKDEPS := $(BUILDDEPS) $(TSDEPS)
|
||||||
|
|
||||||
|
.build/checkpretty: $(TSCHECKDEPS)
|
||||||
|
(cd ts && npm run check-pretty)
|
||||||
|
touch $@
|
||||||
|
|
||||||
|
.build/pretty: $(TSCHECKDEPS)
|
||||||
|
(cd ts && npm run pretty)
|
||||||
|
touch $@
|
||||||
|
|
||||||
|
.PHONY: pretty checkpretty
|
||||||
|
pretty: .build/pretty
|
||||||
|
checkpretty: .build/checkpretty
|
||||||
|
|
5
ts/.prettierrc
Normal file
5
ts/.prettierrc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"tabWidth": 4,
|
||||||
|
"semi": true
|
||||||
|
}
|
6
ts/package-lock.json
generated
6
ts/package-lock.json
generated
|
@ -34,6 +34,12 @@
|
||||||
"integrity": "sha512-7EJYyKTL7tFR8+gDbB6Wwz/arpGa0Mywk1TJbNzKzHtzbwVmY4HR9WqS5VV7dsBUKQmPNr192jHr/VpBluj/hg==",
|
"integrity": "sha512-7EJYyKTL7tFR8+gDbB6Wwz/arpGa0Mywk1TJbNzKzHtzbwVmY4HR9WqS5VV7dsBUKQmPNr192jHr/VpBluj/hg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"prettier": {
|
||||||
|
"version": "1.19.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
|
||||||
|
"integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "3.7.3",
|
"version": "3.7.3",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.3.tgz",
|
||||||
|
|
|
@ -2,18 +2,19 @@
|
||||||
"name": "anki-dtop-js",
|
"name": "anki-dtop-js",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Anki desktop js support files",
|
"description": "Anki desktop js support files",
|
||||||
"directories": {
|
|
||||||
"test": "tests"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"build": "tsc --build",
|
||||||
|
"pretty": "prettier --write src/*.ts",
|
||||||
|
"check-pretty": "prettier --check src/*.ts"
|
||||||
},
|
},
|
||||||
|
"private": true,
|
||||||
"author": "Ankitects Pty Ltd",
|
"author": "Ankitects Pty Ltd",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jquery": "^3.3.31",
|
"@types/jquery": "^3.3.31",
|
||||||
"@types/jqueryui": "^1.12.9",
|
"@types/jqueryui": "^1.12.9",
|
||||||
"@types/mathjax": "0.0.36",
|
"@types/mathjax": "0.0.36",
|
||||||
|
"prettier": "^1.19.1",
|
||||||
"typescript": "^3.7.3"
|
"typescript": "^3.7.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue