@keymanapp/kmc 17.0.293-beta → 17.0.294-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/build/src/commands/analyze.js +106 -108
  2. package/build/src/commands/analyze.js.map +1 -1
  3. package/build/src/commands/build.js +166 -168
  4. package/build/src/commands/build.js.map +1 -1
  5. package/build/src/commands/buildClasses/BuildActivity.js +31 -33
  6. package/build/src/commands/buildClasses/BuildActivity.js.map +1 -1
  7. package/build/src/commands/buildClasses/BuildKeyboardInfo.js +47 -49
  8. package/build/src/commands/buildClasses/BuildKeyboardInfo.js.map +1 -1
  9. package/build/src/commands/buildClasses/BuildKmnKeyboard.js +35 -37
  10. package/build/src/commands/buildClasses/BuildKmnKeyboard.js.map +1 -1
  11. package/build/src/commands/buildClasses/BuildLdmlKeyboard.js +19 -21
  12. package/build/src/commands/buildClasses/BuildLdmlKeyboard.js.map +1 -1
  13. package/build/src/commands/buildClasses/BuildModel.js +13 -15
  14. package/build/src/commands/buildClasses/BuildModel.js.map +1 -1
  15. package/build/src/commands/buildClasses/BuildModelInfo.js +73 -75
  16. package/build/src/commands/buildClasses/BuildModelInfo.js.map +1 -1
  17. package/build/src/commands/buildClasses/BuildPackage.js +13 -15
  18. package/build/src/commands/buildClasses/BuildPackage.js.map +1 -1
  19. package/build/src/commands/buildClasses/BuildProject.js +116 -118
  20. package/build/src/commands/buildClasses/BuildProject.js.map +1 -1
  21. package/build/src/commands/buildClasses/buildActivities.js +21 -23
  22. package/build/src/commands/buildClasses/buildActivities.js.map +1 -1
  23. package/build/src/commands/buildTestData/index.js +39 -41
  24. package/build/src/commands/buildTestData/index.js.map +1 -1
  25. package/build/src/commands/buildWindowsPackageInstaller/index.js +43 -45
  26. package/build/src/commands/buildWindowsPackageInstaller/index.js.map +1 -1
  27. package/build/src/commands/messageCommand.js +237 -239
  28. package/build/src/commands/messageCommand.js.map +1 -1
  29. package/build/src/kmc.js +57 -58
  30. package/build/src/kmc.js.map +1 -1
  31. package/build/src/kmlmc.js +57 -59
  32. package/build/src/kmlmc.js.map +1 -1
  33. package/build/src/kmlmp.js +46 -48
  34. package/build/src/kmlmp.js.map +1 -1
  35. package/build/src/messages/infrastructureMessages.js +75 -77
  36. package/build/src/messages/infrastructureMessages.js.map +1 -1
  37. package/build/src/messages/messageNamespaces.js +39 -41
  38. package/build/src/messages/messageNamespaces.js.map +1 -1
  39. package/build/src/util/NodeCompilerCallbacks.js +221 -223
  40. package/build/src/util/NodeCompilerCallbacks.js.map +1 -1
  41. package/build/src/util/TestKeymanSentry.d.ts +3 -2
  42. package/build/src/util/TestKeymanSentry.d.ts.map +1 -1
  43. package/build/src/util/TestKeymanSentry.js +51 -53
  44. package/build/src/util/TestKeymanSentry.js.map +1 -1
  45. package/build/src/util/baseOptions.js +24 -26
  46. package/build/src/util/baseOptions.js.map +1 -1
  47. package/build/src/util/calculateSourcePath.js +18 -20
  48. package/build/src/util/calculateSourcePath.js.map +1 -1
  49. package/build/src/util/extendedCompilerOptions.js +123 -125
  50. package/build/src/util/extendedCompilerOptions.js.map +1 -1
  51. package/build/src/util/fileLists.js +46 -48
  52. package/build/src/util/fileLists.js.map +1 -1
  53. package/build/src/util/getDeveloperBinPath.js +36 -38
  54. package/build/src/util/getDeveloperBinPath.js.map +1 -1
  55. package/build/src/util/getLastGitCommitDate.js +44 -46
  56. package/build/src/util/getLastGitCommitDate.js.map +1 -1
  57. package/build/src/util/kmcSentryOptions.d.ts +8 -0
  58. package/build/src/util/kmcSentryOptions.d.ts.map +1 -0
  59. package/build/src/util/kmcSentryOptions.js +20 -0
  60. package/build/src/util/kmcSentryOptions.js.map +1 -0
  61. package/build/src/util/projectLoader.js +51 -53
  62. package/build/src/util/projectLoader.js.map +1 -1
  63. package/build/src/util/projectRunner.js +27 -29
  64. package/build/src/util/projectRunner.js.map +1 -1
  65. package/build/src/util/sysexits.js +7 -9
  66. package/build/src/util/sysexits.js.map +1 -1
  67. package/package.json +12 -12
