feat(developer): fixup and prepare build scripts and docs for kmc

This commit is contained in:
Marc Durdin 2022-09-19 06:36:06 +10:00
parent 2d55546e55
commit 003f23d7b4
60 changed files with 3026 additions and 3179 deletions

6
.gitignore vendored
View file

@ -165,6 +165,7 @@ resources/environment.sh
/core/VERSION.md
**/node_modules/
tsconfig.tsbuildinfo
# Windows system files
Thumbs.db
@ -172,3 +173,8 @@ Thumbs.db
# Temporary file for logging scripts in xcode runs, see build-utils.sh for
# details
/xcodebuild-scripts.log
#
# Code coverage tools for JS/TS - nyc and c8
#
.nyc_output/

6
.nycrc.json Normal file
View file

@ -0,0 +1,6 @@
{
"check-coverage": true,
"temp-directory": ".nyc_output",
"lines": 90,
"reporter": "text"
}

View file

@ -17,7 +17,7 @@
},
"homepage": "https://github.com/keymanapp/keyman#readme",
"devDependencies": {
"@keymanapp/lexical-model-compiler": "*",
"@keymanapp/kmc": "*",
"@keymanapp/resources-gosh": "*",
"@types/node": "^11.9.4",
"chai": "^4.3.4",

View file

@ -61,8 +61,8 @@ if [ $FETCH_DEPS = true ]; then
fi
# Ensures that the lexical model compiler has been built locally.
echo_heading "Preparing Lexical Model Compiler for test use"
pushd "$KEYMAN_ROOT/developer/src/kmlmc/"
echo_heading "Preparing Lexical Model Compiler (kmc-model) for test use"
pushd "$KEYMAN_ROOT/developer/src/kmc-model/"
./build.sh
popd

View file

@ -1,2 +1,5 @@
# version.inc.ts is generated during the build
version.inc.ts
version.inc.ts
# keyman-version.mts (esm clone of version.inc.ts) is generated during the build
keyman-version.mts

View file

@ -37,7 +37,24 @@ if builder_has_action clean; then
fi
if builder_has_action build; then
# Generate index.ts
# Generate keyman-version.mts
echo "
// Generated by common/web/keyman-version/build.sh
export default class KEYMAN_VERSION {
static readonly VERSION = \"$VERSION\";
static readonly VERSION_RELEASE =\"$VERSION_RELEASE\";
static readonly VERSION_MAJOR = \"$VERSION_MAJOR\";
static readonly VERSION_MINOR = \"$VERSION_MINOR\";
static readonly VERSION_PATCH = \"$VERSION_PATCH\";
static readonly TIER =\"$TIER\";
static readonly VERSION_TAG = \"$VERSION_TAG\";
static readonly VERSION_WITH_TAG = \"$VERSION_WITH_TAG\";
static readonly VERSION_ENVIRONMENT = \"$VERSION_ENVIRONMENT\";
static readonly SENTRY_RELEASE = \"release-$VERSION_WITH_TAG\";
}
" > ./keyman-version.mts
# Generate version.inc.ts -- used by TypeScript code that isn't yet modular
echo "
// Generated by common/web/keyman-version/build.sh
namespace com.keyman {

View file

@ -2,7 +2,10 @@
"name": "@keymanapp/keyman-version",
"description": "Keyman global version data",
"main": "./build/index.js",
"exports": "./build/index.js",
"exports": {
".": "./build/index.js",
"./keyman-version.mjs": "./build/keyman-version.mjs"
},
"scripts": {
"build": "echo 'Building @keymanapp/keyman-version' && tsc -b",
"clean": "tsc -b --clean"

View file

@ -0,0 +1,18 @@
{
"extends": "../../../tsconfig-base.json",
"compilerOptions": {
"allowJs": false,
"declaration": true,
"module": "es2020",
"outDir": "./build/",
"baseUrl": ".",
"rootDir": ".",
"sourceMap": true,
"lib": ["es6"],
"target": "es6",
},
"include": [
"keyman-version.mts"
]
}

View file

@ -25,7 +25,7 @@ foreach kbd : tests
)
configure_file(
command: kmc_cmd + ['@INPUT@', '--outFile', '@OUTPUT@'],
command: kmc_cmd + ['@INPUT@', '--out-file', '@OUTPUT@'],
output: kbd + '.kmx',
input: kbd + '.xml'
)

View file

@ -31,7 +31,6 @@ inst/setup.inf
inst/setup.zip
inst/templates.wxs
inst/xml.wxs
inst/kmlmc.wxs
inst/kmc.wxs
# /developer/TIKE/
@ -87,7 +86,8 @@ tds_file.txt
# Breakpad files generated for Sentry
**/*.sym
# All kmc projects have build/ folders
kmc/build/
kmc-*/build/

View file

@ -12,10 +12,6 @@ DEVELOPER_PROGRAM=$(DEVELOPER_ROOT)\bin
DEVELOPER_OUTLIB=$(DEVELOPER_ROOT)\lib
DEVELOPER_DEBUGPATH=$(DEVELOPER_ROOT)\debug
KEYMAN_MODELCOMPILER_ROOT=$(DEVELOPER_ROOT)\src\kmlmc
KEYMAN_LDMLKEYBOARDCOMPILER_ROOT=$(DEVELOPER_ROOT)\src\kmc
DEVELOPER_DELPHIDPKPARAMS=-Q -B -GD -VT -^$C+ -^$D+ -^$J+ -^$L+ -^$O+ -^$Q- -^$R- -^$W+ -^$Y+ -E. $(DELPHIWARNINGS) -I$(DELPHIINCLUDES) -U$(DELPHIINCLUDES) -R$(DELPHIINCLUDES) -NSVcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Web;Soap;Winapi;System.Win -LE$(DEVELOPER_OUTLIB) -LN$(DEVELOPER_OUTLIB) -NSData -NUobj\Win32\$(TARGET_PATH)
DEVELOPER_DCC32DPK=cmd /c "$(DCC32PATH)\dcc32.exe" $(DEVELOPER_DELPHIDPKPARAMS)

View file

@ -3,9 +3,9 @@
#
!ifdef NODELPHI
TARGETS=build-tools kmcmpdll kmanalyze kmdecomp server kmlmc kmc
TARGETS=build-tools kmcmpdll kmanalyze kmdecomp server kmc
!else
TARGETS=build-tools kmcmpdll kmcomp kmanalyze kmconvert tike samples setup inst kmdecomp server kmlmc kmc
TARGETS=build-tools kmcmpdll kmcomp kmanalyze kmconvert tike samples setup inst kmdecomp server kmc
!endif
EXCLUDEPATHDEFINES=1
@ -65,12 +65,24 @@ server: .virtual
cd $(DEVELOPER_ROOT)\src\server
$(MAKE) $(TARGET)
kmlmc: .virtual
cd $(DEVELOPER_ROOT)\src\kmlmc
kmc: kmc-keyboard kmc-model kmc-model-info kmc-package
cd $(DEVELOPER_ROOT)\src\kmc
$(MAKE) $(TARGET)
kmc: .virtual
cd $(DEVELOPER_ROOT)\src\kmc
kmc-keyboard: .virtual
cd $(DEVELOPER_ROOT)\src\kmc-keyboard
$(MAKE) $(TARGET)
kmc-model: .virtual
cd $(DEVELOPER_ROOT)\src\kmc-model
$(MAKE) $(TARGET)
kmc-model-info: .virtual
cd $(DEVELOPER_ROOT)\src\kmc-model-info
$(MAKE) $(TARGET)
kmc-package: .virtual
cd $(DEVELOPER_ROOT)\src\kmc-package
$(MAKE) $(TARGET)
# ----------------------------------------------------------------------

View file

@ -27,10 +27,10 @@ Building and signing of the installation archive keymandeveloper.msi.
### src/inst/node
Contains a minimal distribution of node.js intended just for compiling lexical
models. If more dependencies are required, then the developer will be expected
to install node.js themselves; this gets users going without requiring a large
installer or a full node.js install.
Contains a minimal distribution of node.js intended just for running kmc. If
more dependencies are required, then the developer will be expected to install
node.js themselves; this gets users going without requiring a large installer or
a full node.js install.
## src/kmanalyze - kmanalyze.exe
@ -66,27 +66,33 @@ Unsupported utility decompiles a Keyman .kmx keyboard. It will produce a .kmn
source file and optionally a .ico or .bmp image. see kmdecomp/kmdecomp.md for
details.
## src/kmlmc
## src/kmc
node-based compilers for lexical models
node-based next generation compiler, hosts kmc, kmlmi, kmlmc, kmlmp
### src/kmlmc/kmlmc - Lexical Model Compiler
### src/kmc-keyboard - LDML Keyboard Compiler
Next Generation keyboard compiler package - LDML keyboards only at present.
Command line access through kmc.
### src/kmc-model - Lexical Model Compiler
The Lexical Model Compiler, kmlmc, runs on nodeJS on all supported desktop
platforms.
platforms. Command line access through kmc/kmlmc.
### src/kmlmc/kmlmp - Package Compiler
### src/kmc-package - Package Compiler
The package compiler is broadly compatible with the kmcomp .kps package
compiler. However at this stage it is only tested with lexical models, and use
with keyboards (either .js or .kmx) is not tested or supported. It is likely in
the future that the kmcomp .kps compiler will be deprecated in favour of this
one.
one. Command line access through kmc/kmlmp.
### src/kmlmc/kmlmi - Model Info Compiler
### src/kmc-model-info - Model Info Compiler
Merges .model_info files for use on the Keyman Cloud lexical model repository
at https://github.com/keymanapp/lexical-models.
Merges .model_info files for use on the Keyman Cloud lexical model repository at
https://github.com/keymanapp/lexical-models. Command line access through
kmc/kmlmi.
## src/samples

View file

@ -6,7 +6,7 @@
# ----------------------------------------------------------------------
DEVELOPER_FILES=kmdev.wixobj xml.wixobj cef.wixobj templates.wixobj kmlmc.wixobj server.wixobj kmc.wixobj
DEVELOPER_FILES=kmdev.wixobj xml.wixobj cef.wixobj templates.wixobj server.wixobj kmc.wixobj
setup:
#
@ -60,7 +60,7 @@ clean:
-del /Q xml.wxs
-del /Q cef.wxs
-del /Q templates.wxs
-del /Q kmlmc.wxs
-del /Q kmc.wxs
test-releaseexists:
cd $(DEVELOPER_ROOT)\src\inst

View file

@ -16,8 +16,7 @@ KEYMAN_WIX_TEMP_BASE=$(TEMP)\keyman_wix_build
KEYMAN_WIX_TEMP_XML=$(TEMP)\keyman_wix_build\xml
KEYMAN_WIX_TEMP_CEF=$(TEMP)\keyman_wix_build\cef
KEYMAN_WIX_TEMP_TEMPLATES=$(TEMP)\keyman_wix_build\templates
KEYMAN_WIX_TEMP_MODELCOMPILER=$(TEMP)\keyman_wix_build\ModelCompiler
KEYMAN_WIX_TEMP_LDMLKEYBOARDCOMPILER=$(TEMP)\keyman_wix_build\LDMLKeyboardCompiler
KEYMAN_WIX_TEMP_KMC=$(TEMP)\keyman_wix_build\kmc
KEYMAN_WIX_TEMP_SERVER=$(TEMP)\keyman_wix_build\Server
KEYMAN_WIX_KMDEV_SERVER=$(DEVELOPER_ROOT)\bin\server
@ -31,16 +30,15 @@ copykmdev: makeinstaller make-kmcomp-install-zip
test-releaseexists:
if exist $(DEVELOPER_ROOT)\release\$Version\keymandeveloper*.msi echo. & echo Release $Version already exists. Delete it or update VERSION.md and try again & exit 1
candle: heat-cef heat-xml heat-templates heat-model-compiler heat-server heat-ldml-keyboard-compiler
candle: heat-cef heat-xml heat-templates heat-server heat-kmc
$(WIXCANDLE) -dVERSION=$VersionWin -dRELEASE=$VersionRelease kmdev.wxs
$(WIXCANDLE) -dVERSION=$VersionWin -dRELEASE=$VersionRelease -dXmlSourceDir=$(DEVELOPER_ROOT)\src\tike\xml xml.wxs
$(WIXCANDLE) -dVERSION=$VersionWin -dRELEASE=$VersionRelease -dCefSourceDir=$(KEYMAN_CEF4DELPHI_ROOT) cef.wxs
$(WIXCANDLE) -dVERSION=$VersionWin -dRELEASE=$VersionRelease -dTemplatesSourceDir=$(KEYMAN_DEVELOPER_TEMPLATES_ROOT) templates.wxs
$(WIXCANDLE) -dVERSION=$VersionWin -dRELEASE=$VersionRelease -dModelCompilerSourceDir=$(KEYMAN_WIX_TEMP_MODELCOMPILER) kmlmc.wxs
$(WIXCANDLE) -dVERSION=$VersionWin -dRELEASE=$VersionRelease -dLDMLKeyboardCompilerSourceDir=$(KEYMAN_WIX_TEMP_LDMLKEYBOARDCOMPILER) kmc.wxs
$(WIXCANDLE) -dVERSION=$VersionWin -dRELEASE=$VersionRelease -dkmcSourceDir=$(KEYMAN_WIX_TEMP_KMC) kmc.wxs
$(WIXCANDLE) -dVERSION=$VersionWin -dRELEASE=$VersionRelease -dServerSourceDir=$(KEYMAN_WIX_KMDEV_SERVER) server.wxs
clean-heat: clean-heat-model-compiler clean-heat-ldml-keyboard-compiler
clean-heat: clean-heat-kmc
heat-xml:
# We copy the files to a temp folder in order to exclude thumbs.db, .vs, etc from harvesting
@ -81,33 +79,19 @@ heat-server:
# When we candle/light build, we can grab the source files from the proper root so go ahead and delete the temp folder again
-rmdir /s/q $(KEYMAN_WIX_TEMP_SERVER)
heat-ldml-keyboard-compiler:
cd $(KEYMAN_LDMLKEYBOARDCOMPILER_ROOT)
heat-kmc:
cd $(DEVELOPER_ROOT)\src\kmc
# Build the distributable package
$(GIT_BASH_FOR_KEYMAN) build.sh bundle --build-path "$(KEYMAN_WIX_TEMP_BASE)"
# Build the .wxs file
cd $(DEVELOPER_ROOT)\src\inst
$(WIXHEAT) dir $(KEYMAN_WIX_TEMP_LDMLKEYBOARDCOMPILER) -o kmc.wxs -ag -cg LDMLKeyboardCompiler -dr INSTALLDIR -var var.LDMLKeyboardCompilerSourceDir -wx -nologo
$(WIXHEAT) dir $(KEYMAN_WIX_TEMP_KMC) -o kmc.wxs -ag -cg kmc -dr INSTALLDIR -var var.kmcSourceDir -wx -nologo
clean-heat-ldml-keyboard-compiler:
clean-heat-kmc:
# the production build generates files that are not in source, e.g. .ps1 scripts
# When we candle/light build, we can grab the source files from the proper root so go ahead and delete the temp folder again
-rmdir /s/q $(KEYMAN_WIX_TEMP_LDMLKEYBOARDCOMPILER)
heat-model-compiler:
cd $(KEYMAN_MODELCOMPILER_ROOT)
# Build the distributable package
$(GIT_BASH_FOR_KEYMAN) bundle.sh --build-path "$(KEYMAN_WIX_TEMP_BASE)"
# Build the .wxs file
cd $(DEVELOPER_ROOT)\src\inst
$(WIXHEAT) dir $(KEYMAN_WIX_TEMP_MODELCOMPILER) -o kmlmc.wxs -ag -cg ModelCompiler -dr INSTALLDIR -var var.ModelCompilerSourceDir -wx -nologo
clean-heat-model-compiler:
# the production build generates files that are not in source, e.g. .ps1 scripts
# When we candle/light build, we can grab the source files from the proper root so go ahead and delete the temp folder again
-rmdir /s/q $(KEYMAN_WIX_TEMP_MODELCOMPILER)
-rmdir /s/q $(KEYMAN_WIX_TEMP_KMC)
makeinstaller:
cd $(DEVELOPER_ROOT)\src\inst

View file

@ -363,8 +363,7 @@
<ComponentGroupRef Id="XML" />
<ComponentGroupRef Id="CEF" />
<ComponentGroupRef Id="Templates" />
<ComponentGroupRef Id="ModelCompiler" />
<ComponentGroupRef Id="LDMLKeyboardCompiler" />
<ComponentGroupRef Id="kmc" />
<ComponentGroupRef Id="Node" />
<ComponentGroupRef Id="KeymanDevSentryComponents" />
<ComponentGroupRef Id="Server" />

View file

@ -0,0 +1,39 @@
#
# Keyman Developer - kmc Keyboard Compiler Makefile
#
!include ..\Defines.mak
# We do configure here because parent Makefile calls this first; other
# kmc and kmc-* makefiles don't do it
build: configure .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh build
configure: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh configure
clean: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh clean
test: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh test
# build.sh bundle must be run from shell as it requires a temp folder to be
# passed in. See inst/download.in.mak for instantiation.
publish: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh publish
signcode:
@rem nothing to do
wrap-symbols:
@rem nothing to do
test-manifest:
@rem nothing to do
install:
@rem nothing to do
!include ..\Target.mak

View file

@ -0,0 +1,83 @@
#!/usr/bin/env bash
#
# Compiles the kmc keyboard compiler.
#
# Exit on command failure and when using unset variables:
set -eu
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
. "$(dirname "$THIS_SCRIPT")/../../../resources/build/build-utils.sh"
## END STANDARD BUILD SCRIPT INCLUDE
cd "$THIS_SCRIPT_PATH"
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
builder_describe "Build Keyman kmc Keyboard Compiler module" \
"configure" \
"build" \
"clean" \
"test" \
"build-fixtures builds test fixtures for manual examination" \
"publish publish to npm" \
"--dry-run,-n don't actually publish, just dry run"
builder_parse "$@"
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action clean; then
rm -rf ./build/ ./tsconfig.tsbuildinfo
builder_report success clean
else
# We need the schema file at runtime and bundled, so always copy it for all actions except `clean`
mkdir -p "$THIS_SCRIPT_PATH/build/src/"
cp "$KEYMAN_ROOT/resources/standards-data/ldml-keyboards/techpreview/ldml-keyboard.schema.json" "$THIS_SCRIPT_PATH/build/src/"
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action configure; then
verify_npm_setup
builder_report success configure
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action build; then
npm run build
builder_report success build
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action build-fixtures; then
# Build basic.kmx and emit its checksum
mkdir -p ./build/test/fixtures
node . ./test/fixtures/basic.xml --no-compiler-version --debug --out-file ./build/test/fixtures/basic-xml.kmx
printf "${COLOR_GREY}Checksum for basic-xml.kmx: ${COLOR_PURPLE}%s${COLOR_RESET}\n" \
"$(xxd -g 1 -l 12 ./build/test/fixtures/basic-xml.kmx | cut -d' ' -f 10-13)"
# Generate a binary file from basic.txt for comparison purposes
node ../../../common/tools/hextobin/build/hextobin.js ./test/fixtures/basic.txt ./build/test/fixtures/basic-txt.kmx
builder_report success build-fixtures
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action test; then
npm test
builder_report success test
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action publish; then
. "$KEYMAN_ROOT/resources/build/npm-publish.inc.sh"
npm_publish
builder_report success publish
fi

View file

@ -0,0 +1,54 @@
{
"name": "@keymanapp/kmc-keyboard",
"description": "Keyman Developer keyboard compiler",
"keywords": [
"keyboard",
"keyman",
"ldml",
"unicode"
],
"type": "module",
"exports": {
".": "./build/src/main.js"
},
"scripts": {
"build": "tsc -b",
"test": "cd test && tsc -b && cd .. && c8 mocha",
"prepublishOnly": "npm run build"
},
"author": "Marc Durdin <marc@keyman.com> (https://github.com/mcdurdin)",
"license": "MIT",
"bugs": {
"url": "https://github.com/keymanapp/keyman/issues"
},
"dependencies": {
"@keymanapp/keyman-version": "*",
"ajv": "^8.11.0",
"crc-32": "^1.2.2",
"restructure": "^3.0.0",
"semver": "^7.3.7",
"xml2js": "^0.4.19"
},
"devDependencies": {
"@types/chai": "^4.1.7",
"@types/mocha": "^5.2.7",
"@types/node": "^10.14.6",
"@types/xml2js": "^0.4.5",
"c8": "^7.12.0",
"chai": "^4.3.4",
"chalk": "^2.4.2",
"mocha": "^8.4.0",
"ts-node": "^9.1.1",
"typescript": "^4.5.4"
},
"mocha": {
"spec": "build/test/**/test-*.js",
"require": [
"source-map-support/register"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/keymanapp/keyman.git"
}
}

View file

@ -0,0 +1,19 @@
{
"extends": "../../kmc/tsconfig.kmc-base.json",
"compilerOptions": {
"rootDir": ".",
"rootDirs": ["./", "../src/"],
"outDir": "../build/test",
"baseUrl": ".",
"strictNullChecks": false, // TODO: get rid of this as some point
},
"include": [
"**/test-*.ts",
"./helpers/index.ts"
],
"references": [
{ "path": "../../../../common/web/keyman-version/tsconfig.esm.json" },
{ "path": "../" }
]
}

View file

@ -0,0 +1,17 @@
{
"extends": "../kmc/tsconfig.kmc-base.json",
"compilerOptions": {
"outDir": "build/src/",
"rootDir": "src/",
"baseUrl": ".",
"allowSyntheticDefaultImports": true // for ajv
},
"include": [
"src/**/*.ts"
],
"references": [
{ "path": "../../../common/web/keyman-version/tsconfig.esm.json" },
{ "path": "../../../core/include/ldml/"}
]
}

View file

@ -0,0 +1,38 @@
#
# Keyman Developer - kmc Model-Info Compiler Makefile
#
!include ..\Defines.mak
# We don't depend on configure here because kmc-keyboard does that already
build: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh build
configure: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh configure
clean: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh clean
test: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh test
# build.sh bundle must be run from shell as it requires a temp folder to be
# passed in. See inst/download.in.mak for instantiation.
publish: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh publish
signcode:
@rem nothing to do
wrap-symbols:
@rem nothing to do
test-manifest:
@rem nothing to do
install:
@rem nothing to do
!include ..\Target.mak

View file

@ -0,0 +1,63 @@
#!/usr/bin/env bash
#
# Compiles the kmc lexical model model-info compiler.
#
# Exit on command failure and when using unset variables:
set -eu
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
. "$(dirname "$THIS_SCRIPT")/../../../resources/build/build-utils.sh"
## END STANDARD BUILD SCRIPT INCLUDE
cd "$THIS_SCRIPT_PATH"
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
builder_describe "Build Keyman kmc Lexical Model model-info Compiler module" \
"configure" \
"build" \
"clean" \
"test" \
"publish publish to npm" \
"--dry-run,-n don't actually publish, just dry run"
builder_parse "$@"
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action clean; then
rm -rf ./build/ ./tsconfig.tsbuildinfo
builder_report success clean
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action configure; then
verify_npm_setup
builder_report success configure
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action build; then
npm run build
builder_report success build
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action test; then
#npm test - no tests as yet
builder_report success test
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action publish; then
. "$KEYMAN_ROOT/resources/build/npm-publish.inc.sh"
npm_publish
builder_report success publish
fi

View file

@ -0,0 +1,17 @@
{
"extends": "../kmc/tsconfig.kmc-base.json",
"compilerOptions": {
"outDir": "build/src/",
"rootDir": "src/",
"baseUrl": ".",
"paths": {
}
},
"include": [
"src/**/*.ts"
],
"references": [
{ "path": "../kmc-package" } // can we eliminate this in future?
]
}

View file

@ -0,0 +1,38 @@
#
# Keyman Developer - kmc Model Compiler Makefile
#
!include ..\Defines.mak
# We don't depend on configure here because kmc-keyboard does that already
build: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh build
configure: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh configure
clean: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh clean
test: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh test
# build.sh bundle must be run from shell as it requires a temp folder to be
# passed in. See inst/download.in.mak for instantiation.
publish: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh publish
signcode:
@rem nothing to do
wrap-symbols:
@rem nothing to do
test-manifest:
@rem nothing to do
install:
@rem nothing to do
!include ..\Target.mak

View file

@ -0,0 +1,67 @@
#!/usr/bin/env bash
#
# Compiles the kmc lexical model compiler.
#
# Exit on command failure and when using unset variables:
set -eu
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
. "$(dirname "$THIS_SCRIPT")/../../../resources/build/build-utils.sh"
## END STANDARD BUILD SCRIPT INCLUDE
cd "$THIS_SCRIPT_PATH"
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
builder_describe "Build Keyman kmc Lexical Model Compiler module" \
"configure" \
"build" \
"clean" \
"test" \
"publish publish to npm" \
"--dry-run,-n don't actually publish, just dry run"
builder_parse "$@"
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action clean; then
rm -rf ./build/ ./tsconfig.tsbuildinfo
builder_report success clean
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action configure; then
verify_npm_setup
builder_report success configure
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action build; then
# Note: build-cjs only emits lexical-model-compiler.cjs at this time, as that
# is the only file required by other non-ES modules
# (common/web/input-processor tests)
mkdir -p build/cjs-src
npm run build
builder_report success build
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action test; then
npm test
builder_report success test
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action publish; then
. "$KEYMAN_ROOT/resources/build/npm-publish.inc.sh"
npm_publish
builder_report success publish
fi

View file

@ -0,0 +1,57 @@
{
"name": "@keymanapp/kmc-model",
"description": "Keyman Developer lexical model compiler",
"keywords": [
"keyboard",
"keyman",
"unicode",
"lexical-model",
"predictive-text"
],
"type": "module",
"exports": {
".": "./build/src/main.js"
},
"scripts": {
"build": "tsc -b && npm run build-cjs",
"build-cjs": "esbuild build/src/lexical-model-compiler.js --bundle --platform=node --external:./node_modules/* > build/cjs-src/lexical-model-compiler.cjs",
"test": "cd test && tsc -b && cd .. && c8 mocha",
"prepublishOnly": "npm run build"
},
"author": "Marc Durdin <marc@keyman.com> (https://github.com/mcdurdin)",
"contributors": [
"Eddie Antonio Santos <Eddie.Santos@nrc-cnrc.gc.ca>",
"Joshua Horton"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/keymanapp/keyman/issues"
},
"dependencies": {
"@keymanapp/keyman-version": "*",
"@keymanapp/models-types": "*",
"typescript": "^4.8.3"
},
"devDependencies": {
"@types/chai": "^4.1.7",
"@types/mocha": "^5.2.7",
"@types/node": "^10.14.6",
"@types/xml2js": "^0.4.5",
"c8": "^7.12.0",
"chai": "^4.3.4",
"chalk": "^2.4.2",
"esbuild": "^0.15.7",
"mocha": "^10.0.0",
"ts-node": "^9.1.1"
},
"mocha": {
"spec": "build/test/**/test-*.js",
"require": [
"source-map-support/register"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/keymanapp/keyman.git"
}
}

View file

@ -0,0 +1,22 @@
{
"extends": "../../kmc/tsconfig.kmc-base.json",
"compilerOptions": {
"rootDir": ".",
"rootDirs": ["./", "../src/"],
"outDir": "../build/test",
"esModuleInterop": true,
"moduleResolution": "node16",
"allowSyntheticDefaultImports": true,
"baseUrl": ".",
},
"include": [
"**/test-*.ts",
"*.ts",
"helpers/*.ts",
"wordbreakers/*.ts"
],
"references": [
{ "path": "../" },
]
}

View file

@ -0,0 +1,17 @@
{
"extends": "../kmc/tsconfig.kmc-base.json",
"compilerOptions": {
"outDir": "build/src/",
"rootDir": "src/",
"baseUrl": ".",
"allowSyntheticDefaultImports": true,
},
"include": [
"src/**/*.ts"
],
"references": [
{ "path": "../../../common/web/keyman-version/tsconfig.esm.json" },
{ "path": "../../../common/models/types" },
]
}

View file

@ -0,0 +1,38 @@
#
# Keyman Developer - kmc Package Compiler Makefile
#
!include ..\Defines.mak
# We don't depend on configure here because kmc-keyboard does that already
build: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh build
configure: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh configure
clean: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh clean
test: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh test
# build.sh bundle must be run from shell as it requires a temp folder to be
# passed in. See inst/download.in.mak for instantiation.
publish: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh publish
signcode:
@rem nothing to do
wrap-symbols:
@rem nothing to do
test-manifest:
@rem nothing to do
install:
@rem nothing to do
!include ..\Target.mak

View file

@ -0,0 +1,63 @@
#!/usr/bin/env bash
#
# Compiles the kmc lexical model package compiler.
#
# Exit on command failure and when using unset variables:
set -eu
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
. "$(dirname "$THIS_SCRIPT")/../../../resources/build/build-utils.sh"
## END STANDARD BUILD SCRIPT INCLUDE
cd "$THIS_SCRIPT_PATH"
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
builder_describe "Build Keyman kmc Package Compiler module" \
"configure" \
"build" \
"clean" \
"test" \
"publish publish to npm" \
"--dry-run,-n don't actually publish, just dry run"
builder_parse "$@"
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action clean; then
rm -rf ./build/ ./tsconfig.tsbuildinfo
builder_report success clean
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action configure; then
verify_npm_setup
builder_report success configure
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action build; then
npm run build
builder_report success build
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action test; then
npm test
builder_report success test
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action publish; then
. "$KEYMAN_ROOT/resources/build/npm-publish.inc.sh"
npm_publish
builder_report success publish
fi

View file

@ -0,0 +1,53 @@
{
"name": "@keymanapp/kmc-package",
"description": "Keyman Developer package compiler",
"keywords": [
"keyboard",
"keyman",
"unicode"
],
"type": "module",
"exports": {
".": "./build/src/kmp-compiler.js",
"./kmp-json-file": "./build/src/kmp-json-file.js"
},
"scripts": {
"build": "tsc -b",
"test": "cd test && tsc -b && cd .. && mocha",
"coverage": "cd test && tsc -b && cd .. && c8 mocha",
"prepublishOnly": "npm run build"
},
"author": "Marc Durdin <marc@keyman.com> (https://github.com/mcdurdin)",
"contributors": [
"Eddie Antonio Santos <Eddie.Santos@nrc-cnrc.gc.ca>",
"Joshua Horton"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/keymanapp/keyman/issues"
},
"dependencies": {
"jszip": "^3.7.0"
},
"devDependencies": {
"@types/chai": "^4.1.7",
"@types/mocha": "^5.2.7",
"@types/node": "^10.14.6",
"c8": "^7.12.0",
"chai": "^4.3.4",
"chalk": "^2.4.2",
"mocha": "^8.4.0",
"ts-node": "^9.1.1",
"typescript": "^4.5.4"
},
"mocha": {
"spec": "build/test/**/test-*.js",
"require": [
"source-map-support/register"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/keymanapp/keyman.git"
}
}

View file

@ -0,0 +1,17 @@
{
"extends": "../../kmc/tsconfig.kmc-base.json",
"compilerOptions": {
"rootDir": ".",
"rootDirs": ["./", "../src/"],
"outDir": "../build/test",
"baseUrl": ".",
},
"include": [
"**/test-*.ts",
"helpers/*.ts"
],
"references": [
{ "path": "../" }
]
}

View file

@ -0,0 +1,14 @@
{
"extends": "../kmc/tsconfig.kmc-base.json",
"compilerOptions": {
"outDir": "build/src/",
"rootDir": "src/",
"allowSyntheticDefaultImports": true, // for jszip
},
"include": [
"src/**/*.ts"
],
"references": [
]
}

View file

@ -1,3 +0,0 @@
tsconfig.tsbuildinfo
build/
.nyc_output/

View file

@ -0,0 +1,12 @@
# Ignore files required only in development.
build.sh
bundle.inc.sh
Makefile
src/*
test/*
tools/*
tsconfig.json
tsconfig.kmc-base.json
# Ignore other unneeded build artifacts
.nyc_output/

View file

@ -1,10 +1,12 @@
#
# Keyman Developer - LDML Keyboard Compiler Makefile
# Keyman Developer - next generation compiler Makefile
#
!include ..\Defines.mak
build: configure .virtual
# We don't depend on configure here because kmc-keyboard does that already,
# called from parent folder Makefile
build: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh build
configure: .virtual

View file

@ -1,20 +1,36 @@
Keyman Developer - LDML Keyboard Compiler
Keyman Developer - Next Generation Compiler
================
This package provides the following Keyman **command line tool**:
This package provides the following Keyman **command line tools**:
- `kmc` — takes **LDML Keyboard .xml sources** and compiles them in to a
KMXPlus **.kmx** file.
- `kmlmc` — takes **lexical model sources** and compiles them in to a **.js**
file.
- `kmlmp` — uses a `.model.kmp` file to generate a redistributable **lexical
model package**.
- `kmlmi` — merges Keyman lexical model `.model_info` files.
`kmlmc` is intended to be used standalone, or as part of a build system. `kmlmp`
is used only by command line tools. `kmlmi` is used exclusively in the
[lexical-models repository][lexical models].
Note: `kmc` will in the future replace `kmlmc`, `kmlmp`, and `kmlmi`.
In order to build [lexical models][], these tools must be built and compiled.
[lexical models]: https://github.com/keymanapp/lexical-models
Install
-------
Install `kmlmdlc` globally:
Install `kmc` globally:
npm install -g @keymanapp/ldml-keyboard-compiler
npm install -g @keymanapp/kmc
Usage
-----
kmc Usage
---------
To compile an LDML keyboard from its `.xml` source, use `kmc`:
@ -24,6 +40,19 @@ To see more command line options by using the `--help` option:
kmc --help
kmlmc Usage
-----------
To compile a lexical model from its `.model.ts` source, use `kmlmc`:
kmlmc my-lexical-model.model.ts --outFile my-lexical-model.js
To see more command line options by using the `--help` option:
kmlmc --help
kmlmp --help
kmlmi --help
How to build from source
------------------------
@ -31,13 +60,18 @@ Run `build.sh`:
./build.sh configure build
or
or (less preferably -- build.sh is more efficient):
nmake configure build
Once you have `configure`d once, you should not normally need to do it
again unless dependencies change. `./build.sh` without parameters will
do the default action, which is `build`.
Once you have `configure`d once, you should not normally need to do it again
unless dependencies change or you clean the build folder. `./build.sh` without
parameters will do the default action, which is `build`.
TODO: Note that kmc currently depends on kmc-* to have been configured; while
the build of kmc will do the typescript component of the build, it will not be
able to do any other build steps, so you may wish to build each of the
components separately, one time.
How to run the tests
--------------------

View file

@ -16,13 +16,12 @@ cd "$THIS_SCRIPT_PATH"
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
builder_describe "Build Keyman LDML Keyboard Compiler kmc" \
builder_describe "Build Keyman Keyboard Compiler kmc" \
"configure runs 'npm ci' on root folder" \
"build (default) builds kmc to build/" \
"clean cleans build/ folder" \
"bundle creates a bundled version of kmc" \
"test run automated tests for kmc" \
"build-fixtures builds test fixtures for manual examination" \
"publish publish to npm" \
"--build-path=BUILD_PATH build directory for bundle" \
"--dry-run,-n don't actually publish, just dry run"
@ -34,17 +33,17 @@ builder_parse "$@"
if builder_has_action clean; then
rm -rf ./build/ ./tsconfig.tsbuildinfo
builder_report success clean
else
# We need the schema file at runtime and bundled, so always copy it for all actions except `clean`
mkdir -p "$THIS_SCRIPT_PATH/build/src/"
cp "$KEYMAN_ROOT/resources/standards-data/ldml-keyboards/techpreview/ldml-keyboard.schema.json" "$THIS_SCRIPT_PATH/build/src/"
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action configure; then
verify_npm_setup
# We need the schema file at runtime and bundled
mkdir -p "$THIS_SCRIPT_PATH/build/src/"
cp "$KEYMAN_ROOT/resources/standards-data/ldml-keyboards/techpreview/ldml-keyboard.schema.json" "$THIS_SCRIPT_PATH/build/src/"
builder_report success configure
fi
@ -57,60 +56,30 @@ fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action build-fixtures; then
# Build basic.kmx and emit its checksum
mkdir -p ./build/test/fixtures
node . ./test/fixtures/basic.xml --no-compiler-version --debug --out-file ./build/test/fixtures/basic-xml.kmx
printf "${COLOR_GREY}Checksum for basic-xml.kmx: ${COLOR_PURPLE}%s${COLOR_RESET}\n" \
"$(xxd -g 1 -l 12 ./build/test/fixtures/basic-xml.kmx | cut -d' ' -f 10-13)"
# Generate a binary file from basic.txt for comparison purposes
node ../../../common/tools/hextobin/build/hextobin.js ./test/fixtures/basic.txt ./build/test/fixtures/basic-txt.kmx
builder_report success build-fixtures
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action test; then
npm test
# npm test -- no tests as yet
builder_report success test
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action bundle; then
. ./bundle.inc.sh
bundle "$BUILD_PATH"
if ! builder_has_option --build-path; then
builder_report "Parameter --build-path is required" bundle
exit 64
fi
mkdir -p build/cjs-src
npm run bundle
cp build/cjs-src/* "$BUILD_PATH"
builder_report success bundle
fi
#-------------------------------------------------------------------------------------------------------------------
if builder_has_action publish; then
if [[ $TIER == stable ]]; then
npm_dist_tag=latest
else
npm_dist_tag=$TIER
fi
set_npm_version
if build_has_option --dry-run; then
DRY_RUN=--dry-run
else
DRY_RUN=
fi
#TEMP: we don't want to publish at this point!
DRY_RUN=--dry-run
# Note: In either case, npm publish MUST be given --access public to publish
# a package in the @keymanapp scope on the public npm package index.
#
# See `npm help publish` for more details.
echo "Publishing $DRY_RUN npm package with tag $npm_dist_tag"
npm publish $DRY_RUN --access public --tag $npm_dist_tag || fail "Could not publish $npm_dist_tag release."
. "$KEYMAN_ROOT/resources/build/npm-publish.inc.sh"
npm_publish
builder_report success publish
fi

View file

@ -1,110 +0,0 @@
#!/usr/bin/env bash
. "$KEYMAN_ROOT/resources/build/jq.inc.sh"
bundle() {
if [[ $# -eq 0 ]]; then
echo "Parameter --build-path is required"
exit 64
fi
local BUILD_PATH="$1"
# Input may be from a Windows build script, so we'll use cygpath to translate
case $(uname) in
CYGWIN* )
BUILD_PATH=$(cygpath -u "$BUILD_PATH")
;;
MINGW* )
BUILD_PATH=$(cygpath -u "$BUILD_PATH")
;;
esac
KEYMAN_WIX_TEMP_BASE="$BUILD_PATH"
KEYMAN_WIX_TEMP_LDMLKEYBOARDCOMPILER="$BUILD_PATH/LDMLKeyboardCompiler"
KEYMAN_LDMLKEYBOARDCOMPILER_TEMP=`mktemp -d`
echo "Temporary build path is $KEYMAN_LDMLKEYBOARDCOMPILER_TEMP"
mkdir -p "$KEYMAN_WIX_TEMP_LDMLKEYBOARDCOMPILER"
# We copy the built compiler into a temporary folder in order to prepare
# the node modules, as otherwise the workspace will interfere
cp -R "$KEYMAN_ROOT/developer/src/kmc/"* "$KEYMAN_LDMLKEYBOARDCOMPILER_TEMP/"
cd "$KEYMAN_LDMLKEYBOARDCOMPILER_TEMP"
# We use `npm pack` to extract only the aspects of the compiler actually
# needed for distribution. While we could use npm-bundle or similar, that adds
# extra, unwanted cruft; our approach gives us more control of the set of
# files distributed with the Keyman Developer installer.
#
# For users on other operating systems, node.js is a dependency and the
# compiler can be installed with `npm install
# @keymanapp/ldml-keyboard-compiler`.
# We copy the files to a temp folder in order to exclude thumbs.db, .vs, etc
# from harvesting
rm -rf "$KEYMAN_WIX_TEMP_LDMLKEYBOARDCOMPILER"
# Step 1 - npm-pack the compiler package, then unpack it in our bundling
# directory. This automatically strips the package to its barebones.
set_npm_version
npm pack
mv keymanapp-ldml-keyboard-compiler*.tgz kmc.tgz
mv kmc.tgz "$KEYMAN_WIX_TEMP_BASE"
# We extract the npm-packed version of the compiler in order to reproduce
# our needed bundle.
cd "$KEYMAN_WIX_TEMP_BASE"
tar xvzf kmc.tgz
# Creates the directory referenced by $(KEYMAN_WIX_TEMP_LDMLKEYBOARDCOMPILER).
mv package LDMLKeyboardCompiler
# Cleans up the npm pack artifacts, which are no longer needed.
rm kmc.tgz
# Step 2 - the compiler has one in-repo dependency that will also need to
# be packed. Managing other in-repo dependencies will be simpler; they install
# into LDMLKeyboardCompiler's extracted bundle.
mkdir -p "$KEYMAN_LDMLKEYBOARDCOMPILER_TEMP/node_modules/@keymanapp/"
cp -R "$KEYMAN_ROOT/node_modules/@keymanapp/keyman-version" "$KEYMAN_LDMLKEYBOARDCOMPILER_TEMP/node_modules/@keymanapp/"
cd "$KEYMAN_LDMLKEYBOARDCOMPILER_TEMP/node_modules/@keymanapp/keyman-version"
set_npm_version
npm pack
mv keymanapp-keyman-version*.tgz kmver.tgz
mv kmver.tgz "$KEYMAN_WIX_TEMP_LDMLKEYBOARDCOMPILER"
# Step 3 - install just the bare essentials by using our packed local
# dependency, followed by all external production dependencies.
cd "$KEYMAN_WIX_TEMP_LDMLKEYBOARDCOMPILER"
# package-lock.json wasn't bundled; this is needed to keep dependency versions
# consistent.
# as of npm v8.x, even though we are only working with `dependencies`,
# `devDependencies` is still checked, and as these modules are present in
# devDependencies but are only available when in the repo path, we need to
# remove them before attempting to continue.
# Yuck! ref: https://github.com/npm/cli/issues/3975#issuecomment-985305678
# ref: https://github.com/npm/cli/issues/2921
cat "$KEYMAN_LDMLKEYBOARDCOMPILER_TEMP/package.json" | "$JQ" \
'. | del(.devDependencies."@keymanapp/keyman-version")' \
> "package.json"
npm install kmver.tgz --production --no-optional
npm install --production --no-optional
# Clean up the npm pack artifacts for the dependencies.
rm -rf kmver.tgz
# We don't need the unit tests, source files, or build scripts
rm -rf test src *.sh Makefile tsconfig*
# Clean up our temporary build folder
rm -rf "$KEYMAN_LDMLKEYBOARDCOMPILER_TEMP"
}

View file

@ -1,43 +1,62 @@
{
"name": "@keymanapp/ldml-keyboard-compiler",
"description": "Keyman Developer LDML keyboard compiler",
"name": "@keymanapp/kmc",
"description": "Keyman Developer compiler command line tools",
"keywords": [
"keyboard",
"keyman",
"ldml",
"unicode"
"unicode",
"lexical-model",
"predictive-text"
],
"scripts": {
"build": "tsc -b",
"test": "cd test && tsc -b && cd .. && nyc --check-coverage --lines 90 --reporter=text mocha",
"bundle": "npm run bundle-kmc && npm run bundle-kmlmc && npm run bundle-kmlmi && npm run bundle-kmlmp",
"bundle-kmc": "esbuild build/src/kmc.js --bundle --platform=node > build/cjs-src/kmc.cjs",
"bundle-kmlmc": "esbuild build/src/kmlmc.js --bundle --platform=node > build/cjs-src/kmlmc.cjs",
"bundle-kmlmi": "esbuild build/src/kmlmi.js --bundle --platform=node > build/cjs-src/kmlmi.cjs",
"bundle-kmlmp": "esbuild build/src/kmlmp.js --bundle --platform=node > build/cjs-src/kmlmp.cjs",
"test": "cd test && tsc -b && cd .. && c8 mocha",
"prepublishOnly": "npm run build"
},
"type": "module",
"author": "Marc Durdin <marc@keyman.com> (https://github.com/mcdurdin)",
"contributors": [
"Eddie Antonio Santos <Eddie.Santos@nrc-cnrc.gc.ca>",
"Joshua Horton"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/keymanapp/keyman/issues"
},
"main": "build/src/kmc.js",
"bin": {
"kmc": "build/src/kmc.js"
"kmc": "build/src/kmc.js",
"kmlmc": "build/src/kmlmc.js",
"kmlmp": "build/src/kmlmp.js",
"kmlmi": "build/src/kmlmi.js"
},
"dependencies": {
"ajv": "^8.11.0",
"commander": "^3.0.0",
"crc-32": "^1.2.2",
"restructure": "^3.0.0",
"semver": "^7.3.7",
"typescript": "^4.5.4",
"xml2js": "^0.4.19"
"@keymanapp/keyman-version": "*",
"@keymanapp/kmc-keyboard": "*",
"@keymanapp/kmc-model": "*",
"@keymanapp/kmc-model-info": "*",
"@keymanapp/kmc-package": "*",
"@keymanapp/models-types": "*",
"commander": "^3.0.0"
},
"devDependencies": {
"@keymanapp/keyman-version": "*",
"@types/chai": "^4.1.7",
"@types/mocha": "^5.2.7",
"@types/node": "^10.14.6",
"@types/xml2js": "^0.4.5",
"c8": "^7.12.0",
"chai": "^4.3.4",
"chalk": "^2.4.2",
"esbuild": "^0.15.8",
"mocha": "^8.4.0",
"nyc": "^15.1.0",
"ts-node": "^9.1.1"
"ts-node": "^9.1.1",
"typescript": "^4.5.4"
},
"mocha": {
"spec": "build/test/**/test-*.js",

View file

@ -1,22 +0,0 @@
{
"extends": "../../../../tsconfig-base.json",
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"sourceMap": true,
"rootDir": ".",
"rootDirs": ["./", "../src/"],
"outDir": "../build/test",
"baseUrl": ".",
},
"include": [
"**/test-*.ts",
"./helpers/index.ts"
],
"references": [
{ "path": "../../../../common/web/keyman-version" },
{ "path": "../" }
]
}

View file

@ -1,27 +1,25 @@
{
"extends": "../../../tsconfig-base.json",
"extends": "./tsconfig.kmc-base.json",
"compilerOptions": {
"module": "commonjs",
"target": "es2020",
"moduleResolution": "node",
"sourceMap": true,
"outDir": "build/src/",
"rootDir": "src/",
"declaration": true,
"alwaysStrict": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"noImplicitAny": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"noUnusedLocals": true
"baseUrl": ".",
"paths": {
"@keymanapp/kmc-keyboard": [ "../kmc-keyboard/src/main" ],
"@keymanapp/kmc-model": [ "../kmc-model/src/main" ],
"@keymanapp/kmc-model-info": [ "../kmc-model-info/src/model-info-compiler" ],
"@keymanapp/kmc-package": [ "../kmc-package/src/kmp-compiler" ],
}
},
"include": [
"src/**/*.ts"
],
"references": [
{ "path": "../../../common/web/keyman-version" },
{ "path": "../../../core/include/ldml/"}
{ "path": "../../../common/web/keyman-version/tsconfig.esm.json" },
{ "path": "../kmc-keyboard" },
{ "path": "../kmc-model" },
{ "path": "../kmc-model-info" },
{ "path": "../kmc-package" },
]
}

View file

@ -0,0 +1,18 @@
{
"extends": "../../../tsconfig-base.json",
"compilerOptions": {
"module": "ES2022",
"target": "es2022",
"moduleResolution": "Node",
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"alwaysStrict": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"noImplicitAny": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"noUnusedLocals": true
},
}

View file

@ -1,5 +0,0 @@
node_modules/
dist/
dist-tests/
tsconfig.tsbuildinfo
tests/tsconfig.tsbuildinfo

View file

@ -1,6 +0,0 @@
# Ignore files required only in development.
build.sh
bundle.sh
source/*
tests/*
tsconfig.json

View file

@ -1,31 +0,0 @@
#
# Keyman Developer - Lexical Model Compiler Makefile
#
!include ..\Defines.mak
build: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh
clean: .virtual
#TODO: move to build.sh `clean` target
-rd /s/q dist
-rd /s/q dist-tests
-del tsconfig.tsbuildinfo
test: .virtual
$(GIT_BASH_FOR_KEYMAN) build.sh -tdd
signcode:
@rem nothing to do
wrap-symbols:
@rem nothing to do
test-manifest:
@rem This target needed as dependency for KMDECOMP
install:
@rem nothing to do
!include ..\Target.mak

View file

@ -1,54 +0,0 @@
Keyman Developer
================
This package provides the following Keyman **command line tools**:
- `kmlmc` — takes **lexical model sources** and compiles them in to
a **.js** file.
- `kmlmp` — uses a `.model.kmp` file to generate a redistributable
**lexical model package**.
- `kmlmi` — merges Keyman lexical model `.model_info` files.
`kmlmc` is intended to be used standalone, or as part of a build system.
`kmlmp` is used only by command line tools. `kmlmi` is used exclusively
in the [lexical-models repository][lexical models].
In order to build [lexical models][], these tools must be built and
compiled.
[lexical models]: https://github.com/keymanapp/lexical-models
Install
-------
Install `kmlmc`, `kmlmp`, and `kmlmi` globally:
npm install -g @keymanapp/lexical-model-compiler
Usage
-----
To compile a lexical model from its `.model.ts` source, use `kmlmc`:
kmlmc my-lexical-model.model.ts --outFile my-lexical-model.js
To see more command line options by using the `--help` option:
kmlmc --help
kmlmp --help
kmlmi --help
How to build from source
------------------------
Run `build.sh`:
./build.sh
How to run the tests
--------------------
./build.sh -test

View file

@ -1,123 +0,0 @@
#!/usr/bin/env bash
#
# Compiles the developer tools, including the language model compilers.
#
# Exit on command failure and when using unset variables:
set -eu
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
. "$(dirname "$THIS_SCRIPT")/../../../resources/build/build-utils.sh"
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
## END STANDARD BUILD SCRIPT INCLUDE
EX_USAGE=64
# Where to find lexical model types.
LEXICAL_MODELS_TYPES="$KEYMAN_ROOT/common/models/types"
# Build the main script.
build () {
npm run build || fail "Could not build top-level JavaScript file."
}
display_usage ( ) {
echo "Usage: $0 [-test] [-publish-to-npm]"
echo " $0 -help"
echo
echo " -help displays this screen and exits"
echo " -test runs unit tests after building"
echo " -tdd runs unit tests WITHOUT building"
echo " -skip-package-install, -S skip package installation"
echo " -publish-to-npm publishes the current version to the npm package index"
echo " -dry-run do build, etc, but don't actually publish"
}
################################ Main script ################################
run_tests=0
install_dependencies=1
should_publish=0
npm_dist_tag=
should_dry_run=0
# Process command-line arguments
while [[ $# -gt 0 ]] ; do
key="$1"
case $key in
-help|-h)
display_usage
exit
;;
-dry-run)
should_dry_run=1
;;
-skip-package-install|-S)
install_dependencies=0
;;
-test)
run_tests=1
;;
-tdd)
run_tests=1
install_dependencies=0
;;
-version)
echo "Warning: -version is now ignored"
;;
-tier)
echo "Warning: -tier is now ignored"
;;
-publish-to-npm)
should_publish=1
;;
*)
echo "$0: invalid option: $key"
display_usage
exit $EX_USAGE
esac
shift # past the processed argument
done
# Dry run settings
if (( should_dry_run )); then
DRY_RUN=--dry-run
else
DRY_RUN=
fi
# Check if Node.JS/npm is installed.
type npm >/dev/null ||\
fail "Build environment setup error detected! Please ensure Node.js is installed!"
if (( install_dependencies )) ; then
verify_npm_setup
# We need to build keyman-version and lm-worker with a script for now
"$KEYMAN_ROOT/common/web/keyman-version/build.sh" || fail "Could not build keyman-version"
fi
build || fail "Compilation failed."
echo "Typescript compilation successful."
if (( run_tests )); then
npm test || fail "Tests failed"
fi
if (( should_publish )); then
if [[ $TIER == stable ]]; then
npm_dist_tag=latest
else
npm_dist_tag=$TIER
fi
set_npm_version
# Note: In either case, npm publish MUST be given --access public to publish
# a package in the @keymanapp scope on the public npm package index.
#
# See `npm help publish` for more details.
echo "Publishing $DRY_RUN npm package with tag $npm_dist_tag"
npm publish $DRY_RUN --access public --tag $npm_dist_tag || fail "Could not publish $npm_dist_tag release."
fi

View file

@ -1,145 +0,0 @@
#!/usr/bin/env bash
set -eu
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
. "$(dirname "$THIS_SCRIPT")/../../../resources/build/build-utils.sh"
## END STANDARD BUILD SCRIPT INCLUDE
. "$KEYMAN_ROOT/resources/build/jq.inc.sh"
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
display_usage() {
echo "Usage: $0 --build-path path"
echo " $0 --help"
echo
echo "This script is called from the Keyman Developer installer build"
echo "and is not intended for standalone use."
echo
echo " --help displays this screen and exits"
echo " --build-path path temporary path where archive will be built"
}
BUILD_PATH=
# Process command-line arguments
while [[ $# -gt 0 ]] ; do
key="$1"
case $key in
-help|-h)
display_usage
exit
;;
--build-path)
shift
BUILD_PATH="$1"
;;
*)
echo "$0: invalid option: $key"
display_usage
exit 64
esac
shift # past the processed argument
done
if [[ -z $BUILD_PATH ]]; then
echo "Parameter --build-path is required"
display_usage
exit 64
fi
KEYMAN_WIX_TEMP_BASE="$BUILD_PATH"
KEYMAN_WIX_TEMP_MODELCOMPILER="$BUILD_PATH/ModelCompiler"
KEYMAN_MODELCOMPILER_TEMP=`mktemp -d`
# We copy the built model compiler into a temporary folder in order to prepare
# the node modules, as otherwise the workspace will interfere
cp -R "$KEYMAN_ROOT/developer/src/kmlmc/"* "$KEYMAN_MODELCOMPILER_TEMP/"
cd "$KEYMAN_MODELCOMPILER_TEMP"
# We use `npm pack` to extract only the aspects of the model-compiler actually
# needed for distribution. While we could use npm-bundle or similar, that adds
# extra, unwanted cruft; our approach gives us more control of the set of files
# distributed with the Keyman Developer installer.
#
# For users on other operating systems, node.js is a dependency and the compiler
# can be installed with `npm install @keymanapp/lexical-model-compiler`.
# We copy the files to a temp folder in order to exclude thumbs.db, .vs, etc
# from harvesting
rm -rf "$KEYMAN_WIX_TEMP_MODELCOMPILER"
# Step 1 - npm-pack the model compiler package, then unpack it in our bundling
# directory. This automatically strips the package to its barebones.
set_npm_version
npm pack
mv keymanapp-lexical-model-compiler*.tgz kmlmc.tgz
mv kmlmc.tgz "$KEYMAN_WIX_TEMP_BASE"
# We extract the npm-packed version of the model compiler in order to reproduce
# our needed bundle.
cd "$KEYMAN_WIX_TEMP_BASE"
tar xvzf kmlmc.tgz
# Creates the directory referenced by $(KEYMAN_WIX_TEMP_MODELCOMPILER).
mv package ModelCompiler
# Cleans up the npm pack artifacts, which are no longer needed.
rm kmlmc.tgz
# Step 2 - the model compiler has one in-repo dependency that will also need to
# be packed. Managing other in-repo dependencies will be simpler; they install
# into ModelCompiler's extracted bundle.
mkdir -p "$KEYMAN_MODELCOMPILER_TEMP/node_modules/@keymanapp/"
cp -R "$KEYMAN_ROOT/node_modules/@keymanapp/models-types" "$KEYMAN_MODELCOMPILER_TEMP/node_modules/@keymanapp/"
cd "$KEYMAN_MODELCOMPILER_TEMP/node_modules/@keymanapp/models-types"
set_npm_version
npm pack
mv keymanapp-models-types*.tgz kmtypes.tgz
mv kmtypes.tgz "$KEYMAN_WIX_TEMP_MODELCOMPILER"
cp -R "$KEYMAN_ROOT/node_modules/@keymanapp/keyman-version" "$KEYMAN_MODELCOMPILER_TEMP/node_modules/@keymanapp/"
cd "$KEYMAN_MODELCOMPILER_TEMP/node_modules/@keymanapp/keyman-version"
set_npm_version
npm pack
mv keymanapp-keyman-version*.tgz kmver.tgz
mv kmver.tgz "$KEYMAN_WIX_TEMP_MODELCOMPILER"
# Step 3 - install just the bare essentials by using our packed local
# dependency, followed by all external production dependencies.
cd "$KEYMAN_WIX_TEMP_MODELCOMPILER"
# package-lock.json wasn't bundled; this is needed to keep dependency versions
# consistent.
# as of npm v8.x, even though we are only working with `dependencies`,
# `devDependencies` is still checked, and as these modules are present in
# devDependencies but are only available when in the repo path, we need to
# remove them before attempting to continue.
# Yuck! ref: https://github.com/npm/cli/issues/3975#issuecomment-985305678
# ref: https://github.com/npm/cli/issues/2921
# can't use npm uninstall because it depends on @keymanapp/models-types being
# present!
cat "$KEYMAN_MODELCOMPILER_TEMP/package.json" | "$JQ" \
'. | del(.devDependencies."@keymanapp/models-templates") | del(.devDependencies."@keymanapp/keyman-version") | del(.devDependencies."@keymanapp/models-wordbreakers")' \
> "package.json"
npm install kmtypes.tgz --production --no-optional
npm install kmver.tgz --production --no-optional
npm install --production --no-optional
# Clean up the npm pack artifacts for the dependencies.
rm kmtypes.tgz
rm kmver.tgz
# We don't need the unit tests
rm -rf "$KEYMAN_WIX_TEMP_MODELCOMPILER/tests"
rm -rf "$KEYMAN_MODELCOMPILER_TEMP"

View file

@ -1,23 +0,0 @@
{
"extends": "../../../../tsconfig-base.json",
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"sourceMap": true,
"rootDir": "./",
"outDir": "../dist-tests/"
},
"include": [
"**/test-*.ts",
"helpers/index.ts"
],
"references": [
{ "path": "../../../../common/web/keyman-version" },
{ "path": "../../../../common/models/types" },
{ "path": "../../../../common/models/templates" },
{ "path": "../../../../common/models/wordbreakers" },
{ "path": "../"}
]
}

View file

@ -1,29 +0,0 @@
{
"extends": "../../../tsconfig-base.json",
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist/",
"rootDir": "source/",
"declaration": true,
"alwaysStrict": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"noImplicitAny": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"noUnusedLocals": true
},
"include": [
"source/**/*.ts"
],
"references": [
{ "path": "../../../common/web/keyman-version" },
{ "path": "../../../common/models/types" },
{ "path": "../../../common/models/templates" },
{ "path": "../../../common/models/wordbreakers" },
]
}

View file

@ -23,11 +23,13 @@ developer-tests: \
kmcomp-x64-structures \
kmconvert \
kmx-file-languages \
lexical-model-compiler \
model-ts-parser \
package-info \
kmlmc \
kmc
kmc \
kmc-keyboard \
kmc-model \
kmc-model-info \
kmc-package
# ----------------------------------------------------------------------
@ -68,11 +70,6 @@ kmconvert: .virtual
cd $(DEVELOPER_ROOT)\src\test\auto\kmconvert
$(MAKE) $(TARGET)
lexical-model-compiler: .virtual
# TODO: move this to a test target in kmlmc
cd $(DEVELOPER_ROOT)\src\kmlmc
$(GIT_BASH_FOR_KEYMAN) build.sh -test
model-ts-parser: .virtual
rem TODO
# cd $(DEVELOPER_ROOT)\src\test\auto\model-ts-parser
@ -90,8 +87,20 @@ kmc: .virtual
cd $(DEVELOPER_ROOT)\src\kmc
$(MAKE) $(TARGET)
kmlmc: .virtual
cd $(DEVELOPER_ROOT)\src\kmlmc
kmc-keyboard: .virtual
cd $(DEVELOPER_ROOT)\src\kmc-keyboard
$(MAKE) $(TARGET)
kmc-model: .virtual
cd $(DEVELOPER_ROOT)\src\kmc-model
$(MAKE) $(TARGET)
kmc-model-info: .virtual
cd $(DEVELOPER_ROOT)\src\kmc-model-info
$(MAKE) $(TARGET)
kmc-package: .virtual
cd $(DEVELOPER_ROOT)\src\kmc-package
$(MAKE) $(TARGET)
# ----------------------------------------------------------------------

View file

@ -11,6 +11,9 @@ build: version.res manifest.res icons dirs xml xsd pull-core
$(TDS2DBG) $(WIN32_TARGET_PATH)\tike.exe
$(COPY) $(WIN32_TARGET_PATH)\tike.exe $(DEVELOPER_PROGRAM)
$(COPY) kmlmc.cmd $(DEVELOPER_PROGRAM)
$(COPY) kmlmi.cmd $(DEVELOPER_PROGRAM)
$(COPY) kmlmp.cmd $(DEVELOPER_PROGRAM)
$(COPY) kmc.cmd $(DEVELOPER_PROGRAM)
$(COPY) $(KEYMAN_ROOT)\core\build\x86\$(TARGET_PATH)\src\kmnkbp0-0.dll $(DEVELOPER_PROGRAM)
if exist $(WIN32_TARGET_PATH)\tike.dbg $(COPY) $(WIN32_TARGET_PATH)\tike.dbg $(DEVELOPER_DEBUGPATH)

View file

@ -8,10 +8,18 @@ Currently, we're using TeamCity for this.
Packages are **never** published from a developer's machine.
## List of current npm packages
## List of current published npm packages
* `@keymanapp/models-types` -- located at `common/models-types`
* `@keymanapp/lexical-model-compiler` -- located at `developer/src/kmlmc`
* `@keymanapp/models-types` -- located at `common/models/types`
* `@keymanapp/kmc` -- located at `developer/src/kmc`
* `@keymanapp/kmc-keyboard` -- located at `developer/src/kmc-keyboard`
* `@keymanapp/kmc-model` -- located at `developer/src/kmc-model`
* `@keymanapp/kmc-model-info` -- located at `developer/src/kmc-model-info`
* `@keymanapp/kmc-package` -- located at `developer/src/kmc-package`
### Deprecated npm packages
* `@keymanapp/lexical-model-compiler` -- replaced by `@keymanapp/kmc`
## For CI developers
@ -23,56 +31,68 @@ server.
This is typically done with:
```bash
./build.sh -test
./build.sh configure build test
```
Once the build succeeds and the tests pass, the version is set in
Once the build succeeds and the tests pass, you can publish! Use the following
script for this (**only on the CI server**!); during this, the version is set in
`package.json`:
```bash
./build.sh -version 12.0.${BUILD_NUMBER} -tier ${tier}
./build.sh publish
```
Now you can publish! Use the following script for this (again, **only on the CI server**!)
It is then uploaded to the npm package directory. **Ensure that the compiled
sources are included in the tarball**. For example:
```bash
./build.sh -publish-to-npm -tier ${tier}
```
It is then uploaded to the npm package directory. **Ensure that the
compiled sources are included in the tarball**. For example,
```bash
$ npm publish
npm notice 📦 @keymanapp/lexical-model-compiler@0.0.0
$ ./build.sh publish
npm notice
npm notice 📦 @keymanapp/kmc@16.0.61-alpha-local
npm notice === Tarball Contents ===
npm notice 12.4kB dist/lexical-model-compiler/build-trie.js
npm notice 1.2kB dist/kmlmc.js
npm notice 3.0kB dist/kmlmi.js
npm notice 1.4kB dist/kmlmp.js
npm notice 5.0kB dist/package-compiler/kmp-compiler.js
npm notice 55B dist/package-compiler/kmp-json-file.js
npm notice 552B dist/package-compiler/kps-file.js
npm notice 4.6kB dist/lexical-model-compiler/lexical-model-compiler.js
npm notice 315B dist/lexical-model-compiler/lexical-model.js
npm notice 158B dist/util/min-keyman-version.js
npm notice 4.5kB dist/model-info-compiler/model-info-compiler.js
npm notice 57B dist/lexical-model-compiler/model-info-file.js
npm notice 341B dist/lexical-model-compiler/stub.js
npm notice 115B dist/util/sysexits.js
npm notice 2.1kB dist/util/util.js
npm notice 1.4kB package.json
npm notice 1.0kB README.md
npm notice 841B Makefile
npm notice 2.8kB README.md
npm notice 2.5kB build.sh
npm notice 116B build/src/kmc.d.ts
npm notice 114B build/src/kmc.d.ts.map
npm notice 2.8kB build/src/kmc.js
npm notice 2.6kB build/src/kmc.js.map
npm notice 120B build/src/kmlmc.d.ts
npm notice 118B build/src/kmlmc.d.ts.map
npm notice 1.4kB build/src/kmlmc.js
npm notice 1.4kB build/src/kmlmc.js.map
npm notice 131B build/src/kmlmi.d.ts
npm notice 118B build/src/kmlmi.d.ts.map
npm notice 3.1kB build/src/kmlmi.js
npm notice 2.7kB build/src/kmlmi.js.map
npm notice 128B build/src/kmlmp.d.ts
npm notice 118B build/src/kmlmp.d.ts.map
npm notice 1.6kB build/src/kmlmp.js
npm notice 1.5kB build/src/kmlmp.js.map
npm notice 285B build/src/util/sysexits.d.ts
npm notice 186B build/src/util/sysexits.d.ts.map
npm notice 51B build/src/util/sysexits.js
npm notice 128B build/src/util/sysexits.js.map
npm notice 29.8kB build/tsconfig.tsbuildinfo
npm notice 5.4kB bundle.inc.sh
npm notice 1.7kB package.json
npm notice 2.8kB src/kmc.ts
npm notice 1.4kB src/kmlmc.ts
npm notice 3.2kB src/kmlmi.ts
npm notice 1.6kB src/kmlmp.ts
npm notice 237B src/util/sysexits.ts
npm notice 740B tsconfig.json
npm notice 449B tsconfig.kmc-base.json
```
For every release of **Keyman Developer**, the CI publishes a release of
`@keymanapp/lexical-model-compiler`. The version number is locked with
the particular version of Keyman Developer.
`@keymanapp/kmc`. The version number is locked with the particular version of
Keyman Developer.
### `set_npm_version`
This helper function sets the version in the `package.json` for the
given package, according to the VERSION_WITH_TAG variable.
This helper function sets the version in the `package.json` for the given
package, according to the VERSION_WITH_TAG variable.
```bash
. $KEYMAN_ROOT/resources/shellHelperFunctions.sh

4345
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -13,7 +13,10 @@
"resources/gosh",
"resources/build/version",
"core/include/ldml",
"developer/src/kmlmc",
"developer/src/kmc-keyboard",
"developer/src/kmc-model",
"developer/src/kmc-model-info",
"developer/src/kmc-package",
"developer/src/kmc",
"developer/src/server",
"common/models/*",
@ -23,6 +26,7 @@
"web"
],
"dependencies": {
"@keymanapp/hextobin": "file:common/tools/hextobin"
"@keymanapp/hextobin": "file:common/tools/hextobin",
"@keymanapp/keyman-version": "file:common/web/keyman-version"
}
}

View file

@ -752,7 +752,7 @@ builder_report() {
target="$3"
fi
if [ $result == success ]; then
if [[ $result == success ]]; then
echo "${COLOR_GREEN}## $action$target completed successfully${COLOR_RESET}"
else
echo "${COLOR_RED}## $action$target failed. Result: $result${COLOR_RESET}"

View file

@ -0,0 +1,28 @@
#!/usr/bin/env bash
function npm_publish() {
if [[ $TIER == stable ]]; then
npm_dist_tag=latest
else
npm_dist_tag=$TIER
fi
set_npm_version
if builder_has_option --dry-run; then
DRY_RUN=--dry-run
else
DRY_RUN=
fi
#TEMP: we don't want to publish at this point!
DRY_RUN=--dry-run
# Note: In either case, npm publish MUST be given --access public to publish
# a package in the @keymanapp scope on the public npm package index.
#
# See `npm help publish` for more details.
echo "Publishing $DRY_RUN npm package with tag $npm_dist_tag"
npm publish $DRY_RUN --access public --tag $npm_dist_tag || fail "Could not publish $npm_dist_tag release."
fi

View file

@ -8,25 +8,42 @@
{ "path": "./common/web/recorder/src/tsconfig.json" },
{ "path": "./common/web/sentry-manager/src/tsconfig.json" },
{ "path": "./common/web/utils/tsconfig.json" },
{ "path": "./common/models/templates/tsconfig.json" },
{ "path": "./common/models/types/tsconfig.json" },
{ "path": "./common/models/wordbreakers/tsconfig.json" },
{ "path": "./common/predictive-text/browser.tsconfig.json" },
{ "path": "./common/predictive-text/testing/one-stage-embedded-webworker/tsconfig.json" },
{ "path": "./common/predictive-text/testing/two-stage-embedded-webworker/tsconfig.json" },
{ "path": "./common/predictive-text/testing/two-stage-embedded-webworker/worker/tsconfig.json" },
{ "path": "./common/predictive-text/tsconfig.json" },
{ "path": "./developer/src/kmlmc/tests/tsconfig.json" },
{ "path": "./developer/src/kmlmc/tsconfig.json" },
//{ "path": "./developer/src/kmc/test/tsconfig.json" },
{ "path": "./developer/src/kmc/tsconfig.json" },
{ "path": "./developer/src/kmc-keyboard/test/tsconfig.json" },
{ "path": "./developer/src/kmc-keyboard/tsconfig.json" },
{ "path": "./developer/src/kmc-model/test/tsconfig.json" },
{ "path": "./developer/src/kmc-model/tsconfig.json" },
//{ "path": "./developer/src/kmc-model-info/test/tsconfig.json" },
{ "path": "./developer/src/kmc-model-info/tsconfig.json" },
{ "path": "./developer/src/kmc-package/test/tsconfig.json" },
{ "path": "./developer/src/kmc-package/tsconfig.json" },
{ "path": "./developer/src/server/tsconfig.json" },
{ "path": "./resources/build/version/tsconfig.json" },
{ "path": "./resources/build/version/tsconfig.production.json" },
{ "path": "./web/bulk_rendering/tsconfig.json" },
{ "path": "./web/source/tsconfig.json" },
{ "path": "./web/tools/recorder/tsconfig.json" },
{ "path": "./web/tools/sourcemap-root/tsconfig.json" },
{ "path": "./common/web/lm-message-types/" },
{ "path": "./common/web/lm-worker/" },
{ "path": "./common/web/keyman-version/" },
{ "path": "./common/web/keyman-version/tsconfig.esm.json" },
]
}