change(developer): remove kmlmc and kmlmp

These were replaced by kmc in v17.0. We kept them as legacy alternatives
in v18.0, but it is time to remove them now to reduce the maintenance of
having multiple entry points to kmc.

Fixes: #13181
Test-bot: skip
This commit is contained in:
Marc Durdin 2025-10-31 17:08:56 +01:00
parent 702a64c281
commit 933ea5bb58
17 changed files with 6 additions and 236 deletions

View file

@ -42,12 +42,6 @@ title: Context Help
[kmc Command-line Options](kmc)
[kmlmc Command-line Options](kmlmc)
[kmlmi Command-line Options](kmlmi)
[kmlmp Command-line Options](kmlmp)
[Character Map](character-map)
[Message Window](messages)

View file

@ -1,5 +0,0 @@
---
title: kmlmc - Command Line Lexical Model Compiler (deprecated)
---
kmlmc has been replaced by [kmc](../reference/kmc).

View file

@ -1,5 +0,0 @@
---
title: kmlmi - Command Line Lexical Model model_info Compiler (deprecated)
---
kmlmi has been replaced by [kmc](../reference/kmc).

View file

@ -1,5 +0,0 @@
---
title: kmlmp - Command Line Lexical Model Package Compiler (deprecated)
---
kmlmp has been replaced by [kmc](../reference/kmc).

View file

