Skip to content

Commit dd47acd

Browse files
committed
reorganize dictionary codes
1 parent d280ccc commit dd47acd

25 files changed

Lines changed: 43 additions & 43 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/.vscode/
2-
/dictionary/dictionary.ts
2+
/src/dictionary/dictionary.ts
33
/dist/main.js
44
/dist/main.js.map

deno.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
"DEBUG_CHUNKS"
1414
],
1515
"read": [
16-
"./dictionary/dictionary"
16+
"./dictionary.txt"
1717
],
1818
"write": [
19-
"./dictionary/dictionary.ts"
19+
"./src/dictionary/dictionary.ts"
2020
]
2121
},
2222
"soft-build-dictionary": {
@@ -26,25 +26,25 @@
2626
"DEBUG_CHUNKS"
2727
],
2828
"read": [
29-
"./dictionary/dictionary",
30-
"./dictionary/dictionary.ts"
29+
"./dictionary.txt",
30+
"./src/dictionary/dictionary.ts"
3131
],
3232
"write": [
33-
"./dictionary/dictionary.ts"
33+
"./src/dictionary/dictionary.ts"
3434
]
3535
}
3636
},
3737
"tasks": {
3838
"build": {
39-
"description": "Builds every static files needed for GitHub pages. This builds the dictionary first at `./dictionary/dictionary.ts` then the distribution code `./dist/main.js`.",
39+
"description": "Builds every static files needed for GitHub pages. This builds the dictionary first at `./src/dictionary/dictionary.ts` then the distribution code `./dist/main.js`.",
4040
"command": "deno bundle --output=./dist/main.js --minify --sourcemap=linked --platform=browser --format=iife ./src/main.ts",
4141
"dependencies": [
4242
"build-dictionary"
4343
]
4444
},
4545
"start": {
4646
"description": "Starts a development server which automatically rebuilds the project whenever there are changes to the code. However, there is no server that serves frontend and you have to manually refresh the page.",
47-
"command": "(trap 'kill 0' SIGINT; deno run --permission-set=build-dictionary --no-prompt --frozen --cached-only --watch --no-clear-screen ./dictionary/watch.ts & deno bundle --output=./dist/main.js --sourcemap=linked --platform=browser --format=iife --watch ./src/main.ts)",
47+
"command": "(trap 'kill 0' SIGINT; deno run --permission-set=build-dictionary --no-prompt --frozen --cached-only --watch --no-clear-screen ./src/dictionary/watch.ts & deno bundle --output=./dist/main.js --sourcemap=linked --platform=browser --format=iife --watch ./src/main.ts)",
4848
"dependencies": [
4949
"soft-build-dictionary"
5050
]
@@ -57,23 +57,23 @@
5757
]
5858
},
5959
"build-dictionary": {
60-
"description": "Builds the dictionary at `./dictionary/dictionary.ts`",
61-
"command": "deno run --permission-set=build-dictionary --no-prompt --frozen --cached-only ./dictionary/build.ts"
60+
"description": "Builds the dictionary at `./src/dictionary/dictionary.ts`",
61+
"command": "deno run --permission-set=build-dictionary --no-prompt --frozen --cached-only ./src/dictionary/build.ts"
6262
},
6363
"soft-build-dictionary": {
64-
"description": "Only builds the dictionary at `./dictionary/dictionary.ts` when it doesn't exists. When an error occurs, an empty dictionary is provided.",
65-
"command": "deno run --permission-set=soft-build-dictionary --no-prompt --frozen --cached-only ./dictionary/soft-build.ts"
64+
"description": "Only builds the dictionary at `./src/dictionary/dictionary.ts` when it doesn't exists. When an error occurs, an empty dictionary is provided.",
65+
"command": "deno run --permission-set=soft-build-dictionary --no-prompt --frozen --cached-only ./src/dictionary/soft-build.ts"
6666
}
6767
},
6868
"fmt": {
6969
"exclude": [
70-
"./dictionary/dictionary.ts",
70+
"./src/dictionary/dictionary.ts",
7171
"./dist/main.js"
7272
]
7373
},
7474
"lint": {
7575
"exclude": [
76-
"./dictionary/dictionary.ts",
76+
"./src/dictionary/dictionary.ts",
7777
"./dist/main.js"
7878
],
7979
"rules": {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Read the guidelines for editing:
2-
# https://github.com/ilo-token/ilo-token.github.io/wiki/Guidelines-for-editing-dictionary
2+
# https://github.com/ilo-token/ilo-token.github.io/wiki/Guidelines-for-editing-custom_dictionary
33

4-
# The dictionary is licensed under:
4+
# The custom_dictionary is licensed under:
55
# Creative Commons Attribution-ShareAlike 4.0 International
66
# https://creativecommons.org/licenses/by-sa/4.0/
77

src/dictionary.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { dictionary as globalDictionary } from "../dictionary/dictionary.ts";
2-
import { Definition, Dictionary } from "../dictionary/type.ts";
1+
import { dictionary as globalDictionary } from "./dictionary/dictionary.ts";
2+
import { Definition, Dictionary } from "./dictionary/type.ts";
33

44
// all of these global constants are mutable
55

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// this code is Deno only
22

3-
import { extractResultError, ResultError } from "../src/compound.ts";
4-
import { PositionedError } from "../src/parser/parser_lib.ts";
3+
import { extractResultError, ResultError } from "../compound.ts";
4+
import { PositionedError } from "../parser/parser_lib.ts";
55
import { parseDictionary } from "./parser.ts";
66
import { Dictionary } from "./type.ts";
77

8-
const SOURCE = new URL("./dictionary", import.meta.url);
8+
const SOURCE = new URL("../../dictionary.txt", import.meta.url);
99
const DESTINATION = new URL("./dictionary.ts", import.meta.url);
1010

1111
export async function buildWithDictionary(
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { memoize } from "@std/cache/memoize";
33
import { escape as escapeHtml } from "@std/html/entities";
44
import { escape as escapeRegex } from "@std/regexp/escape";
55
import nlp from "compromise/three";
6-
import { ResultError } from "../src/compound.ts";
7-
import { nullableAsArray, throwError } from "../src/misc/misc.ts";
6+
import { ResultError } from "../compound.ts";
7+
import { nullableAsArray, throwError } from "../misc/misc.ts";
88
import {
99
all,
1010
allWithCheck,
@@ -25,7 +25,7 @@ import {
2525
UnexpectedError,
2626
withPosition,
2727
withSource,
28-
} from "../src/parser/parser_lib.ts";
28+
} from "../parser/parser_lib.ts";
2929
import {
3030
Adjective,
3131
AdjectiveName,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { exists } from "@std/fs/exists";
44

55
if (import.meta.main) {
66
if (!await exists(new URL("./dictionary.ts", import.meta.url))) {
7-
const Dictionary = await import("../dictionary/build.ts");
7+
const Dictionary = await import("./build.ts");
88
if (!await Dictionary.build()) {
99
await Dictionary.buildWithDictionary(new Map());
1010
// deno-lint-ignore no-console
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { build } from "./build.ts";
66

77
if (import.meta.main) {
88
await using stack = new AsyncDisposableStack();
9-
using watcher = Deno.watchFs("./dictionary/dictionary");
9+
using watcher = Deno.watchFs("./dictionary.txt");
1010
let task = Promise.resolve();
1111
stack.defer(async () => await task);
1212
const buildDebounced = debounce(() => {

0 commit comments

Comments
 (0)