mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
add a shortcut to speed up local ts dev
@hgiesel if you're not already doing something like this, you might find this useful
This commit is contained in:
parent
b9b1fe81b1
commit
0b8ae7225a
3 changed files with 25 additions and 1 deletions
|
@ -27,6 +27,7 @@ from aqt.utils import aqt_data_folder
|
||||||
|
|
||||||
|
|
||||||
def _getExportFolder() -> str:
|
def _getExportFolder() -> str:
|
||||||
|
if not (data_folder := os.getenv("ANKI_DATA_FOLDER")):
|
||||||
data_folder = aqt_data_folder()
|
data_folder = aqt_data_folder()
|
||||||
webInSrcFolder = os.path.abspath(os.path.join(data_folder, "web"))
|
webInSrcFolder = os.path.abspath(os.path.join(data_folder, "web"))
|
||||||
if os.path.exists(webInSrcFolder):
|
if os.path.exists(webInSrcFolder):
|
||||||
|
|
10
scripts/ts-run
Executable file
10
scripts/ts-run
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Start Anki with the data folder pointed at bazel-bin,
|
||||||
|
# which is useful when developing TS pages on a Mac.
|
||||||
|
#
|
||||||
|
# The pages can be accessed by, eg surfing to
|
||||||
|
# http://localhost:40000/_anki/pages/deckconfig.html
|
||||||
|
|
||||||
|
ANKI_DATA_FOLDER=$(pwd)/bazel-bin/qt/aqt/data \
|
||||||
|
ANKI_API_PORT=40000 ANKIDEV=1 ./run
|
13
scripts/ts-watch
Executable file
13
scripts/ts-watch
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Monitor the ts folder and rebuild aqt's data each time
|
||||||
|
# it changes, for testing pages locally.
|
||||||
|
#
|
||||||
|
# On a Mac, useful to combine with ts-run.
|
||||||
|
|
||||||
|
# run once at startup
|
||||||
|
cmd='printf \\033c\\n; bazel build qt:runanki'
|
||||||
|
sh -c "$cmd"
|
||||||
|
|
||||||
|
# then monitor for changes
|
||||||
|
fswatch -r -o ts | xargs -n1 -I{} sh -c "$cmd"
|
Loading…
Reference in a new issue