mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-09 18:35:32 +00:00
Merge pull request #12384 from keymanapp/refactor/web/12025_web-utils
refactor(web): move `common/web/utils` to `web/src/engine/common/web-utils/` 🏗️
This commit is contained in:
commit
367b029979
39 changed files with 44 additions and 41 deletions
|
|
@ -16,7 +16,6 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
|
|||
builder_describe "Keyman common web modules" \
|
||||
:keyman-version \
|
||||
:types \
|
||||
:utils \
|
||||
clean \
|
||||
configure \
|
||||
build \
|
||||
|
|
|
|||
26
package-lock.json
generated
26
package-lock.json
generated
|
|
@ -316,18 +316,6 @@
|
|||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"common/web/utils": {
|
||||
"name": "@keymanapp/web-utils",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@keymanapp/keyman-version": "*",
|
||||
"@keymanapp/resources-gosh": "*",
|
||||
"c8": "^7.12.0",
|
||||
"mocha": "^10.0.0",
|
||||
"mocha-teamcity-reporter": "^4.0.0",
|
||||
"typescript": "^5.4.5"
|
||||
}
|
||||
},
|
||||
"core/include/ldml": {
|
||||
"name": "@keymanapp/ldml-keyboard-constants",
|
||||
"license": "MIT"
|
||||
|
|
@ -2824,7 +2812,7 @@
|
|||
"link": true
|
||||
},
|
||||
"node_modules/@keymanapp/web-utils": {
|
||||
"resolved": "common/web/utils",
|
||||
"resolved": "web/src/engine/common/web-utils",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@mdn/browser-compat-data": {
|
||||
|
|
@ -14707,6 +14695,18 @@
|
|||
"mocha": "^10.0.0"
|
||||
}
|
||||
},
|
||||
"web/src/engine/common/web-utils": {
|
||||
"name": "@keymanapp/web-utils",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@keymanapp/keyman-version": "*",
|
||||
"@keymanapp/resources-gosh": "*",
|
||||
"c8": "^7.12.0",
|
||||
"mocha": "^10.0.0",
|
||||
"mocha-teamcity-reporter": "^4.0.0",
|
||||
"typescript": "^5.4.5"
|
||||
}
|
||||
},
|
||||
"web/src/engine/osk/gesture-processor": {
|
||||
"name": "@keymanapp/gesture-recognizer",
|
||||
"dependencies": {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
"@keymanapp/keyman": ["./web" ],
|
||||
"@keymanapp/models-templates": ["./web/src/engine/predictive-text/templates/"],
|
||||
"@keymanapp/models-wordbreakers": ["./web/src/engine/predictive-text/wordbreakers"],
|
||||
"@keymanapp/web-utils": ["./common/web/utils"],
|
||||
"@keymanapp/web-utils": ["./web/src/engine/common/web-utils"],
|
||||
"@keymanapp/lm-message-types": ["./web/src/engine/predictive-text/types"],
|
||||
"@keymanapp/keyman-version": ["./common/web/keyman-version"],
|
||||
"@keymanapp/ldml-keyboard-constants": [ "./core/include/ldml" ],
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
{ "path": "./common/web/recorder/tsconfig.json" },
|
||||
{ "path": "./common/web/sentry-manager/src/tsconfig.json" },
|
||||
{ "path": "./common/web/types/" },
|
||||
{ "path": "./common/web/utils/tsconfig.json" },
|
||||
|
||||
{ "path": "./developer/src/common/web/test-helpers/tsconfig.json" },
|
||||
{ "path": "./developer/src/common/web/utils/tsconfig.json" },
|
||||
|
|
@ -35,6 +34,7 @@
|
|||
{ "path": "./resources/build/version/" },
|
||||
|
||||
{ "path": "./web/src/tsconfig.all.json" },
|
||||
{ "path": "./web/src/engine/common/web-utils" },
|
||||
{ "path": "./web/src/engine/predictive-text/types/" },
|
||||
{ "path": "./web/src/engine/predictive-text/templates" },
|
||||
{ "path": "./web/src/engine/predictive-text/wordbreakers" },
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ graph TD;
|
|||
KeyboardSpec["/web/src/engine/keyboard"];
|
||||
JSProc["/web/src/engine/js-processor"];
|
||||
OSK-->KeyboardSpec;
|
||||
WebUtils["@keymanapp/web-utils<br>(/common/web/utils)"];
|
||||
WebUtils["@keymanapp/web-utils<br>(/web/src/engine/common/web-utils)"];
|
||||
KeyboardSpec---->WebUtils;
|
||||
Wordbreakers["@keymanapp/models-wordbreakers<br>(/web/src/engine/predictive-text/wordbreakers)"];
|
||||
Models["@keymanapp/models-templates<br>(/web/src/engine/predictive-text/templates/)"];
|
||||
|
|
|
|||
|
|
@ -5,11 +5,15 @@
|
|||
## 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}/web/common.inc.sh"
|
||||
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
|
||||
|
||||
SUBPROJECT_NAME=engine/common/web-utils
|
||||
BUILD_DIR="/web/src/engine/common/web-utils/build"
|
||||
|
||||
BUNDLE_CMD="node $KEYMAN_ROOT/common/web/es-bundling/build/common-bundle.mjs"
|
||||
|
||||
################################ Main script ################################
|
||||
|
|
@ -23,21 +27,21 @@ builder_describe \
|
|||
|
||||
builder_describe_outputs \
|
||||
configure "/node_modules" \
|
||||
build "/common/web/utils/build/obj/index.js"
|
||||
build "${BUILD_DIR}/obj/index.js"
|
||||
|
||||
builder_parse "$@"
|
||||
|
||||
function do_build() {
|
||||
tsc --build "$THIS_SCRIPT_PATH/tsconfig.json"
|
||||
tsc --build $builder_verbose "$THIS_SCRIPT_PATH/tsconfig.json"
|
||||
|
||||
# May be useful one day, for building a mass .d.ts for KMW as a whole.
|
||||
# So... tsc does declaration-bundling on its own pretty well, at least for local development.
|
||||
tsc --emitDeclarationOnly --outFile ./build/lib/index.d.ts
|
||||
tsc --emitDeclarationOnly --outFile "${KEYMAN_ROOT}/${BUILD_DIR}/lib/index.d.ts"
|
||||
|
||||
# One of the functions (timedPromise) is quite helpful for automated testing, even in the DOM.
|
||||
# So, to make sure it's easily-accessible for the DOM-based tests...
|
||||
$BUNDLE_CMD "${KEYMAN_ROOT}/common/web/utils/build/obj/index.js" \
|
||||
--out "${KEYMAN_ROOT}/common/web/utils/build/lib/index.mjs" \
|
||||
$BUNDLE_CMD "${KEYMAN_ROOT}/${BUILD_DIR}/obj/index.js" \
|
||||
--out "${KEYMAN_ROOT}/${BUILD_DIR}/lib/index.mjs" \
|
||||
--format esm
|
||||
}
|
||||
|
||||
|
|
@ -56,4 +60,4 @@ function do_test() {
|
|||
builder_run_action configure verify_npm_setup
|
||||
builder_run_action clean rm -rf build/
|
||||
builder_run_action build do_build
|
||||
builder_run_action test do_test
|
||||
builder_run_action test do_test
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"extends": "../tsconfig.kmw-main-base.json",
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./build/obj/tsconfig.tsbuildinfo",
|
||||
"baseUrl": "./",
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
"rootDir": "./src"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../keyman-version"}
|
||||
{ "path": "../../../../../common/web/keyman-version" },
|
||||
],
|
||||
"include": [
|
||||
"src/*.ts"
|
||||
|
|
@ -14,7 +14,7 @@ SUBPROJECT_NAME=engine/device-detect
|
|||
|
||||
builder_describe "Builds the device-detection component of Keyman Engine for Web (KMW)." \
|
||||
"@/common/web/keyman-version" \
|
||||
"@/common/web/utils" \
|
||||
"@/web/src/engine/common/web-utils" \
|
||||
"clean" \
|
||||
"configure" \
|
||||
"build" \
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@
|
|||
|
||||
"references": [
|
||||
{ "path": "../../../../common/web/keyman-version" },
|
||||
{ "path": "../../../../common/web/utils" }
|
||||
{ "path": "../common/web-utils" }
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ SUBPROJECT_NAME=engine/dom-utils
|
|||
# ################################ Main script ################################
|
||||
|
||||
builder_describe "Builds DOM-utility modules used by the Keyman Engine for Web (KMW)." \
|
||||
"@/common/web/utils" \
|
||||
"@/web/src/engine/common/web-utils" \
|
||||
"@/web/src/engine/keyboard" \
|
||||
"clean" \
|
||||
"configure" \
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@
|
|||
|
||||
"references": [
|
||||
{ "path": "../keyboard" },
|
||||
{ "path": "../../../../common/web/utils" }
|
||||
{ "path": "../common/web-utils" }
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ SUBPROJECT_NAME=engine/events
|
|||
# ################################ Main script ################################
|
||||
|
||||
builder_describe "Builds specialized event-related modules utilized by Keyman Engine for Web." \
|
||||
"@/common/web/utils build" \
|
||||
"@/web/src/engine/common/web-utils build" \
|
||||
"@/web/src/engine/keyboard build" \
|
||||
"clean" \
|
||||
"configure" \
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
"include": [ "src/**/*.ts" ],
|
||||
|
||||
"references": [
|
||||
{ "path": "../../../../common/web/utils" },
|
||||
{ "path": "../common/web-utils" },
|
||||
{ "path": "../keyboard" }
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ builder_describe \
|
|||
"@/common/web/keyman-version" \
|
||||
"@/common/web/es-bundling" \
|
||||
"@/common/web/types" \
|
||||
"@/common/web/utils" \
|
||||
"@/web/src/engine/common/web-utils" \
|
||||
configure \
|
||||
clean \
|
||||
build \
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ BUILD_DIR="/web/src/engine/osk/gesture-processor/build"
|
|||
|
||||
builder_describe "Builds the gesture-recognition model for Web-based on-screen keyboards" \
|
||||
"@/common/web/es-bundling build" \
|
||||
"@/common/web/utils build" \
|
||||
"@/web/src/engine/common/web-utils build" \
|
||||
"clean" \
|
||||
"configure" \
|
||||
"build" \
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"include": ["./src/engine/**/*.ts"],
|
||||
"references": [
|
||||
{ "path": "../../../../../common/web/utils" },
|
||||
{ "path": "../../common/web-utils" },
|
||||
],
|
||||
"exclude": ["./src/test/**/*.ts", "./src/tools/**/*.ts"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"references": [
|
||||
{ "path": "../../../../../common/web/types" },
|
||||
{ "path": "../../../../../common/web/utils" },
|
||||
{ "path": "../../common/web-utils" },
|
||||
{ "path": "../wordbreakers" }
|
||||
],
|
||||
"include": [
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
"rootDir": "./"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../../../../../../common/web/utils" },
|
||||
{ "path": "../../../common/web-utils" },
|
||||
{ "path": "../../../../../../common/web/types"},
|
||||
{ "path": "../../types"}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
},
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "../../../../../common/web/utils" },
|
||||
{ "path": "../../common/web-utils" },
|
||||
{ "path": "../../../../../common/web/types"},
|
||||
{ "path": "../types"},
|
||||
{ "path": "src/node" },
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
{ "path": "../types" },
|
||||
// modules
|
||||
{ "path": "../../../../../common/web/keyman-version" },
|
||||
{ "path": "../../../../../common/web/utils" },
|
||||
{ "path": "../../common/web-utils" },
|
||||
{ "path": "../templates" },
|
||||
{ "path": "../wordbreakers" },
|
||||
],
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
"references": [
|
||||
{ "path": "../../../../../common/web/keyman-version" },
|
||||
{ "path": "../../../../../common/web/utils/" },
|
||||
{ "path": "../../../engine/common/web-utils/" },
|
||||
{ "path": "../../../engine/predictive-text/types" },
|
||||
{ "path": "../../../engine/js-processor" },
|
||||
{ "path": "../../../engine/keyboard" },
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
"references": [
|
||||
{ "path": "../../../../../common/web/keyman-version" },
|
||||
{ "path": "../../../../../common/web/utils" },
|
||||
{ "path": "../../../engine/common/web-utils" },
|
||||
{ "path": "../../../engine/predictive-text/types" },
|
||||
{ "path": "../../../app/browser" },
|
||||
{ "path": "../recorder-core" },
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue