Skip to content

Commit 95b0d65

Browse files
authored
Merge pull request #72 from ilo-token/master
0.5.0
2 parents 7bc26dd + 2540864 commit 95b0d65

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+3138
-2872
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and Deploy
2+
3+
on:
4+
push:
5+
branches: ["release"]
6+
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
jobs:
19+
deploy:
20+
environment:
21+
name: github-pages
22+
url: ${{ steps.deployment.outputs.page_url }}
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
- name: Setup Deno
28+
uses: denoland/setup-deno@v2
29+
with:
30+
deno-version: v2.x
31+
- name: Build
32+
run: deno task build
33+
- name: Setup Pages
34+
uses: actions/configure-pages@v4
35+
- name: Upload artifact
36+
uses: actions/upload-pages-artifact@v3
37+
with:
38+
path: "dist/"
39+
- name: Deploy to GitHub Pages
40+
id: deployment
41+
uses: actions/deploy-pages@v4

.github/workflows/deno.yml

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,24 @@
1-
name: Build and Deploy
1+
name: Deno
22

33
on:
44
push:
5-
branches: ["release"]
6-
7-
workflow_dispatch:
8-
9-
permissions:
10-
contents: read
11-
pages: write
12-
id-token: write
13-
14-
concurrency:
15-
group: "pages"
16-
cancel-in-progress: false
5+
branches: ["master"]
176

187
jobs:
19-
deploy:
20-
environment:
21-
name: github-pages
22-
url: ${{ steps.deployment.outputs.page_url }}
8+
build:
239
runs-on: ubuntu-latest
2410
steps:
2511
- name: Checkout
26-
uses: actions/checkout@v4
12+
uses: actions/checkout@v3
2713
- name: Setup Deno
28-
uses: denoland/setup-deno@v1
14+
uses: denoland/setup-deno@v2
2915
with:
3016
deno-version: v2.x
31-
- name: Build
32-
run: deno task build
33-
- name: Setup Pages
34-
uses: actions/configure-pages@v4
35-
- name: Upload artifact
36-
uses: actions/upload-pages-artifact@v3
37-
with:
38-
path: "dist/"
39-
- name: Deploy to GitHub Pages
40-
id: deployment
41-
uses: actions/deploy-pages@v4
17+
- name: Build Dictionary
18+
run: deno task build-dictionary
19+
- name: Check formatting
20+
run: deno fmt --check
21+
- name: Lint
22+
run: deno lint
23+
- name: Test
24+
run: deno test

CHANGELOG.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,52 @@ On this on-development version, things can be broken.
1515
</details>
1616
-->
1717

18+
## 0.5.0
19+
20+
ilo Token can now translate "o" imperative sentences such as "o toki" and "mi o
21+
lape".
22+
23+
You can now have custom fillers in custom dictionary:
24+
25+
```
26+
wa:
27+
wow/woow/wooow(f);
28+
```
29+
30+
With this definition, ilo Token can translate "waaaa" into "woooow". There is no
31+
repetition pattern to follow for toki pona words. "wwaaa" is just as valid.
32+
33+
You can also now have custom numerals:
34+
35+
```
36+
san:
37+
3(num);
38+
```
39+
40+
- Implement translation of "o" imperative sentences.
41+
- Allow custom fillers.
42+
- Allow custom numerals.
43+
- Numerals are now very permissive. Something like "wan tu" is now allowed. It
44+
is also possible for ilo Token to output both numbers using pu system and
45+
nasin nanpa pona: "tu ale wan" will be translated into 103 (pu system) _and_
46+
201 (nasin nanpa pona).
47+
- Support for long "anu" glyph.
48+
- Fix sentence capitalization: If the sentence starts with number, no
49+
capitalization will occur.
50+
1851
## 0.4.1
1952

20-
ilo Token is now a lot faster.
53+
Released 27 Feb 2025
54+
55+
ilo Token is now a lot faster. In exchange, it now uses more memory.
2156

