Skip to content

Commit af1eecf

Browse files
authored
Merge pull request #77 from ilo-token/master
0.5.3
2 parents 9ff0bba + 33ddaab commit af1eecf

Some content is hidden

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

58 files changed

+2025
-1856
lines changed

.github/workflows/build_and_deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
uses: denoland/setup-deno@v2
2929
with:
3030
deno-version: v2.x
31+
- name: Install Dependencies
32+
run: deno install --frozen
3133
- name: Build
3234
run: deno task build
3335
- name: Setup Pages

.github/workflows/deno.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ jobs:
1414
uses: denoland/setup-deno@v2
1515
with:
1616
deno-version: v2.x
17+
- name: Install Dependencies
18+
run: deno install --frozen
1719
- name: Build Dictionary
1820
run: deno task build-dictionary
1921
- name: Check formatting
2022
run: deno fmt --check
2123
- name: Lint
2224
run: deno lint
2325
- name: Test
24-
run: deno test
26+
run: deno test --parallel

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.vscode/
2-
dictionary/dictionary.ts
3-
dist/main.js
4-
dist/main.js.map
1+
/.vscode/
2+
/dictionary/dictionary.ts
3+
/dist/main.js
4+
/dist/main.js.map

CHANGELOG.md

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

18+
## 0.5.3
19+
20+
Released 2 April 2025
21+
22+
- Fix adverbs not showing along with verbs.
23+
- Fix UCSUR translation. Previously, some UCSUR words are translated into wrong
24+
words in latin script.
25+
1826
## 0.5.2
1927

2028
Released 14 March 2025
@@ -212,7 +220,7 @@ Inside update (intended for developers):
212220
- Rewritten whole code to use TypeScript, module, and functional programming.
213221
- Rewritten parser to use parser combinator.
214222
- Add language codes to html.
215-
- New wiki for contributors and thinkerers.
223+
- New wiki for contributors and tinkerers.
216224
- Overhaul `README.md`, only including build instruction. Information about the
217225
translator is now moved to wiki.
218226

CONTRIBUTING.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ Also check the [changelog](./CHANGELOG.md) and open the on-development
2626
changelog, it might be already fixed but hasn't published yet! Duplicate issues
2727
are unnecessary.
2828