@@ -1,108 +1,106 @@
1
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="078e8c9d-263b-500d-84d0-b15f0385ab21")}catch(e){}}();
2
- import * as fs from 'fs';
3
- import * as path from 'path';
4
- import { Option } from 'commander';
5
- import { NodeCompilerCallbacks } from '../util/NodeCompilerCallbacks.js';
6
- import { InfrastructureMessages } from '../messages/infrastructureMessages.js';
7
- import { AnalyzeOskCharacterUse, AnalyzeOskRewritePua } from '@keymanapp/kmc-analyze';
8
- import { BaseOptions } from '../util/baseOptions.js';
9
- import { runOnFiles } from '../util/projectRunner.js';
10
- import { exitProcess } from '../util/sysexits.js';
11
- ;
12
- export function declareAnalyze(program) {
13
- let command = program.command('analyze');
14
- declareOskCharUse(command);
15
- declareOskRewrite(command);
16
- }
17
- function declareOskCharUse(command) {
18
- let subCommand = command.command('osk-char-use [infile...]');
19
- BaseOptions.addLogLevel(subCommand);
20
- subCommand
21
- .description('Analyze On Screen Keyboards for character usage')
22
- .option('-b, --base', 'First PUA codepoint to use, in hexadecimal (default F100)', 'F100')
23
- .option('--include-counts', 'Include number of times each character is referenced', false)
24
- .option('--strip-dotted-circle', 'Strip U+25CC (dotted circle base) from results', false)
25
- .addOption(new Option('-m, --mapping-file <filename>', 'Result file to write to (.json, .md, or .txt)').makeOptionMandatory())
26
- .action(async (filenames, _options, commander) => {
27
- const options = commander.optsWithGlobals();
28
- if (!filenames.length) {
29
- // If there are no filenames provided, then we are building the current
30
- // folder ('.') as a project-style build
31
- filenames.push('.');
32
- }
33
- if (!await analyze(analyzeOskCharUse, filenames, options)) {
34
- // Once a file fails to build, we bail on subsequent builds
35
- return await exitProcess(1);
36
- }
37
- });
38
- }
39
- function declareOskRewrite(command) {
40
- let subCommand = command.command('osk-rewrite-from-char-use [infile...]');
41
- subCommand
42
- .description('Rewrite On Screen Keyboard files from source mapping; given file.ext, output is written to file-pua.ext')
43
- .addOption(new Option('-m, --mapping-file <filename>', 'JSON mapping file to read from').makeOptionMandatory())
44
- .action(async (filenames, options) => {
45
- if (!filenames.length) {
46
- // If there are no filenames provided, then we are building the current
47
- // folder ('.') as a project-style build
48
- filenames.push('.');
49
- }
50
- if (!await analyze(analyzeOskRewritePua, filenames, options)) {
51
- // Once a file fails to build, we bail on subsequent builds
52
- return await exitProcess(1);
53
- }
54
- return null;
55
- });
56
- }
57
- async function analyze(action, filenames, options) {
58
- let callbacks = new NodeCompilerCallbacks({ logLevel: options.logLevel });
59
- try {
60
- return await action(callbacks, filenames, options);
61
- }
62
- catch (e) {
63
- callbacks.reportMessage(InfrastructureMessages.Fatal_UnexpectedException({ e }));
64
- return false;
65
- }
66
- }
67
- async function analyzeOskCharUse(callbacks, filenames, options) {
68
- const format = path.extname(options.mappingFile);
69
- if (format != '.txt' && format != '.json' && format != '.md') {
70
- callbacks.reportMessage(InfrastructureMessages.Error_UnknownFileFormat({ format }));
71
- return false;
72
- }
73
- const analyzer = new AnalyzeOskCharacterUse(callbacks, {
74
- puaBase: parseInt(options.base, 16),
75
- stripDottedCircle: options.stripDottedCircle,
76
- includeCounts: options.includeCounts,
77
- });
78
- if (!await runOnFiles(callbacks, filenames, analyzer.analyze.bind(analyzer))) {
79
- return false;
80
- }
81
- const output = analyzer.getStrings(format).join('\n');
82
- fs.writeFileSync(options.mappingFile, output, 'utf8');
83
- return true;
84
- }
85
- async function analyzeOskRewritePua(callbacks, filenames, options) {
86
- const analyzer = new AnalyzeOskRewritePua(callbacks);
87
- const mapping = JSON.parse(fs.readFileSync(options.mappingFile, 'utf-8'));
88
- return await runOnFiles(callbacks, filenames, async (filename) => {
89
- if (!await analyzer.analyze(filename, mapping)) {
90
- return false;
91
- }
92
- const mappedFilenames = Object.keys(analyzer.data);
93
- for (let filename of mappedFilenames) {
94
- const ext = path.extname(filename);
95
- const outputFilename = filename.substring(0, filename.length - ext.length) + '-pua' + ext;
96
- fs.writeFileSync(outputFilename, analyzer.data[filename]);
97
- }
98
- return true;
99
- });
100
- }
101
- /**
102
- * these are exported only for unit tests, do not use
103
- */
104
- export const analyzeUnitTestEndpoints = {
105
- analyzeOskCharUse
106
- };
107
- //# debugId=078e8c9d-263b-500d-84d0-b15f0385ab21
108
- //# sourceMappingURL=analyze.js.map
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { Option } from 'commander';
4
+ import { NodeCompilerCallbacks } from '../util/NodeCompilerCallbacks.js';
5
+ import { InfrastructureMessages } from '../messages/infrastructureMessages.js';
6
+ import { AnalyzeOskCharacterUse, AnalyzeOskRewritePua } from '@keymanapp/kmc-analyze';
7
+ import { BaseOptions } from '../util/baseOptions.js';
8
+ import { runOnFiles } from '../util/projectRunner.js';
9
+ import { exitProcess } from '../util/sysexits.js';
10
+ ;
11
+ export function declareAnalyze(program) {
12
+ let command = program.command('analyze');
13
+ declareOskCharUse(command);
14
+ declareOskRewrite(command);
15
+ }
16
+ function declareOskCharUse(command) {
17
+ let subCommand = command.command('osk-char-use [infile...]');
18
+ BaseOptions.addLogLevel(subCommand);
19
+ subCommand
20
+ .description('Analyze On Screen Keyboards for character usage')
21
+ .option('-b, --base', 'First PUA codepoint to use, in hexadecimal (default F100)', 'F100')
22
+ .option('--include-counts', 'Include number of times each character is referenced', false)
23
+ .option('--strip-dotted-circle', 'Strip U+25CC (dotted circle base) from results', false)
24
+ .addOption(new Option('-m, --mapping-file <filename>', 'Result file to write to (.json, .md, or .txt)').makeOptionMandatory())
25
+ .action(async (filenames, _options, commander) => {
26
+ const options = commander.optsWithGlobals();
27
+ if (!filenames.length) {
28
+ // If there are no filenames provided, then we are building the current
29
+ // folder ('.') as a project-style build
30
+ filenames.push('.');
31
+ }
32
+ if (!await analyze(analyzeOskCharUse, filenames, options)) {
33
+ // Once a file fails to build, we bail on subsequent builds
34
+ return await exitProcess(1);
35
+ }
36
+ });
37
+ }
38
+ function declareOskRewrite(command) {
39
+ let subCommand = command.command('osk-rewrite-from-char-use [infile...]');
40
+ subCommand
41
+ .description('Rewrite On Screen Keyboard files from source mapping; given file.ext, output is written to file-pua.ext')
42
+ .addOption(new Option('-m, --mapping-file <filename>', 'JSON mapping file to read from').makeOptionMandatory())
43
+ .action(async (filenames, options) => {
44
+ if (!filenames.length) {
45
+ // If there are no filenames provided, then we are building the current
46
+ // folder ('.') as a project-style build
47
+ filenames.push('.');
48
+ }
49
+ if (!await analyze(analyzeOskRewritePua, filenames, options)) {
50
+ // Once a file fails to build, we bail on subsequent builds
51
+ return await exitProcess(1);
52
+ }
53
+ return null;
54
+ });
55
+ }
56
+ async function analyze(action, filenames, options) {
57
+ let callbacks = new NodeCompilerCallbacks({ logLevel: options.logLevel });
58
+ try {
59
+ return await action(callbacks, filenames, options);
60
+ }
61
+ catch (e) {
62
+ callbacks.reportMessage(InfrastructureMessages.Fatal_UnexpectedException({ e }));
63
+ return false;
64
+ }
65
+ }
66
+ async function analyzeOskCharUse(callbacks, filenames, options) {
67
+ const format = path.extname(options.mappingFile);
68
+ if (format != '.txt' && format != '.json' && format != '.md') {
69
+ callbacks.reportMessage(InfrastructureMessages.Error_UnknownFileFormat({ format }));
70
+ return false;
71
+ }
72
+ const analyzer = new AnalyzeOskCharacterUse(callbacks, {
73
+ puaBase: parseInt(options.base, 16),
74
+ stripDottedCircle: options.stripDottedCircle,
75
+ includeCounts: options.includeCounts,
76
+ });
77
+ if (!await runOnFiles(callbacks, filenames, analyzer.analyze.bind(analyzer))) {
78
+ return false;
79
+ }
80
+ const output = analyzer.getStrings(format).join('\n');
81
+ fs.writeFileSync(options.mappingFile, output, 'utf8');
82
+ return true;
83
+ }
84
+ async function analyzeOskRewritePua(callbacks, filenames, options) {
85
+ const analyzer = new AnalyzeOskRewritePua(callbacks);
86
+ const mapping = JSON.parse(fs.readFileSync(options.mappingFile, 'utf-8'));
87
+ return await runOnFiles(callbacks, filenames, async (filename) => {
88
+ if (!await analyzer.analyze(filename, mapping)) {
89
+ return false;
90
+ }
91
+ const mappedFilenames = Object.keys(analyzer.data);
92
+ for (let filename of mappedFilenames) {
93
+ const ext = path.extname(filename);
94
+ const outputFilename = filename.substring(0, filename.length - ext.length) + '-pua' + ext;
95
+ fs.writeFileSync(outputFilename, analyzer.data[filename]);
96
+ }
97
+ return true;
98
+ });
99
+ }
100
+ /**
101
+ * these are exported only for unit tests, do not use
102
+ */
103
+ export const analyzeUnitTestEndpoints = {
104
+ analyzeOskCharUse
105
+ };
106
+ //# sourceMappingURL=analyze.js.map
@@ -1 +1 @@
1
- {"debug_id":"078e8c9d-263b-500d-84d0-b15f0385ab21","file":"analyze.js","mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAW,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAYjD,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC3B,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,iBAAiB,CAAC,OAAgB;IACzC,IAAI,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC7D,WAAW,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC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,CAAC,MAAM,wBAAwB,GAAG;IACtC,iBAAiB;CAClB,CAAC","names":[],"sourceRoot":"","sources":["../../../src/commands/analyze.ts"],"version":3}
1
+ {"version":3,"file":"analyze.js","sourceRoot":"","sources":["../../../src/commands/analyze.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAW,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAYjD,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC3B,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,iBAAiB,CAAC,OAAgB;IACzC,IAAI,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC7D,WAAW,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IACpC,UAAU;SACP,WAAW,CAAC,iDAAiD,CAAC;SAC9D,MAAM,CAAC,YAAY,EAAE,2DAA2D,EAAE,MAAM,CAAC;SACzF,MAAM,CAAC,kBAAkB,EAAE,sDAAsD,EAAE,KAAK,CAAC;SACzF,MAAM,CAAC,uBAAuB,EAAE,gDAAgD,EAAE,KAAK,CAAC;SACxF,SAAS,CAAC,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;IACtD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,KAAK,UAAU,oBAAoB,CAAC,SAA4B,EAAE,SAAmB,EAAE,OAAgC;IACrH,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC,SAAS,CAAC,CAAC;IACrD,MAAM,OAAO,GAAQ,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IAE/E,OAAO,MAAM,UAAU,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,QAAgB,EAAoB,EAAE;QACzF,IAAG,CAAC,MAAM,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;YAC7C,OAAO,KAAK,CAAC;SACd;QACD,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnD,KAAI,IAAI,QAAQ,IAAI,eAAe,EAAE;YACnC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACnC,MAAM,cAAc,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,GAAG,CAAC;YAC1F,EAAE,CAAC,aAAa,CAAC,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;SAC3D;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,iBAAiB;CAClB,CAAC"}
@@ -1,168 +1,166 @@
1
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ab2a34a4-83b9-5736-a47d-69510e091fd9")}catch(e){}}();
2
- import * as fs from 'fs';
3
- import * as path from 'path';
4
- import { buildActivities } from './buildClasses/buildActivities.js';
5
- import { BuildProject } from './buildClasses/BuildProject.js';
6
- import { NodeCompilerCallbacks } from '../util/NodeCompilerCallbacks.js';
7
- import { InfrastructureMessages } from '../messages/infrastructureMessages.js';
8
- import { CompilerFileCallbacks } from '@keymanapp/common-types';
9
- import { BaseOptions } from '../util/baseOptions.js';
10
- import { expandFileLists } from '../util/fileLists.js';
11
- import { isProject } from '../util/projectLoader.js';
12
- import { buildTestData } from './buildTestData/index.js';
13
- import { buildWindowsPackageInstaller } from './buildWindowsPackageInstaller/index.js';
14
- import { commandOptionsToCompilerOptions } from '../util/extendedCompilerOptions.js';
15
- import { exitProcess } from '../util/sysexits.js';
16
- export function declareBuild(program) {
17
- // TODO: localization?
18
- const buildCommand = program
19
- .command('build')
20
- .option('--color', 'Force colorization for log messages')
21
- .option('--no-color', 'No colorization for log messages; if both omitted, detects from console')
22
- // These options are only used with build file but are included here so that
23
- // they are visible in `kmc build --help`
24
- .option('-d, --debug', 'Include debug information in output')
25
- .option('-w, --compiler-warnings-as-errors', 'Causes warnings to fail the build; overrides project-level warnings-as-errors option')
26
- .option('-W, --no-compiler-warnings-as-errors', 'Warnings do not fail the build; overrides project-level warnings-as-errors option')
27
- .option('-m, --message <number>', 'Adjust severity of info, hint or warning message to Disable (default), Info, Hint, Warn or Error (option can be repeated)', (value, previous) => previous.concat([value]), [])
28
- .option('--no-compiler-version', 'Exclude compiler version metadata from output')
29
- .option('--no-warn-deprecated-code', 'Turn off warnings for deprecated code styles');
30
- BaseOptions.addAll(buildCommand);
31
- buildCommand.command('file [infile...]', { isDefault: true })
32
- .description(`Compile one or more source files or projects ('file' subcommand is default).`)
33
- .option('--for-publishing', 'Verify that project meets @keymanapp repository requirements')
34
- .addHelpText('after', `
35
- Supported file types:
36
- * folder: Keyman project in folder
37
- * .kpj: Keyman project
38
- * .kmn: Keyman keyboard
39
- * .xml: LDML keyboard
40
- * .model.ts: Keyman lexical model
41
- * .kps: Keyman keyboard or lexical model package
42
-
43
- File lists can be referenced with @filelist.txt.
44
-
45
- If no input file is supplied, kmc will build the current folder.`)
46
- .action(buildFile);
47
- buildCommand
48
- .command('ldml-test-data <infile>')
49
- .description('Convert LDML keyboard test .xml to .json')
50
- .action(buildTestData);
51
- buildCommand
52
- .command('windows-package-installer <infile>')
53
- .description('Build an executable installer for Windows for a Keyman package')
54
- .option('--msi <msiFilename>', 'Location of keymandesktop.msi')
55
- .option('--exe <exeFilename>', 'Location of setup.exe')
56
- .option('--license <licenseFilename>', 'Location of license.txt')
57
- .option('--title-image [titleImageFilename]', 'Location of title image')
58
- .option('--app-name [applicationName]', 'Installer property: name of the application to be installed', 'Keyman')
59
- .option('--start-disabled', 'Installer property: do not enable keyboards after installation completes')
60
- .option('--start-with-configuration', 'Installer property: start Keyman Configuration after installation completes')
61
- .action(buildWindowsPackageInstaller);
62
- }
63
- function initialize(commanderOptions) {
64
- // We use a default callback instance when validating command line, but throw
65
- // it away once we have completed initialization
66
- const initializationCallbacks = new NodeCompilerCallbacks({});
67
- const options = commandOptionsToCompilerOptions(commanderOptions, initializationCallbacks);
68
- return options;
69
- }
70
- async function buildFile(filenames, _options, commander) {
71
- const commanderOptions /*:{TODO?} CommandLineCompilerOptions*/ = commander.optsWithGlobals();
72
- const options = initialize(commanderOptions);
73
- if (!options) {
74
- return await exitProcess(1);
75
- }
76
- const callbacks = new NodeCompilerCallbacks(options);
77
- if (!filenames.length) {
78
- // If there are no filenames provided, then we are building the current
79
- // folder ('.') as a project-style build
80
- filenames.push('.');
81
- }
82
- /* c8 ignore next 6 */
83
- // full test on console log of error message not justified; check with user test recommended
84
- if (filenames.length > 1 && commanderOptions.outFile) {
85
- // -o can only be specified with a single input file
86
- callbacks.reportMessage(InfrastructureMessages.Error_OutFileCanOnlyBeSpecifiedWithSingleInfile());
87
- return await exitProcess(1);
88
- }
89
- if (!expandFileLists(filenames, callbacks)) {
90
- return await exitProcess(1);
91
- }
92
- for (let filename of filenames) {
93
- if (!await build(filename, commanderOptions.outFile, callbacks, options)) {
94
- // Once a file fails to build, we bail on subsequent builds
95
- return await exitProcess(1);
96
- }
97
- }
98
- }
99
- async function build(filename, outfile, parentCallbacks, options) {
100
- try {
101
- // TEST: allow command-line simulation of infrastructure fatal errors, and
102
- // also for unit tests
103
- if (process.env.SENTRY_CLIENT_TEST_BUILD_EXCEPTION == '1') {
104
- throw new Error('Test exception from SENTRY_CLIENT_TEST_BUILD_EXCEPTION');
105
- }
106
- if (!fs.existsSync(filename)) {
107
- parentCallbacks.reportMessage(InfrastructureMessages.Error_FileDoesNotExist({ filename }));
108
- return false;
109
- }
110
- // Normalize case for the filename and expand the path; this avoids false
111
- // positive case mismatches on input filenames and glommed paths
112
- filename = fs.realpathSync.native(filename);
113
- let builder = null;
114
- // If infile is a directory, then we treat that as a project and build it
115
- if (isProject(filename)) {
116
- builder = new BuildProject();
117
- }
118
- else {
119
- // Otherwise, if it's one of our known file extensions, we build it
120
- let extensions = [];
121
- builder = buildActivities.find(build => {
122
- extensions.push(build.sourceExtension);
123
- return filename.toLowerCase().endsWith(build.sourceExtension);
124
- });
125
- if (!builder) {
126
- parentCallbacks.reportMessage(InfrastructureMessages.Error_FileTypeNotRecognized({ filename, extensions: extensions.join(', ') }));
127
- return false;
128
- }
129
- }
130
- // For builds which refer to a project folder, we'll imply a build of the
131
- // .kpj, even if it doesn't actually exist, just for clarity.
132
- let buildFilename = path.resolve(filename);
133
- if (fs.statSync(filename).isDirectory()) {
134
- buildFilename = path.join(buildFilename, path.basename(buildFilename) + ".kpj" /* KeymanFileTypes.Source.Project */);
135
- }
136
- const relativeFilename = path.relative(process.cwd(), buildFilename).replace(/\\/g, '/');
137
- const callbacks = new CompilerFileCallbacks(buildFilename, options, parentCallbacks);
138
- callbacks.reportMessage(InfrastructureMessages.Info_BuildingFile({ filename: buildFilename, relativeFilename }));
139
- let result = await builder.build(filename, outfile, callbacks, options);
140
- result = result && !callbacks.hasFailureMessage();
141
- if (result) {
142
- callbacks.reportMessage(builder instanceof BuildProject
143
- ? InfrastructureMessages.Info_ProjectBuiltSuccessfully({ filename: buildFilename, relativeFilename })
144
- : InfrastructureMessages.Info_FileBuiltSuccessfully({ filename: buildFilename, relativeFilename }));
145
- }
146
- else {
147
- if (!callbacks.hasFailureMessage(false)) { // false == check only for error+fatal messages
148
- callbacks.reportMessage(InfrastructureMessages.Info_WarningsHaveFailedBuild());
149
- }
150
- callbacks.reportMessage(builder instanceof BuildProject
151
- ? InfrastructureMessages.Info_ProjectNotBuiltSuccessfully({ filename: buildFilename, relativeFilename })
152
- : InfrastructureMessages.Info_FileNotBuiltSuccessfully({ filename: buildFilename, relativeFilename }));
153
- }
154
- return result;
155
- }
156
- catch (e) {
157
- parentCallbacks.reportMessage(InfrastructureMessages.Fatal_UnexpectedException({ e }));
158
- return false;
159
- }
160
- }
161
- /**
162
- * these are exported only for unit tests, do not use
163
- */
164
- export const unitTestEndpoints = {
165
- build,
166
- };
167
- //# debugId=ab2a34a4-83b9-5736-a47d-69510e091fd9
168
- //# sourceMappingURL=build.js.map
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { buildActivities } from './buildClasses/buildActivities.js';
4
+ import { BuildProject } from './buildClasses/BuildProject.js';
5
+ import { NodeCompilerCallbacks } from '../util/NodeCompilerCallbacks.js';
6
+ import { InfrastructureMessages } from '../messages/infrastructureMessages.js';
7
+ import { CompilerFileCallbacks } from '@keymanapp/common-types';
8
+ import { BaseOptions } from '../util/baseOptions.js';
9
+ import { expandFileLists } from '../util/fileLists.js';
10
+ import { isProject } from '../util/projectLoader.js';
11
+ import { buildTestData } from './buildTestData/index.js';
12
+ import { buildWindowsPackageInstaller } from './buildWindowsPackageInstaller/index.js';
13
+ import { commandOptionsToCompilerOptions } from '../util/extendedCompilerOptions.js';
14
+ import { exitProcess } from '../util/sysexits.js';
15
+ export function declareBuild(program) {
16
+ // TODO: localization?
17
+ const buildCommand = program
18
+ .command('build')
19
+ .option('--color', 'Force colorization for log messages')
20
+ .option('--no-color', 'No colorization for log messages; if both omitted, detects from console')
21
+ // These options are only used with build file but are included here so that
22
+ // they are visible in `kmc build --help`
23
+ .option('-d, --debug', 'Include debug information in output')
24
+ .option('-w, --compiler-warnings-as-errors', 'Causes warnings to fail the build; overrides project-level warnings-as-errors option')
25
+ .option('-W, --no-compiler-warnings-as-errors', 'Warnings do not fail the build; overrides project-level warnings-as-errors option')
26
+ .option('-m, --message <number>', 'Adjust severity of info, hint or warning message to Disable (default), Info, Hint, Warn or Error (option can be repeated)', (value, previous) => previous.concat([value]), [])
27
+ .option('--no-compiler-version', 'Exclude compiler version metadata from output')
28
+ .option('--no-warn-deprecated-code', 'Turn off warnings for deprecated code styles');
29
+ BaseOptions.addAll(buildCommand);
30
+ buildCommand.command('file [infile...]', { isDefault: true })
31
+ .description(`Compile one or more source files or projects ('file' subcommand is default).`)
32
+ .option('--for-publishing', 'Verify that project meets @keymanapp repository requirements')
33
+ .addHelpText('after', `
34
+ Supported file types:
35
+ * folder: Keyman project in folder
36
+ * .kpj: Keyman project
37
+ * .kmn: Keyman keyboard
38
+ * .xml: LDML keyboard
39
+ * .model.ts: Keyman lexical model
40
+ * .kps: Keyman keyboard or lexical model package
41
+
42
+ File lists can be referenced with @filelist.txt.
43
+
44
+ If no input file is supplied, kmc will build the current folder.`)
45
+ .action(buildFile);
46
+ buildCommand
47
+ .command('ldml-test-data <infile>')
48
+ .description('Convert LDML keyboard test .xml to .json')
49
+ .action(buildTestData);
50
+ buildCommand
51
+ .command('windows-package-installer <infile>')
52
+ .description('Build an executable installer for Windows for a Keyman package')
53
+ .option('--msi <msiFilename>', 'Location of keymandesktop.msi')
54
+ .option('--exe <exeFilename>', 'Location of setup.exe')
55
+ .option('--license <licenseFilename>', 'Location of license.txt')
56
+ .option('--title-image [titleImageFilename]', 'Location of title image')
57
+ .option('--app-name [applicationName]', 'Installer property: name of the application to be installed', 'Keyman')
58
+ .option('--start-disabled', 'Installer property: do not enable keyboards after installation completes')
59
+ .option('--start-with-configuration', 'Installer property: start Keyman Configuration after installation completes')
60
+ .action(buildWindowsPackageInstaller);
61
+ }
62
+ function initialize(commanderOptions) {
63
+ // We use a default callback instance when validating command line, but throw
64
+ // it away once we have completed initialization
65
+ const initializationCallbacks = new NodeCompilerCallbacks({});
66
+ const options = commandOptionsToCompilerOptions(commanderOptions, initializationCallbacks);
67
+ return options;
68
+ }
69
+ async function buildFile(filenames, _options, commander) {
70
+ const commanderOptions /*:{TODO?} CommandLineCompilerOptions*/ = commander.optsWithGlobals();
71
+ const options = initialize(commanderOptions);
72
+ if (!options) {
73
+ return await exitProcess(1);
74
+ }
75
+ const callbacks = new NodeCompilerCallbacks(options);
76
+ if (!filenames.length) {
77
+ // If there are no filenames provided, then we are building the current
78
+ // folder ('.') as a project-style build
79
+ filenames.push('.');
80
+ }
81
+ /* c8 ignore next 6 */
82
+ // full test on console log of error message not justified; check with user test recommended
83
+ if (filenames.length > 1 && commanderOptions.outFile) {
84
+ // -o can only be specified with a single input file
85
+ callbacks.reportMessage(InfrastructureMessages.Error_OutFileCanOnlyBeSpecifiedWithSingleInfile());
86
+ return await exitProcess(1);
87
+ }
88
+ if (!expandFileLists(filenames, callbacks)) {
89
+ return await exitProcess(1);
90
+ }
91
+ for (let filename of filenames) {
92
+ if (!await build(filename, commanderOptions.outFile, callbacks, options)) {
93
+ // Once a file fails to build, we bail on subsequent builds
94
+ return await exitProcess(1);
95
+ }
96
+ }
97
+ }
98
+ async function build(filename, outfile, parentCallbacks, options) {
99
+ try {
100
+ // TEST: allow command-line simulation of infrastructure fatal errors, and
101
+ // also for unit tests
102
+ if (process.env.SENTRY_CLIENT_TEST_BUILD_EXCEPTION == '1') {
103
+ throw new Error('Test exception from SENTRY_CLIENT_TEST_BUILD_EXCEPTION');
104
+ }
105
+ if (!fs.existsSync(filename)) {
106
+ parentCallbacks.reportMessage(InfrastructureMessages.Error_FileDoesNotExist({ filename }));
107
+ return false;
108
+ }
109
+ // Normalize case for the filename and expand the path; this avoids false
110
+ // positive case mismatches on input filenames and glommed paths
111
+ filename = fs.realpathSync.native(filename);
112
+ let builder = null;
113
+ // If infile is a directory, then we treat that as a project and build it
114
+ if (isProject(filename)) {
115
+ builder = new BuildProject();
116
+ }
117
+ else {
118
+ // Otherwise, if it's one of our known file extensions, we build it
119
+ let extensions = [];
120
+ builder = buildActivities.find(build => {
121
+ extensions.push(build.sourceExtension);
122
+ return filename.toLowerCase().endsWith(build.sourceExtension);
123
+ });
124
+ if (!builder) {
125
+ parentCallbacks.reportMessage(InfrastructureMessages.Error_FileTypeNotRecognized({ filename, extensions: extensions.join(', ') }));
126
+ return false;
127
+ }
128
+ }
129
+ // For builds which refer to a project folder, we'll imply a build of the
130
+ // .kpj, even if it doesn't actually exist, just for clarity.
131
+ let buildFilename = path.resolve(filename);
132
+ if (fs.statSync(filename).isDirectory()) {
133
+ buildFilename = path.join(buildFilename, path.basename(buildFilename) + ".kpj" /* KeymanFileTypes.Source.Project */);
134
+ }
135
+ const relativeFilename = path.relative(process.cwd(), buildFilename).replace(/\\/g, '/');
136
+ const callbacks = new CompilerFileCallbacks(buildFilename, options, parentCallbacks);
137
+ callbacks.reportMessage(InfrastructureMessages.Info_BuildingFile({ filename: buildFilename, relativeFilename }));
138
+ let result = await builder.build(filename, outfile, callbacks, options);
139
+ result = result && !callbacks.hasFailureMessage();
140
+ if (result) {
141
+ callbacks.reportMessage(builder instanceof BuildProject
142
+ ? InfrastructureMessages.Info_ProjectBuiltSuccessfully({ filename: buildFilename, relativeFilename })
143
+ : InfrastructureMessages.Info_FileBuiltSuccessfully({ filename: buildFilename, relativeFilename }));
144
+ }
145
+ else {
146
+ if (!callbacks.hasFailureMessage(false)) { // false == check only for error+fatal messages
147
+ callbacks.reportMessage(InfrastructureMessages.Info_WarningsHaveFailedBuild());
148
+ }
149
+ callbacks.reportMessage(builder instanceof BuildProject
150
+ ? InfrastructureMessages.Info_ProjectNotBuiltSuccessfully({ filename: buildFilename, relativeFilename })
151
+ : InfrastructureMessages.Info_FileNotBuiltSuccessfully({ filename: buildFilename, relativeFilename }));
152
+ }
153
+ return result;
154
+ }
155
+ catch (e) {
156
+ parentCallbacks.reportMessage(InfrastructureMessages.Fatal_UnexpectedException({ e }));
157
+ return false;
158
+ }
159
+ }
160
+ /**
161
+ * these are exported only for unit tests, do not use
162
+ */
163
+ export const unitTestEndpoints = {
164
+ build,
165
+ };
166
+ //# sourceMappingURL=build.js.map