Skip to content

Commit

Permalink
Merge pull request #10690 from keymanapp/feat/web/wordbreaker-propert…
Browse files Browse the repository at this point in the history
…y-data-gen

feat(web): import the generator for the pred-text wordbreaker's Unicode-property data-table ⚡
  • Loading branch information
jahorton authored Aug 27, 2024
2 parents c3535b4 + be24a7d commit 3e89ff8
Show file tree
Hide file tree
Showing 17 changed files with 3,294 additions and 1,826 deletions.
3 changes: 2 additions & 1 deletion common/models/wordbreakers/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
build/
build/
src/main/default/data.inc.ts
22 changes: 17 additions & 5 deletions common/models/wordbreakers/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"

################################ Main script ################################

# Note: the raw text files used for data.inc.ts are found within
# /resources/standards-data/unicode-character-database.
builder_describe "Builds the predictive-text wordbreaker implementation module" \
"clean" \
"configure" \
Expand All @@ -20,16 +22,26 @@ builder_describe "Builds the predictive-text wordbreaker implementation module"
"--ci"

builder_describe_outputs \
configure /node_modules \
build build/obj/index.js
configure src/main/default/data.inc.ts \
build build/main/obj/index.js

builder_parse "$@"

function do_configure() {
verify_npm_setup

# This is a script used to build the data.inc.ts file needed by the
# default wordbreaker. We rarely update the backing data, but it
# is needed _before_ the `build` action's compilation step.
tsc -b tools/data-compiler/tsconfig.json
node ./build/tools/data-compiler/obj/index.js
}

function do_build() {
tsc -b
tsc -b ./tsconfig.json

# Declaration bundling.
tsc --emitDeclarationOnly --outFile ./build/lib/index.d.ts
tsc -p ./tsconfig.json --emitDeclarationOnly --outFile ./build/main/lib/index.d.ts
}

function do_test() {
Expand All @@ -40,7 +52,7 @@ function do_test() {
fi
}

builder_run_action configure verify_npm_setup
builder_run_action configure do_configure
builder_run_action clean rm -rf build/
builder_run_action build do_build
builder_run_action test do_test
18 changes: 12 additions & 6 deletions common/models/wordbreakers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,23 @@
],
"homepage": "https://github.com/keymanapp/keyman",
"license": "MIT",
"main": "build/obj/index.js",
"types": "build/obj/index.d.ts",
"main": "build/main/obj/index.js",
"types": "build/main/obj/index.d.ts",
"exports": {
".": {
"es6-bundling": "./src/index.ts",
"default": "./build/obj/index.js"
"es6-bundling": "./src/main/index.ts",
"default": "./build/main/obj/index.js"
},
"./lib": {
"types": "./build/lib/index.d.ts"
"types": "./build/main/lib/index.d.ts"
},
"./obj/*.js": "./build/obj/*.js"
"./obj/*.js": "./build/main/obj/*.js",
"./test-index": {
"default": "./build/main/obj/test-index.js"
},
"./README.md": {
"default": "./README.md"
}
},
"directories": {
"lib": "lib",
Expand Down
Loading

0 comments on commit 3e89ff8

Please sign in to comment.