Skip to content

Commit

Permalink
refactor: remove create_deck
Browse files Browse the repository at this point in the history
  • Loading branch information
aalemayhu committed Jun 11, 2022
1 parent 82115f4 commit 17fff8c
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 293 deletions.
159 changes: 0 additions & 159 deletions src/genanki/create_deck.py

This file was deleted.

42 changes: 0 additions & 42 deletions src/genanki/fs_util.py

This file was deleted.

24 changes: 0 additions & 24 deletions src/genanki/models/basic.py

This file was deleted.

26 changes: 0 additions & 26 deletions src/genanki/models/cloze.py

This file was deleted.

25 changes: 0 additions & 25 deletions src/genanki/models/input.py

This file was deleted.

5 changes: 0 additions & 5 deletions src/genanki/requirements.txt

This file was deleted.

14 changes: 2 additions & 12 deletions src/lib/anki/CardGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { execFile } from 'child_process';
import { homedir } from 'os';
import path from 'path';

import { resolvePath } from '../constants';
import { CREATE_DECK_SCRIPT_PATH, resolvePath } from '../constants';

function PYTHON() {
const os = process.platform;
Expand All @@ -13,27 +13,17 @@ function PYTHON() {
}

class CardGenerator {
createDeckScriptPath: string;

currentDirectory: string;

constructor(workspace: string) {
this.createDeckScriptPath = resolvePath(
__dirname,
'../../genanki/create_deck.py'
);
this.currentDirectory = workspace;
}

async run() {
const dpayload = path.join(this.currentDirectory, 'deck_info.json');
const tdir = resolvePath(__dirname, '../../templates/');

const createDeckScriptPathARGS = [
this.createDeckScriptPath,
dpayload,
tdir,
];
const createDeckScriptPathARGS = [CREATE_DECK_SCRIPT_PATH, dpayload, tdir];
return new Promise((resolve, reject) => {
execFile(
PYTHON(),
Expand Down
8 changes: 8 additions & 0 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@ export const ONE_HOUR = 60 * 60 * 1000;
export const BUILD_DIR =
process.env.WEB_BUILD_DIR || path.join(__dirname, '../../web/build');
export const INDEX_FILE = path.join(BUILD_DIR, 'index.html');

export const CREATE_DECK_DIR =
process.env.CREATE_DECK_DIR || path.join(__dirname, '../../create_deck/');

export const CREATE_DECK_SCRIPT_PATH = path.join(
CREATE_DECK_DIR,
'create_deck.py'
);

0 comments on commit 17fff8c

Please sign in to comment.