Skip to content

Commit

Permalink
Add kanjidic seed script
Browse files Browse the repository at this point in the history
  • Loading branch information
justinsilvestre committed Nov 1, 2023
1 parent 9b1da6f commit 737ef7a
Show file tree
Hide file tree
Showing 11 changed files with 225,653 additions and 3 deletions.
18 changes: 18 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"tabWidth": 2,
"useTabs": false,
"overrides": [
{
"files": "**/files.ts",
"options": {
"printWidth": 120
}
},
{
"files": "**/featuredFigures.json",
"options": {
"printWidth": 130
}
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.formatOnSave": true
}
18 changes: 18 additions & 0 deletions app/lib/files.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import fs from "fs";
import path from "path";

export const files = {
kanjidicInput1: vendor("kanjidic/kanji_bank_1.json"),
kanjidicInput2: vendor("kanjidic/kanji_bank_2.json"),
};

function vendor<S extends string>(string: S) {
return path.resolve(__dirname, "vendor", string) as `${string}/vendor/${S}`;
}

function readTextFileSync<T>(filepath: string) {
return fs.readFileSync(filepath, "utf-8") as T;
}
export function readJsonSync<T>(filepath: string) {
return JSON.parse(readTextFileSync(filepath)) as T;
}
Loading

0 comments on commit 737ef7a

Please sign in to comment.