Skip to content

Commit

Permalink
refactor(web): move predictive-textworker-main
Browse files Browse the repository at this point in the history
This moves `common/predictive-text/` →
`web/src/engine/predictive-text/worker-main/`.

This also moves `common/test/predictive-text/` →
`web/src/test/manual/predictive-text/`. Note though that this testing
tool is still broken.

Fixes: #12134
  • Loading branch information
ermshiperete committed Aug 12, 2024
1 parent e5e7e84 commit 35481fe
Show file tree
Hide file tree
Showing 50 changed files with 101 additions and 86 deletions.
1 change: 0 additions & 1 deletion common/predictive-text/.build-builder

This file was deleted.

23 changes: 0 additions & 23 deletions common/predictive-text/src/tsconfig.json

This file was deleted.

42 changes: 21 additions & 21 deletions docs/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@
#
# @darcywong00 @mcdurdin @ermshiperete @rc-swag @SabineSIL @sgschantz

/android/ @darcywong00 @sgschantz
/android/ @darcywong00 @sgschantz

/common/ @mcdurdin @rc-swag
/core/ @mcdurdin @rc-swag
/common/lexical-model-types/ @jahorton @mcdurdin
/common/models/ @jahorton @mcdurdin
/common/predictive-text/ @jahorton @mcdurdin
/common/schemas/ @mcdurdin @jahorton
/common/test/ @mcdurdin @ermshiperete
/common/web/ @jahorton @mcdurdin
/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

/developer/ @mcdurdin @darcywong00
/docs/ @mcdurdin @jahorton
/ios/ @sgschantz @jahorton
/linux/ @ermshiperete @darcywong00
/mac/ @sgschantz @SabineSIL
/developer/ @mcdurdin @darcywong00
/docs/ @mcdurdin @jahorton
/ios/ @sgschantz @jahorton
/linux/ @ermshiperete @darcywong00
/mac/ @sgschantz @SabineSIL

/oem/firstvoices/android/ @darcywong00 @sgschantz
/oem/firstvoices/common/ @mcdurdin @rc-swag
/oem/firstvoices/ios/ @sgschantz @jahorton
/oem/firstvoices/windows/ @rc-swag @ermshiperete
/resources/ @mcdurdin @jahorton
/oem/firstvoices/android/ @darcywong00 @sgschantz
/oem/firstvoices/common/ @mcdurdin @rc-swag
/oem/firstvoices/ios/ @sgschantz @jahorton
/oem/firstvoices/windows/ @rc-swag @ermshiperete
/resources/ @mcdurdin @jahorton

# Web is currently shared between Eberhard and Joshua:
/web/ @ermshiperete @jahorton
/web/ @ermshiperete @jahorton
/web/src/engine/predictive-text/ @jahorton @mcdurdin