29+
Note to maintainer/contributor: When there's a bug discovered, make a test for
30+
it if possible. Use Deno's own testing tools:
31+
[examples](https://github.com/ilo-token/ilo-token.github.io/blob/master/src/translator/test.ts).
32+
Then edit the issue to link the test in following format:
33+
34+
```md
35+
Test: [src/translator/test.ts "verb with adverb"](permalink including the lines)
36+
```
37+
2938
## [Discussion](https://github.com/ilo-token/ilo-token.github.io/discussions)
3039

3140
This GitHub repository have discussion, a dedicated forum page and shall serve
@@ -42,8 +51,10 @@ Please search first before opening a new page! Duplicate pages are unnecessary.
4251
Before forking and editing, please claim an issue first or open an issue then
4352
claim it. After that, you can start away. This is necessary to avoid wasted
4453
duplicate efforts.
54+
[The wiki](https://github.com/ilo-token/ilo-token.github.io/wiki) contains
55+
useful information for contributors.
4556

46-
You **don't** have to do this if:
57+
You **don't** have to open a new issue this if:
4758

4859
- It is a contribution to the dictionary
4960
- It is a minor edit e.g. a typo fix
@@ -52,11 +63,22 @@ Please don't do the following, we can do this ourselves.
5263

5364
- Updating dependencies
5465

55-
Additionally, please format the code when you make changes. We use Deno's
56-
built-in formatter.
66+
More things to remember:
5767

58-
[The wiki](https://github.com/ilo-token/ilo-token.github.io/wiki) contains
59-
useful for contributors.
68+
- Keep the source code as runtime agnostic as possible. We target the browser
69+
and Deno. This is necessary because we use `deno test`. If a module is
70+
exclusive to one runtime, add a note above the code:
71+
`// This code is browser/Deno only`.
72+
73+
(The following aren't strict rules. It's perfectly fine to not follow any of
74+
these, we can adapt.)
75+
76+
- Ensure all the files are formatted: Run `deno fmt`.
77+
- Make sure you don't accidentally make more tests fail: Run
78+
`deno test --parallel` before and after making changes to the code. Some tests
79+
may already be failing.
80+
- Make use of linter: Run `deno lint`. If a lint rule is deemed unnecessary and
81+
more of an annoyance, open an [issue](#issue). We can remove lint rules.
6082

6183
As a thank you for contributing, you'll get a shout out in the changelog!
6284

@@ -86,6 +108,6 @@ themselves serves as a space for broader topics, not just ilo Token.
86108
programming language, it uses similar techniques found in programming language
87109
development e.g. parsing.
88110

89-
These are unnoficial spaces and are not subject to the
111+
These are unofficial spaces and are not subject to the
90112
[Contributor Covenant Code of Conduct](https://github.com/ilo-token/ilo-token.github.io/blob/master/CODE_OF_CONDUCT.md).
91113
Instead, each have its own rules and different moderators.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 neverRare
3+
Copyright (c) 2025 neverRare
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,48 +9,14 @@ interpretation of the text. No machine learning involved.
99
**It is work in progress!**
1010
[We welcome contributors however!](./CONTRIBUTING.md)
1111

12-
## Dependencies
12+
## Starting development server
1313

14-
You'll need the following in order to run commands:
14+
After using `git clone`, you'll need [Deno](https://deno.com/) for this project.
15+
Then you'll need to install the dependencies before running any command:
16+
`deno install`.
1517

16-
- [Deno](https://deno.com/)
18+
After this, you can start away by running `deno task start` then open the link
19+
provided by the stdout to open a local copy of ilo Token. The server will
20+
auto-reload the webpage whenever there are changes on the code.
1721

18-
## Building
19-
20-
This builds the distribution code at `./dist/main.js` as minified file ready for
21-
production use, it also builds the source map so contributors can directly debug
22-
the production code.
23-
24-
```
25-
deno task build
26-
```
27-
28-
Before building the distribution code, it builds the dictionary first by
29-
transforming the dictionary into a code at `./dictionary/dictionary.ts`. This
30-
enables faster code startup without dealing with file access or network access.
31-
32-
## Watching
33-
34-
This is similar to [building](#building) but it doesn't minify the code. This
35-
command also watches the codes in `./src/` and `./dictionary/` including the
36-
dictionary and rebuilds whenever there are changes. To stop this command, simply
37-
press Ctrl + C.
38-
39-
```
40-
deno task watch
41-
```
42-
43-
## Running locally with browser
44-
45-
After building or watching, you can directly run `./dist/index.html` with your
46-
browser to test ilo Token. If you wish to start a local server, run
47-
`deno task start`. The stdout will tell you the URL to use.
48-
49-
## Running locally with Deno
50-
51-
This will run a REPL that you can use to test ilo Token. To stop this command,
52-
simply press Ctrl + D or Ctrl + C.
53-
54-
```
55-
deno task repl
56-
```
22+
Run `deno task` to see more useful command lines.

build/build.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This code is Deno only
2+
3+
import * as ESBuild from "esbuild";
4+
import { OPTIONS } from "./config.ts";
5+
import * as Dictionary from "../dictionary/build.ts";
6+
7+
const BUILD_OPTIONS: ESBuild.BuildOptions = {
8+
...OPTIONS,
9+
minify: true,
10+
define: { LIVE_RELOAD: "false" },
11+
};
12+
13+
if (import.meta.main) {
14+
await Dictionary.build();
15+
await ESBuild.build(BUILD_OPTIONS);
16+
}

build/config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This code is Deno only
2+
3+
import { denoPlugins } from "@luca/esbuild-deno-loader";
4+
import { BuildOptions } from "esbuild";
5+
6+
export const OPTIONS: BuildOptions = {
7+
entryPoints: ["./src/main.ts"],
8+
outfile: "./dist/main.js",
9+
bundle: true,
10+
sourcemap: "linked",
11+
target: [`es${new Date().getFullYear() - 3}`],
12+
plugins: [...denoPlugins()],
13+
logLevel: "info",
14+
};

build/dev.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// This code is Deno only
2+
3+
import { assert } from "@std/assert/assert";
4+
import { exists } from "@std/fs/exists";
5+
import { BuildOptions, context } from "esbuild";
6+
import { AsyncDisposableStack } from "../misc/async_disposable_stack.ts";
7+
import { OPTIONS } from "./config.ts";
8+
9+
const BUILD_OPTIONS: BuildOptions = {
10+
...OPTIONS,
11+
minify: false,
12+
define: { LIVE_RELOAD: "true" },
13+
};
14+
async function watchMain(): Promise<AsyncDisposable> {
15+
await using stack = new AsyncDisposableStack();
16+
const buildContext = await context(BUILD_OPTIONS);
17+
stack.defer(async () => await buildContext.dispose());
18+
buildContext.watch();
19+
buildContext.serve({ servedir: "./dist/" });
20+
return stack.move();
21+
}
22+
async function watchDictionary(): Promise<number> {
23+
const command = new Deno.Command(Deno.execPath(), {
24+
args: [
25+
"run",
26+
"-R=./dictionary/dictionary",
27+
"-W=./dictionary/dictionary.ts",
28+
"--no-prompt",
29+
"--frozen",
30+
"--cached-only",
31+
"--watch",
32+
"--no-clear-screen",
33+
"./dictionary/watch.ts",
34+
],
35+
cwd: new URL("../", import.meta.url),
36+
stdout: "inherit",
37+
stderr: "inherit",
38+
stdin: "null",
39+
});
40+
const process = command.spawn();
41+
const status = await process.status;
42+
assert(!status.success);
43+
return status.code;
44+
}
45+
if (import.meta.main) {
46+
let statusCode: number;
47+
{
48+
if (
49+
!await exists(new URL("../dictionary/dictionary.ts", import.meta.url))
50+
) {
51+
const Dictionary = await import("../dictionary/build.ts");
52+
await Dictionary.build();
53+
}
54+
const statusCodePromise = watchDictionary();
55+
await using _ = await watchMain();
56+
statusCode = await statusCodePromise;
57+
}
58+
Deno.exit(statusCode);
59+
}

bundle.ts

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)