Skip to content

Commit

Permalink
Rename web directory to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
hgiesel committed Jan 27, 2022
1 parent 647b0fb commit ab3cb74
Show file tree
Hide file tree
Showing 29 changed files with 41 additions and 11 deletions.
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,32 @@ Adds four buttons:

![](https://i.ibb.co/WHp4mkD/Screenshot-2021-07-13-at-12-02-48.png)

## Documentation
## Scripts

* Build with `bin/compile.sh`.
* Built output will be put into `dist/`. This folder can be linked into your Anki add-on folder.
* Zip built output with `bin/zip.sh`. Will be put into `build/`.

## Directories

### `anki/`

A submodule pointing to `ankitects/anki`.

### `ankidata/`

A submodule pointing to `ankitects/anki`.
When invoking Anki through `scripts/run`, it will be started with `$ANKI_BASE` pointing to this directory.
This means that all data related to profiles, collections, and decks will be saved here.

### `ankidata/addons21/dist`

A symlink pointing to `dist/`.

### `dist/`

Contains the compiled output of python and typescript.

### `ts/`

Contains the Typescript and Svelte files which are used for Anki webviews.
2 changes: 0 additions & 2 deletions __init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion anki
1 change: 1 addition & 0 deletions ankidata/addons21/dist
10 changes: 3 additions & 7 deletions bin/compile.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
declare DIR="$(cd "$(dirname "$0")/.." && pwd -P)"

rm -rf "$DIR/dist/*"

cp -rf "$DIR/__init__.py" \
"$DIR/manifest.json" \
"$DIR/dist"
git clean -fd "$DIR/dist"

mkdir -p "$DIR/dist/src"
rsync -ai --exclude="*.pyc" --exclude=__pycache__ src "$DIR/dist"
rsync -ai --exclude='*.pyc' --exclude=__pycache__ 'src' "$DIR/dist"

yarn --cwd "$DIR/web" build
yarn --cwd "$DIR/ts" && yarn --cwd "$DIR/ts" build

echo 'Was successfully compiled!'
7 changes: 7 additions & 0 deletions bin/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
declare DIR="$(cd "$(dirname "$0")/.." && pwd -P)"

cd "$DIR";
git submodule update --init
cd "$DIR/anki";
ANKI_BASE="$DIR/ankidata" "$DIR/anki/scripts/ts-run"
3 changes: 3 additions & 0 deletions dist/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# NOTE There should be no need to edit this file
from .src import init
init()
File renamed without changes.
1 change: 1 addition & 0 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .webview import init_webview

# This is the entry point to the Python component
def init():
init_webview()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ab3cb74

Please sign in to comment.