spiegel-keyman/developer/src/kmc
Marc Durdin d7f73f3078 chore: workaround npm/cli#3466 when bundling internal deps
Works around npm/cli#3466 when bundling internal dependencies using the
bundleDependencies package.json property.

This change works in tandem with the npm pack/publish process -- when we
run `developer/src/kmc/build.sh publish` (or `pack`), we end up with
`npm version` stomping on all our package.json files, so the repo is
dirty after this. We need a copy of the top-level package.json before
this stomping happens, in order to get a simple map of the location of
each of our internal dependencies, from the `dependencies` property (it
would be possible to figure this out with a lot more parsing of
our package.json files, but this is simpler).

This means, in future, we should avoid publishing our internal
dependencies such as those under common/ to npm, as they serve no
practical purpose there.
2023-09-01 20:30:43 +08:00
..
src chore: address review comments 2023-08-09 15:35:33 +07:00
test chore(developer): improve kmc sentry reporting on fatal build errors 2023-08-09 09:34:44 +07:00
.eslintrc.cjs chore(developer): sourcemap def in wrong file 2023-07-13 09:04:19 +07:00
build-bundler.js chore(developer): sourcemap def in wrong file 2023-07-13 09:04:19 +07:00
build.sh chore: workaround npm/cli#3466 when bundling internal deps 2023-09-01 20:30:43 +08:00
Makefile chore: rename kmc-keyboard to kmc-ldml 2023-05-09 14:08:45 +07:00
package.json feat(developer): introduce kmc-keyboard-info 2023-07-24 10:41:12 +07:00
README.md feat(developer): kmc build command 2023-02-24 13:54:27 +07:00
tsconfig.json feat(developer): introduce kmc-keyboard-info 2023-07-24 10:41:12 +07:00
tsconfig.kmc-base.json refactor(developer): split file type management into package 2022-09-27 12:33:10 +10:00

Keyman Developer - Next Generation Compiler

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.

Note: kmc will in the future replace kmlmc, kmlmp, and kmlmi.

In order to build lexical models, these tools must be built and compiled.

Install

Install kmc globally:

npm install -g @keymanapp/kmc

kmc Usage

To compile an LDML keyboard from its .xml source, use kmc:

kmc build my-keyboard.xml --outFile my-keyboard.kmx

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

Run build.sh:

./build.sh configure build

or (less preferably -- build.sh is more efficient):

nmake configure build

Once you have configured 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

./build.sh test

How to prepare bundling for installation

./build.sh bundle --build-path <temp_path>

The temp_path must be a path outside the repository to avoid npm getting confused by the root package.json. This is called by inst/download.in.mak normally when building the Keyman Developer installer.

How to publish to NPM

./build.sh publish [--dry-run]

Publishes the current release to NPM. This should only be run from CI.