mirror of
https://github.com/keymanapp/keyman.git
synced 2026-10-17 03:17:33 +00:00
Merge pull request #16420 from keymanapp/feat/developer/16407/kmc-convert-follow-up-1
feat(developer): kmc convert follow-up tasks
This commit is contained in:
commit
e18a76f289
5 changed files with 28 additions and 31 deletions
|
|
@ -4,6 +4,7 @@
|
|||
* Output artifacts available from kmc-convert
|
||||
*/
|
||||
import { KeymanCompilerArtifactOptional, KeymanCompilerArtifacts } from '@keymanapp/developer-utils';
|
||||
import { KeymanCompilerResult } from "@keymanapp/developer-utils";
|
||||
|
||||
export interface ConverterArtifacts extends KeymanCompilerArtifacts { }
|
||||
|
||||
|
|
@ -25,3 +26,20 @@ export interface ConverterToKmnArtifacts extends ConverterArtifacts {
|
|||
*/
|
||||
keymanTouchLayout?: KeymanCompilerArtifactOptional;
|
||||
};
|
||||
|
||||
|
||||
export interface ConverterResult extends KeymanCompilerResult {
|
||||
/**
|
||||
* Internal in-memory build artifacts from a successful compilation. Caller
|
||||
* can write these to disk with {@link Converter.write}
|
||||
*/
|
||||
artifacts: ConverterArtifacts;
|
||||
};
|
||||
|
||||
export interface ConverterToKmnResult extends ConverterResult {
|
||||
/**
|
||||
* Internal in-memory build artifacts from a successful compilation to kmn.
|
||||
* Caller can write these to disk with {@link Converter.write}
|
||||
*/
|
||||
artifacts: ConverterToKmnArtifacts;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,21 +7,12 @@ import {
|
|||
CompilerCallbacks,
|
||||
CompilerOptions,
|
||||
defaultCompilerOptions,
|
||||
KeymanCompiler,
|
||||
KeymanCompilerResult,
|
||||
KeymanCompiler
|
||||
} from "@keymanapp/developer-utils";
|
||||
import { ConverterClassFactory } from './converter-class-factory.js';
|
||||
import { ConverterArtifacts } from "./converter-artifacts.js";
|
||||
import { ConverterArtifacts, ConverterResult } from "./main.js";
|
||||
import { ConverterMessages } from "./converter-messages.js";
|
||||
|
||||
export interface ConverterResult extends KeymanCompilerResult {
|
||||
/**
|
||||
* Internal in-memory build artifacts from a successful compilation. Caller
|
||||
* can write these to disk with {@link Converter.write}
|
||||
*/
|
||||
artifacts: ConverterArtifacts;
|
||||
};
|
||||
|
||||
/**
|
||||
* @public
|
||||
* Converts keyboards between different source file formats. The
|
||||
|
|
|
|||
|
|
@ -8,27 +8,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import { CompilerCallbacks, CompilerOptions, KeymanCompilerResult, Keylayout } from "@keymanapp/developer-utils";
|
||||
import { CompilerCallbacks, CompilerOptions, Keylayout } from "@keymanapp/developer-utils";
|
||||
import { KmnFileWriter } from './kmn-file-writer.js';
|
||||
import { KeylayoutFileReader } from './keylayout-file-reader.js';
|
||||
import { ConverterMessages } from '../converter-messages.js';
|
||||
import { ConverterArtifacts, ConverterToKmnArtifacts } from "../converter-artifacts.js";
|
||||
|
||||
export interface ConverterResult extends KeymanCompilerResult {
|
||||
/**
|
||||
* Internal in-memory build artifacts from a successful compilation. Caller
|
||||
* can write these to disk with {@link Converter.write}
|
||||
*/
|
||||
artifacts: ConverterArtifacts;
|
||||
};
|
||||
|
||||
interface ConverterToKmnResult extends ConverterResult {
|
||||
/**
|
||||
* Internal in-memory build artifacts from a successful compilation. Caller
|
||||
* can write these to disk with {@link Converter.write}
|
||||
*/
|
||||
artifacts: ConverterToKmnArtifacts;
|
||||
};
|
||||
import { ConverterToKmnResult } from "../main.js";
|
||||
|
||||
/**
|
||||
* Interface for all data read from a .keylayout file. Also contains all rules processed from input data.
|
||||
|
|
|
|||
|
|
@ -7,3 +7,4 @@
|
|||
export { Converter } from './converter.js';
|
||||
export { ConverterOptions } from './converter-options.js';
|
||||
export { ConverterMessages } from './converter-messages.js';
|
||||
export { ConverterArtifacts, ConverterToKmnArtifacts, ConverterResult, ConverterToKmnResult } from './converter-artifacts.js';
|
||||
|
|
|
|||
|
|
@ -17,9 +17,12 @@ export function declareConvert(program: Command) {
|
|||
BaseOptions.addLogLevel(command);
|
||||
BaseOptions.addLogFormat(command);
|
||||
command
|
||||
.description('Convert keyboard source files between formats')
|
||||
// TODO kmc-convert: add more conversions later, then alter text here
|
||||
//.description('Convert keyboard source files between formats:')
|
||||
.description('Convert keyboard source files from keylayout -> .kmn:')
|
||||
.option('-p, --out-path <path>', 'Path for output files')
|
||||
.requiredOption('-t, --out-type <type>', 'File extension for output files, e.g. .kmn, required')
|
||||
// TODO kmc-convert: add more conversions later, then File extension for output files is required
|
||||
// .requiredOption('-t, --out-type <type>', 'File extension for output files, e.g. .kmn, required')
|
||||
.action(async (filenames: string[], _options: any, commander: any): Promise<never|void> => {
|
||||
const options = commander.optsWithGlobals();
|
||||
const callbacks = new NodeCompilerCallbacks({logLevel: options.logLevel});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue