Skip to content

Commit

Permalink
refactor(web): move common/models to web/src/engine/predictive-text
Browse files Browse the repository at this point in the history
Fixes: #12133
  • Loading branch information
ermshiperete committed Sep 10, 2024
1 parent 91bbc25 commit 09d8552
Show file tree
Hide file tree
Showing 34 changed files with 36 additions and 53 deletions.
3 changes: 1 addition & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ common/:
- common/**
- resources/**

common/models/: common/models/**
common/models/templates/: web/src/engine/predictive-text/templates/**
common/models/wordbreakers/: common/models/wordbreakers/**
common/models/wordbreakers/: web/src/engine/predictive-text/wordbreakers/**

common/resources/: resources/**
common/web/: common/web/**
Expand Down
12 changes: 0 additions & 12 deletions common/models/tsconfig.kmw-worker-base.json

This file was deleted.

1 change: 0 additions & 1 deletion docs/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/common/ @mcdurdin @rc-swag
/core/ @mcdurdin @rc-swag
/common/lexical-model-types/ @jahorton @mcdurdin
/common/models/ @jahorton @mcdurdin
/common/schemas/ @mcdurdin @jahorton
/common/test/ @mcdurdin @ermshiperete
/common/web/ @jahorton @mcdurdin
Expand Down
29 changes: 14 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"developer/src/kmc-package",
"developer/src/kmc",
"developer/src/server",
"common/models/*",
"common/test/resources",
"common/tools/*",
"common/web/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ BLOCKS_SRC_LOCAL="./Blocks.txt"
UNICODE_DATA_SRC_HREF="https://www.unicode.org/Public/$KEYMAN_VERSION_UNICODE/ucd/UnicodeData.txt"
UNICODE_DATA_SRC_LOCAL="./UnicodeData.txt"

# Used by common/models/wordbreakers for the default Unicode wordbreaker.
# Used by web/src/engine/predictive-text/wordbreakers for the default Unicode wordbreaker.
WORDBREAK_PROP_SRC_HREF="https://www.unicode.org/Public/$KEYMAN_VERSION_UNICODE/ucd/auxiliary/WordBreakProperty.txt"
WORDBREAK_PROP_SRC_LOCAL="./WordBreakProperty.txt"

Expand Down Expand Up @@ -55,4 +55,4 @@ do_download() {
downloadPropertyFile "${EMOJI_DATA_SRC_HREF}" "${EMOJI_DATA_SRC_LOCAL}"
}

builder_run_action download do_download
builder_run_action download do_download
2 changes: 1 addition & 1 deletion resources/stats/stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"

cd "$THIS_SCRIPT_PATH"

platforms=(android/ ios/ linux/ mac/ web/ windows/ developer/ core/ common/models/)
platforms=(android/ ios/ linux/ mac/ web/ windows/ developer/ core/)

builder_describe "Stats collector for Keyman PRs and issues
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@keymanapp/common-types": ["./common/web/types/src/main"],
"@keymanapp/keyman": ["./web" ],
"@keymanapp/models-templates": ["./web/src/engine/predictive-text/templates/"],
"@keymanapp/models-wordbreakers": ["./common/models/wordbreakers"],
"@keymanapp/models-wordbreakers": ["./web/src/engine/predictive-text/wordbreakers"],
"@keymanapp/web-utils": ["./common/web/utils"],
"@keymanapp/lm-message-types": ["./web/src/engine/predictive-text/types"],
"@keymanapp/keyman-version": ["./common/web/keyman-version"],
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"references": [
{ "path": "./core/include/ldml/tsconfig.json" },

{ "path": "./cweb/src/engine/predictive-text/templates/tsconfig.json" },
{ "path": "./common/models/wordbreakers/tsconfig.json" },
{ "path": "./common/tools/hextobin/" },

{ "path": "./common/web/keyman-version" },
Expand Down Expand Up @@ -38,6 +36,8 @@

{ "path": "./web/src/tsconfig.all.json" },
{ "path": "./web/src/engine/predictive-text/types/" },
{ "path": "./web/src/engine/predictive-text/templates" },
{ "path": "./web/src/engine/predictive-text/wordbreakers" },
{ "path": "./web/src/engine/predictive-text/worker-main/tsconfig.all.json" },
{ "path": "./web/src/engine/predictive-text/worker-thread" },
{ "path": "./web/src/engine/osk/gesture-processor/tsconfig.json" },
Expand Down
2 changes: 1 addition & 1 deletion web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ graph TD;
OSK-->KeyboardSpec;
WebUtils["@keymanapp/web-utils<br>(/common/web/utils)"];
KeyboardSpec---->WebUtils;
Wordbreakers["@keymanapp/models-wordbreakers<br>(/common/models/wordbreakers)"];
Wordbreakers["@keymanapp/models-wordbreakers<br>(/web/src/engine/predictive-text/wordbreakers)"];
Models["@keymanapp/models-templates<br>(/web/src/engine/predictive-text/templates/)"];
Models-->WebUtils;
LMWorker["@keymanapp/lm-worker<br>(/web/src/engine/predictive-text/worker-thread)"];
Expand Down
2 changes: 1 addition & 1 deletion web/src/engine/predictive-text/templates/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
builder_describe "Builds the predictive-text model template implementation module" \
"@/common/web/keyman-version" \
"@/common/web/es-bundling" \
"@/common/models/wordbreakers" \
"@../wordbreakers" \
"clean" \
"configure" \
"build" \
Expand Down
2 changes: 1 addition & 1 deletion web/src/engine/predictive-text/templates/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"references": [
{ "path": "../../../../../common/web/types" },
{ "path": "../../../../../common/web/utils" },
{ "path": "../../../../../common/models/wordbreakers" }
{ "path": "../wordbreakers" }
],
"include": [
"src/**/*.ts"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ The word breakers bundled in Keyman's modeling layer (common/models).