2257
- Fix custom dictionary error messages.
2358
- Fix custom dictionary not loading when ilo Token is newly loaded.
2459

2560
## 0.4.0
2661

62+
Released 19 Feb 2025
63+
2764
ilo Token can now translate into verbs! This means it can translate sentences!
2865
It still can't do the following however:
2966

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ This will run a REPL that you can use to test ilo Token. To stop this command,
5252
simply press Ctrl + D or Ctrl + C.
5353

5454
```
55-
deno task run
55+
deno task repl
5656
```

bundle.ts

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ const WATCH = [
88
"./dictionary/misc.ts",
99
"./dictionary/parser.ts",
1010
"./dictionary/type.ts",
11-
"./telo-misikeke/linku-data.json",
12-
"./telo-misikeke/Parser.js",
13-
"./telo-misikeke/rules.js",
14-
"./telo-misikeke/telo-misikeke.js",
11+
"./telo_misikeke/linku_data.json",
12+
"./telo_misikeke/Parser.js",
13+
"./telo_misikeke/rules.js",
14+
"./telo_misikeke/telo_misikeke.js",
1515
"./src/",
16-
"./project-data.json",
16+
"./project_data.json",
1717
];
1818
const DICTIONARY = /dictionary[/\\][^/\\]+$/;
1919