/windows/ @rc-swag @ermshiperete
/windows/ @rc-swag @ermshiperete
37 changes: 26 additions & 11 deletions linux/scripts/dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,37 @@ cp -a debian ../
cd ..
echo "3.0 (native)" > debian/source/format
dch keyman --newversion "${VERSION}" --force-bad-version --nomultimaint
dpkg-source --tar-ignore=*~ --tar-ignore=.git --tar-ignore=.gitattributes \
--tar-ignore=.gitignore --tar-ignore=experiments --tar-ignore=debian \
--tar-ignore=.github --tar-ignore=.vscode --tar-ignore=android \
dpkg-source --tar-ignore=*~ \
--tar-ignore=.git \
--tar-ignore=.gitattributes \
--tar-ignore=.gitignore \
--tar-ignore=experiments \
--tar-ignore=debian \
--tar-ignore=.github \
--tar-ignore=.vscode \
--tar-ignore=android \
--tar-ignore=.devcontainer \
--tar-ignore=artifacts \
\
--tar-ignore=common/models \
--tar-ignore=common/predictive-text \
--tar-ignore=common/resources \
--tar-ignore=common/schemas \
--tar-ignore=common/test/keyboards/build.* \
--tar-ignore=common/test/predictive-text \
--tar-ignore=common/test/resources \
--tar-ignore=common/web \
--tar-ignore=common/windows \
\
--tar-ignore=core/build \
--tar-ignore=developer --tar-ignore=docs --tar-ignore=ios \
--tar-ignore=developer \
--tar-ignore=docs \
--tar-ignore=ios \
--tar-ignore=linux/keyman-config/keyman_config/version.py \
--tar-ignore=linux/keyman-config/buildtools/build-langtags.py --tar-ignore=__pycache__ \
--tar-ignore=linux/keyman-config/buildtools/build-langtags.py \
--tar-ignore=__pycache__ \
--tar-ignore=linux/help \
--tar-ignore=mac --tar-ignore=node_modules --tar-ignore=oem \
--tar-ignore=mac \
--tar-ignore=node_modules \
--tar-ignore=oem \
--tar-ignore=linux/build \
--tar-ignore=linux/builddebs \
--tar-ignore=linux/ibus-keyman/build \
Expand All @@ -60,11 +69,17 @@ dpkg-source --tar-ignore=*~ --tar-ignore=.git --tar-ignore=.gitattributes \
--tar-ignore=resources/environment.sh \
--tar-ignore=resources/git-hooks \
--tar-ignore=resources/scopes \
--tar-ignore=resources/build/*.lua --tar-ignore=resources/build/jq* \
--tar-ignore=resources/build/*.lua \
--tar-ignore=resources/build/jq* \
--tar-ignore=results \
--tar-ignore=tmp \
--tar-ignore=web --tar-ignore=windows --tar-ignore=keyman_1* \
--tar-ignore=dist --tar-ignore=VERSION -Zgzip -b .
--tar-ignore=web \
--tar-ignore=windows \
--tar-ignore=keyman_1* \
--tar-ignore=dist \
--tar-ignore=VERSION \
\
-Zgzip -b .
mv ../keyman_"${VERSION}".tar.gz linux/dist/keyman-"${VERSION}".tar.gz
echo "3.0 (quilt)" > debian/source/format
cd "$BASEDIR"
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"common/test/resources",
"common/tools/*",
"common/web/*",
"common/predictive-text",
"common/tools/hextobin",
"web"
"web",
"web/src/engine/predictive-text/*"
],
"dependencies": {
"@keymanapp/common-types": "file:common/web/types",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
{ "path": "./common/models/templates/tsconfig.json" },
{ "path": "./common/models/types/tsconfig.json" },
{ "path": "./common/models/wordbreakers/tsconfig.json" },
{ "path": "./common/predictive-text/tsconfig.all.json" },
{ "path": "./common/tools/hextobin/" },

{ "path": "./common/web/gesture-recognizer/tsconfig.json" },
Expand Down Expand Up @@ -43,6 +42,7 @@
{ "path": "./resources/build/version/" },

{ "path": "./web/src/tsconfig.all.json" },
{ "path": "./web/src/engine/predictive-text/worker-main/tsconfig.all.json" },
// { "path": "./web/tools/recorder/tsconfig.json" },
// { "path": "./web/tools/sourcemap-root/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 @@ -92,7 +92,7 @@ graph TD;
LMWorker["@keymanapp/lm-worker<br>(/common/web/lm-worker)"];
LMWorker-->Models;
LMWorker-->Wordbreakers;
LMLayer["@keymanapp/lexical-model-layer<br>(/common/predictive-text)"];
LMLayer["@keymanapp/lexical-model-layer<br>(/web/src/engine/predictive-text/worker-main)"];
LMLayer-->LMWorker;
Gestures["@keymanapp/gesture-recognizer<br>(/common/web/gesture-recognizer)"];
Gestures-->WebUtils;
Expand Down
6 changes: 4 additions & 2 deletions web/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ builder_describe "Builds engine modules for Keyman Engine for Web (KMW)." \
":engine/dom-utils A common subset of function used for DOM calculations, layout, etc" \
":engine/events Specialized classes utilized to support KMW API events" \
":engine/element-wrappers Subset used to integrate with website elements" \
":engine/interfaces Subset used to configure KMW" \
":engine/js-processor Build JS processor for KMW" \
":engine/keyboard Builds KMW's keyboard-loading and caching code" \
":engine/keyboard-storage Subset used to collate keyboards and request them from the cloud" \
":engine/main Builds all common code used by KMW's app/-level targets" \
":engine/osk Builds the Web OSK module" \
":engine/interfaces Subset used to configure KMW" \
":engine/predictive-text=src/engine/predictive-text/worker-main Builds KMW's predictive text module" \
":samples Builds all needed resources for the KMW sample-page set" \
":tools Builds engine-related development resources" \
":test-pages=src/test/manual Builds resources needed for the KMW manual testing pages" \
Expand All @@ -59,12 +60,13 @@ builder_describe_outputs \
build:engine/dom-utils "/web/build/engine/dom-utils/obj/index.js" \
build:engine/events "/web/build/engine/events/lib/index.mjs" \
build:engine/element-wrappers "/web/build/engine/element-wrappers/lib/index.mjs" \
build:engine/interfaces "/web/build/engine/interfaces/lib/index.mjs" \
build:engine/js-processor "/web/build/engine/js-processor/lib/index.mjs" \
build:engine/keyboard "/web/build/engine/keyboard/lib/index.mjs" \
build:engine/keyboard-storage "/web/build/engine/keyboard-storage/lib/index.mjs" \
build:engine/main "/web/build/engine/main/lib/index.mjs" \
build:engine/osk "/web/build/engine/osk/lib/index.mjs" \
build:engine/interfaces "/web/build/engine/interfaces/lib/index.mjs" \
build:engine/predictive-text "/web/src/engine/predictive-text/worker-main/build/lib/web/index.mjs" \
build:samples "/web/src/samples/simplest/keymanweb.js" \
build:tools "/web/build/tools/building/sourcemap-root/index.js" \
build:test-pages "/web/build/test-resources/sentry-manager.js"
Expand Down
2 changes: 1 addition & 1 deletion web/src/engine/main/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ SUBPROJECT_NAME=engine/main
builder_describe "Builds the Keyman Engine for Web's common top-level base classes." \
"@/common/web/keyman-version" \
"@/web/src/engine/keyboard" \
"@/common/predictive-text" \
"@/web/src/engine/interfaces build" \
"@/web/src/engine/device-detect build" \
"@/web/src/engine/js-processor build" \
"@/web/src/engine/keyboard-storage build" \
"@/web/src/engine/osk build" \
"@/web/src/engine/predictive-text/worker-main" \
"@/developer/src/kmc-model test" \
"clean" \
"configure" \
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "${THIS_SCRIPT%/*}/../../resources/build/builder.inc.sh"
. "${THIS_SCRIPT%/*}/../../../../../resources/build/builder.inc.sh"
## END STANDARD BUILD SCRIPT INCLUDE

. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
Expand All @@ -31,7 +31,7 @@ builder_describe "Builds the lm-layer module" \

builder_describe_outputs \
configure /node_modules \
build /common/predictive-text/build/lib/web/index.mjs # is built by the final step.
build /web/src/engine/predictive-text/worker-main/build/lib/web/index.mjs # is built by the final step.

builder_parse "$@"

Expand All @@ -48,8 +48,8 @@ function do_build() {
tsc -b ./tsconfig.all.json

# esbuild-bundled products at this level are not intended to be used for anything but testing.
$BUNDLE_CMD "${KEYMAN_ROOT}/common/predictive-text/build/obj/web/index.js" \
--out "${KEYMAN_ROOT}/common/predictive-text/build/lib/web/index.mjs" \
$BUNDLE_CMD "${KEYMAN_ROOT}/web/src/engine/predictive-text/worker-main/build/obj/web/index.js" \
--out "${KEYMAN_ROOT}/web/src/engine/predictive-text/worker-main/build/lib/web/index.mjs" \
--format esm
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../web/tsconfig.kmw-main-base.json",
"extends": "../../../../../../tsconfig.base.json",
"compilerOptions": {
// The Worker class needs access to the `new` keyword, else Node will throw an
// error when constructing the Worker for unit tests. ES6 is sufficient.
Expand Down
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions web/src/engine/predictive-text/worker-main/src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "../../../../../tsconfig.base.json",

"compilerOptions": {
"baseUrl": "./",
"outDir": "../build/obj",
"tsBuildInfoFile": "../build/obj/tsconfig.tsbuildinfo",
"rootDir": "./"
},
"references": [
{ "path": "../../../../../../common/web/utils" },
{ "path": "../../../../../../common/models/types"},
{ "path": "../../../../../../common/models/wordbreakers"},
{ "path": "../../../../../../common/web/lm-message-types"},
{ "path": "../../../../../../common/models/templates"}
],
"include" : [ "./*.ts" ],
"exclude" : [
"node",
"web",
"index.ts" // It's handled by the final layer.
]
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../web/tsconfig.kmw-main-base.json",
"extends": "../../../../../../tsconfig.base.json",
"compilerOptions": {
"lib": ["es6", "DOM"],
"baseUrl": "../",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// require separate sub-tsconfigs, both of which require common references. The multi-config
// setup in this project and its subfolders ensure all modules can compile cleanly and in the
// necessary compilation order.
"extends": "../web/tsconfig.kmw-main-base.json",
"extends": "../../../../tsconfig.base.json",

"compilerOptions": {
"baseUrl": "./",
Expand All @@ -13,11 +13,11 @@
},
"files": [],
"references": [
{ "path": "../web/utils" },
{ "path": "../models/types"},
{ "path": "../models/wordbreakers"},
{ "path": "../web/lm-message-types"},
{ "path": "../models/templates"},
{ "path": "../../../../../common/web/utils" },
{ "path": "../../../../../common/models/types"},
{ "path": "../../../../../common/models/wordbreakers"},
{ "path": "../../../../../common/web/lm-message-types"},
{ "path": "../../../../../common/models/templates"},
{ "path": "src/node" },
{ "path": "src/web" }
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { dirname, resolve } from 'path';
import { sessionStabilityReporter } from '@keymanapp/common-test-resources/test-runner-stability-reporter.mjs';

const dir = dirname(fileURLToPath(import.meta.url));
const KEYMAN_ROOT = resolve(dir, '../../../../');
const KEYMAN_ROOT = resolve(dir, '../../../../../../../');

/** @type {import('@web/test-runner').TestRunnerConfig} */
export default {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "${THIS_SCRIPT%/*}/../../../resources/build/build-utils.sh"
. "${THIS_SCRIPT%/*}/../../../../../../resources/build/build-utils.sh"
## END STANDARD BUILD SCRIPT INCLUDE

. "$KEYMAN_ROOT/resources/build/build-utils-ci.inc.sh"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ Install
**NOTE**: Requires Node >= 10.0

First, ensure that Keyman web and the LMLayer are built. You can run the
build script in `/web/source` to do this for you:
build script in `/web` to do this for you:

cd ../../../web/source
./build.sh
../../../../web/build.sh

Then, you can install locally with `npm`:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const {EventIterator} = require('event-iterator');
const program = require('commander');

// Load the most recent LMLayer code locally.
const LMLayer = require('../../predictive-text');
const LMLayer = require('../../../engine/predictive-text/worker-main');


///////////////////////////////// Constants /////////////////////////////////
Expand Down Expand Up @@ -331,7 +331,7 @@ async function asyncRepl(modelFile) {

function createAsyncWorker() {
// XXX: import the LMLayerWorker directly -- I know where it is built.
const LMLayerWorker = require('../../predictive-text/build/intermediate');
const LMLayerWorker = require('../../../engine/predictive-text/build/intermediate');
const vm = require('vm');

let worker = {
Expand Down
File renamed without changes.

0 comments on commit 35481fe

Please sign in to comment.