Includes:

- `default` — a word breaker based on the Unicode default word boundary specification
- _deprecated_ `ascii` — an example word breaker
- _deprecated_ `placeholder` — an example word breaker
- `default` — a word breaker based on the Unicode default word boundary specification
- _deprecated_ `ascii` — an example word breaker
- _deprecated_ `placeholder` — an example word breaker

## Usage

```
```typescript
import {wordBreakers} from '@keymanapp/models-wordbreakers';
const breakWords = wordBreakers['default'];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "$(dirname "$THIS_SCRIPT")/../../../resources/build/builder.inc.sh"
. "$(dirname "$THIS_SCRIPT")/../../../../../resources/build/builder.inc.sh"
## END STANDARD BUILD SCRIPT INCLUDE

. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function escape(codedChar: string) {

// Generate the file!
stream.write(`// Automatically generated file. DO NOT MODIFY.
// The generator script is defined at /common/models/wordbreakers/src/data-compiler/index.ts.
// The generator script is defined at /web/src/engine/predictive-text/wordbreakers/src/data-compiler/index.ts.
/**
* Valid values for a word break property.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"extends": "../tsconfig.kmw-worker-base.json",

"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "./",
"outDir": "./build/main/obj",
Expand Down
4 changes: 2 additions & 2 deletions web/src/engine/predictive-text/worker-main/unit_tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ if builder_start_action test:libraries; then
# So, for now, we add a text header to clarify what is running at each stage, in
# addition to fair bit of `pushd` and `popd`.
echo
echo "### Running $(builder_term common/models/wordbreakers) tests"
"$KEYMAN_ROOT/common/models/wordbreakers/build.sh" test $TEST_OPTS
echo "### Running $(builder_term web/src/engine/predictive-text/wordbreakers) tests"
"$KEYMAN_ROOT/web/src/engine/predictive-text/wordbreakers/build.sh" test $TEST_OPTS

pushd "$KEYMAN_ROOT/web/src/engine/predictive-text/templates/"
echo
Expand Down
4 changes: 2 additions & 2 deletions web/src/engine/predictive-text/worker-thread/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ builder_describe \
"@/web/src/tools/building/sourcemap-root" \
"@/common/web/keyman-version" \
"@/common/web/es-bundling" \
"@/common/models/wordbreakers" \
"@/web/src/engine/predictive-text/templates/" \
"@../wordbreakers" \
"@../templates/" \
configure clean build test --ci

builder_describe_outputs \
Expand Down
2 changes: 1 addition & 1 deletion web/src/engine/predictive-text/worker-thread/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{ "path": "../../../../../common/web/keyman-version" },
{ "path": "../../../../../common/web/utils" },
{ "path": "../templates" },
{ "path": "../../../../../common/models/wordbreakers" },
{ "path": "../wordbreakers" },
],
"include": [
"src/main/**/*.ts"
Expand Down

0 comments on commit 09d8552

Please sign in to comment.