@@ -25,24 +25,30 @@ function buildOptions(minify: boolean): ESBuild.BuildOptions {
2525
bundle: true,
2626
minify,
2727
sourcemap: "linked",
28+
target: [`es${new Date().getFullYear() - 3}`],
2829
plugins: [...denoPlugins()],
2930
};
3031
}
31-
async function buildAll(options: {
32-
minify: boolean;
33-
buildDictionary: boolean;
34-
checkDictionary?: boolean;
35-
}): Promise<void> {
32+
async function buildAll(
33+
options: Readonly<{
34+
minify: boolean;
35+
buildDictionary: boolean;
36+
checkDictionary?: boolean;
37+
}>,
38+
): Promise<void> {
3639
const { minify, buildDictionary, checkDictionary } = options;
3740
try {
3841
if (buildDictionary) {
3942
const Dictionary = await import("./dictionary/build.ts");
4043
await Dictionary.build(checkDictionary ?? true);
4144
}
45+
// deno-lint-ignore no-console
4246
console.log("Building main.js...");
4347
await ESBuild.build(buildOptions(minify));
48+
// deno-lint-ignore no-console
4449
console.log("Building done!");
4550
} catch (error) {
51+
// deno-lint-ignore no-console
4652
console.error(error);
4753
}
4854
}
@@ -53,33 +59,29 @@ if (import.meta.main) {
5359
break;
5460
}
5561
case "watch": {
62+
// deno-lint-ignore no-console
5663
console.log("Press ctrl+c to exit.");
5764
const watcher = Deno.watchFs(WATCH);
5865
let task = Promise.resolve();
59-
try {
60-
await buildAll({ minify: false, buildDictionary: true });
61-
let dictionaryChanged = false;
62-
const buildDebounced = debounce((buildDictionary: boolean) => {
63-
task = task.then(async () => {
64-
await buildAll({
65-
minify: true,
66-
buildDictionary,
67-
checkDictionary: false,
68-
});
69-
dictionaryChanged = false;
66+
await buildAll({ minify: false, buildDictionary: true });
67+
let dictionaryChanged = false;
68+
const buildDebounced = debounce((buildDictionary: boolean) => {
69+
task = task.then(async () => {
70+
await buildAll({
71+
minify: false,
72+
buildDictionary,
73+
checkDictionary: false,
7074
});
71-
}, 500);
72-
for await (const event of watcher) {
73-
if (event.paths.some((path) => DICTIONARY.test(path))) {
74-
dictionaryChanged = true;
75-
}
76-
buildDebounced(dictionaryChanged);
75+
dictionaryChanged = false;
76+
});
77+
}, 500);
78+
for await (const event of watcher) {
79+
if (event.paths.some((path) => DICTIONARY.test(path))) {
80+
dictionaryChanged = true;
7781
}
78-
throw new Error("unreachable");
79-
} finally {
80-
watcher.close();
81-
await task;
82+
buildDebounced(dictionaryChanged);
8283
}
84+
throw new Error("unreachable");
8385
}
8486
default:
8587
throw new Error(`unrecognized build option: ${Deno.args[0]}`);

deno.json

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,63 @@
44
},
55
"tasks": {
66
"build": "deno run --allow-read --allow-write --allow-env --allow-net --allow-run --no-prompt ./bundle.ts build",
7-
"run": {
8-
"command": "deno run --allow-env --no-prompt ./src/repl.ts",
7+
"repl": {
8+
"command": "deno run --no-prompt ./src/repl.ts",
99
"dependencies": ["build-dictionary"]
1010
},
1111
"start": "deno run --allow-net --allow-read --no-prompt jsr:@std/http/file-server ./dist/",
1212
"watch": "deno run --allow-read --allow-write --allow-env --allow-net --allow-run --no-prompt ./bundle.ts watch",
13-
"update": "deno outdated --update && deno run --allow-write --allow-net --no-prompt ./telo-misikeke/update.ts",
13+
"update": "deno outdated --update && deno run --allow-write --allow-net --no-prompt ./telo_misikeke/update.ts",
1414
"build-dictionary": "deno run --allow-read --allow-write --no-prompt ./dictionary/build.ts"
1515
},
1616
"fmt": {
1717
"exclude": [
1818
"./dictionary/dictionary.ts",
1919
"./dist/main.js",
20-
"./telo-misikeke/linku-data.json",
21-
"./telo-misikeke/rules.js",
22-
"./telo-misikeke/Parser.js"
20+
"./telo_misikeke/linku_data.json",
21+
"./telo_misikeke/rules.js",
22+
"./telo_misikeke/Parser.js"
2323
]
2424
},
2525
"lint": {
2626
"exclude": [
2727
"./dictionary/dictionary.ts",
2828
"./dist/main.js",
29-
"./telo-misikeke/rules.js",
30-
"./telo-misikeke/Parser.js"
29+
"./telo_misikeke/rules.js",
30+
"./telo_misikeke/Parser.js"
3131
],
3232
"rules": {
33+
"tags": ["recommended"],
34+
"include": [
35+
"camelcase",
36+
"explicit-function-return-type",
37+
"explicit-module-boundary-types",
38+
"no-console",
39+
"no-boolean-literal-for-arguments",
40+
"no-eval",
41+
"no-inferrable-types",
42+
"no-non-null-asserted-optional-chain",
43+
"no-self-compare",
44+
"no-sparse-arrays",
45+
"no-sync-fn-in-async-fn",
46+
"no-throw-literal",
47+
"no-useless-rename",
48+
"prefer-ascii",
49+
"single-var-declarator"
50+
],
3351
"exclude": ["no-explicit-any"]
3452
}
3553
},
3654
"imports": {
3755
"@luca/esbuild-deno-loader": "jsr:@luca/esbuild-deno-loader@^0.11.1",
38-
"@std/async": "jsr:@std/async@^1.0.10",
56+
"@std/assert": "jsr:@std/assert@^1.0.11",
57+
"@std/async": "jsr:@std/async@^1.0.11",
3958
"@std/cache": "jsr:@std/cache@^0.1.3",
4059
"@std/collections": "jsr:@std/collections@^1.0.10",
4160
"@std/html": "jsr:@std/html@^1.0.3",
4261
"@std/random": "jsr:@std/random@^0.1.0",
43-
"@std/text": "jsr:@std/text@^1.0.10",
62+
"@std/regexp": "jsr:@std/regexp@^1.0.1",
63+
"@std/text": "jsr:@std/text@^1.0.11",
4464
"compromise": "npm:compromise@^14.14.3",
4565
"esbuild": "npm:esbuild@^0.25.0"
4666
}

0 commit comments

Comments
 (0)