@ -5,9 +5,8 @@ title: Migrating from kmcomp to kmc
`kmcomp` was the command-line compiler for Keyman Developer through version
16.0. Version 17.0 replaces `kmcomp` with `kmc`.
The lexical model command-line tooling, `kmlmc`, `kmlmp`, and `kmlmi`, are all
still present in version 17, but are deprecated, as the same tasks can be
performed with `kmc`.
The lexical model command-line tooling, `kmlmc`, `kmlmp`, and `kmlmi`, have
been removed in version 19.0; instead use `kmc`.
## Benefits
@ -99,21 +98,6 @@ kmcomp | kmc | notes
## Compiling a lexical model
`kmlmc` and `kmlmp` were separate tools in earlier versions of Keyman Developer,
for compiling lexical models and lexical model packages. They have both been
replaced with `kmc`.
Old method, using kmlmc and kmlmp:
```bash
kmlmc file.model.ts
# or specifying output filename
kmlmc -o output/path/file.model.js file.model.ts
kmlmp file.model.kps
```
New method, using kmc:
```bash
# recommended, build the model project:
kmc build .

View file

@ -84,7 +84,7 @@ in Keyman for Windows.
## kmc
node-based next generation compiler, hosts kmc, (and legacy kmlmc, kmlmp)
node-based next generation compiler, hosts kmc
### kmc-analyze - Analysis tools

View file

@ -262,14 +262,6 @@
<File Name='README.md' Source="node\dist\README.md" />
</Component>
<Component Directory="INSTALLDIR">
<File Name='kmlmc.cmd' KeyPath="yes" Source="node\kmlmc.cmd" />
</Component>
<Component Directory="INSTALLDIR">
<File Name='kmlmp.cmd' KeyPath="yes" Source="node\kmlmp.cmd" />
</Component>
<Component Directory="INSTALLDIR">
<File Name='kmc.cmd' KeyPath="yes" Source="node\kmc.cmd" />
</Component>

View file

@ -1,4 +0,0 @@
@rem This script avoids path dependencies for node for distribution
@rem with Keyman Developer. When used on platforms other than Windows,
@rem node can be used directly with the compiler (`npm link` will setup).
@"%~dp0\node.js\node.exe" "%~dp0\kmc\kmlmc.mjs" %*

View file

@ -1,4 +0,0 @@
@rem This script avoids path dependencies for node for distribution
@rem with Keyman Developer. When used on platforms other than Windows,
@rem node can be used directly with the compiler (`npm link` will setup).
@"%~dp0\node.js\node.exe" "%~dp0\kmc\kmlmp.mjs" %*

View file

@ -7,8 +7,6 @@ import esbuild from 'esbuild';
await esbuild.build({
entryPoints: [
'build/src/kmc.js',
'build/src/kmlmc.js',
'build/src/kmlmp.js',
],
bundle: true,
format: 'esm',

View file

@ -11,10 +11,8 @@
],
"scripts": {
"build": "tsc -b",
"bundle": "npm run bundle-kmc && npm run bundle-kmlmc && npm run bundle-kmlmp",
"bundle": "npm run bundle-kmc",
"bundle-kmc": "esbuild build/src/kmc.js --bundle --platform=node --target=es2022 > build/cjs-src/kmc.cjs",
"bundle-kmlmc": "esbuild build/src/kmlmc.js --bundle --platform=node --target=es2022 > build/cjs-src/kmlmc.cjs",
"bundle-kmlmp": "esbuild build/src/kmlmp.js --bundle --platform=node --target=es2022 > build/cjs-src/kmlmp.cjs",
"test": "eslint . && cd test && tsc -b && cd .. && mocha"
},
"type": "module",
@ -29,9 +27,7 @@
},
"main": "build/src/kmc.js",
"bin": {
"kmc": "build/src/kmc.js",
"kmlmc": "build/src/kmlmc.js",
"kmlmp": "build/src/kmlmp.js"
"kmc": "build/src/kmc.js"
},
"dependencies": {
"@keymanapp/common-types": "*",

View file

@ -1,67 +0,0 @@
#!/usr/bin/env node
/**
* kmlmc - Keyman Lexical Model Compiler
*/
import { Command } from 'commander';
import { LexicalModelCompiler } from '@keymanapp/kmc-model';
import { SysExits } from './util/sysexits.js';
import KEYMAN_VERSION from "@keymanapp/keyman-version";
import { NodeCompilerCallbacks } from './util/NodeCompilerCallbacks.js';
let inputFilename: string;
const program = new Command();
/* Arguments */
program
.description('Compiles Keyman lexical models')
.version(KEYMAN_VERSION.VERSION_WITH_TAG)
.arguments('<infile>')
.action(infile => inputFilename = infile)
.option('-o, --outFile <filename>', 'where to save the resultant file');
program.parse(process.argv);
// Deal with input arguments:
if (!inputFilename) {
exitDueToUsageError('Must provide a lexical model source file.');
}
const callbacks = new NodeCompilerCallbacks({logLevel: 'info'});
const compiler = new LexicalModelCompiler();
if(!await compiler.init(callbacks, null)) {
console.error('Initialization failed.');
process.exit(SysExits.EX_DATAERR);
}
let code = null;
// Compile:
try {
code = await compiler.run(inputFilename, program.opts().outFile);
} catch(e) {
console.error(e);
process.exit(SysExits.EX_DATAERR);
}
if(!code) {
console.error('Compilation failed.')
process.exit(SysExits.EX_DATAERR);
}
// Output:
if (program.opts().outFile) {
compiler.write(code.artifacts);
} else {
// TODO(lowpri): if writing to console then log messages should all be to stderr?
const decoder = new TextDecoder();
const text = decoder.decode(code.artifacts.js.data);
console.log(text);
}
function exitDueToUsageError(message: string): never {
console.error(`${program.name()}: ${message}`);
console.error();
program.outputHelp();
return process.exit(SysExits.EX_USAGE);
}

View file

@ -1,60 +0,0 @@
#!/usr/bin/env node
/**
* kmlmp - Keyman Lexical Model Package Compiler
*/
// Note: this is a deprecated package and will be removed in Keyman 19.0
import { Command } from 'commander';
import { KmpCompiler } from '@keymanapp/kmc-package';
import { SysExits } from './util/sysexits.js';
import KEYMAN_VERSION from "@keymanapp/keyman-version";
import { NodeCompilerCallbacks } from './util/NodeCompilerCallbacks.js';
let inputFilename: string;
const program = new Command();
/* Arguments */
program
.description('Compiles Keyman lexical model packages\nDeprecated: use <kmc build> instead; will be removed in v18')
.version(KEYMAN_VERSION.VERSION_WITH_TAG)
.arguments('<infile>')
.action(infile => inputFilename = infile)
.option('-o, --outFile <filename>', 'where to save the resultant file');
program.parse(process.argv);
// Deal with input arguments:
if (!inputFilename) {
exitDueToUsageError('Must provide a lexical model package source file.');
}
const outputFilename: string = program.opts().outFile ? program.opts().outFile : inputFilename.replace(/\.kps$/, ".kmp");
//
// Run the compiler
//
const callbacks = new NodeCompilerCallbacks({logLevel: 'info'});
const kmpCompiler = new KmpCompiler();
if(!await kmpCompiler.init(callbacks, null)) {
process.exit(1);
}
const result = await kmpCompiler.run(inputFilename, outputFilename);
if(!result) {
process.exit(1);
}
if(!await kmpCompiler.write(result.artifacts)) {
console.error('Failed to write kmp file');
process.exit(1);
}
function exitDueToUsageError(message: string): never {
console.error(`${program.name()}: ${message}`);
console.error();
program.outputHelp();
return process.exit(SysExits.EX_USAGE);
}

View file

@ -72,8 +72,6 @@ function do_build() {
tds2dbg "$WIN32_TARGET"
cp "$WIN32_TARGET" "$DEVELOPER_PROGRAM"
cp kmlmc.cmd "$DEVELOPER_PROGRAM"
cp kmlmp.cmd "$DEVELOPER_PROGRAM"
cp kmc.cmd "$DEVELOPER_PROGRAM"
cp "$KEYMAN_ROOT/core/build/x86/$TARGET_PATH/src/$KEYMANCORE_DLL" "$DEVELOPER_PROGRAM"
builder_if_release_build_level cp "$WIN32_TARGET_PATH/tike.dbg" "$DEVELOPER_DEBUGPATH"

View file

@ -1,20 +0,0 @@
@echo off
setlocal
rem This script is based on /developer/src/node/inst/kmlmc.cmd. It is stored here
rem in order to allow TIKE to call out to the compiler while debugging.
if exist "%~dp0..\inst\node\dist\node.exe" (
rem If running in developer/src/tike/:
set nodeexe="%~dp0..\inst\node\dist\node.exe"
set nodecli="%~dp0..\kmc\build\src\kmlmc.js"
) else if exist "%~dp0..\src\inst\node\dist\node.exe" (
rem If running in developer/bin/:
set nodeexe="%~dp0..\src\inst\node\dist\node.exe"
set nodecli="%~dp0..\src\kmc\build\src\kmlmc.js"
) else (
rem Cannot find node or kmlmc.js relative to execution path
echo Error: node.exe or kmlmc.js not found.
exit /b 1
)
%nodeexe% --enable-source-maps %nodecli% %*
exit /b %errorlevel%

View file

@ -1,20 +0,0 @@
@echo off
setlocal
rem This script is based on /developer/src/node/inst/kmlmp.cmd. It is stored here
rem in order to allow TIKE to call out to the compiler while debugging.
if exist "%~dp0..\inst\node\dist\node.exe" (
rem If running in developer/src/tike/:
set nodeexe="%~dp0..\inst\node\dist\node.exe"
set nodecli="%~dp0..\kmc\build\src\kmlmp.js"
) else if exist "%~dp0..\src\inst\node\dist\node.exe" (
rem If running in developer/bin/:
set nodeexe="%~dp0..\src\inst\node\dist\node.exe"
set nodecli="%~dp0..\src\kmc\build\src\kmlmp.js"
) else (
rem Cannot find node or kmlmp.js relative to execution path
echo Error: node.exe or kmlmp.js not found.
exit /b 1
)
%nodeexe% --enable-source-maps %nodecli% %*
exit /b %errorlevel%

4
package-lock.json generated
View file

@ -281,9 +281,7 @@
"supports-color": "^9.4.0"
},
"bin": {
"kmc": "build/src/kmc.js",
"kmlmc": "build/src/kmlmc.js",
"kmlmp": "build/src/kmlmp.js"
"kmc": "build/src/kmc.js"
},
"devDependencies": {
"@sentry/cli": "^2.31.0",