Commit graph

185 commits

Author SHA1 Message Date
Marc Durdin
9776aa7dbf fix(developer): move osk.ts from developer-utils to kmc-kmn
Fixes #10872. Modifies #10845.

developer-utils is also used by server. Because osk.ts depends on
common-types, this introduced a transitive dependency for
developer-utils. Packaging server for deployment as part of Keyman
Developer is fragile and we need to hand-code our internal dependencies,
as npm bundling struggles with in-repo dependencies. So we need to avoid
introducing extra dependencies into developer-utils at this time.

It turns out that osk.ts is used by kmc-kmn and kmc-analyze. kmc-analyze
already has a dependency on kmc-kmn, so it makes sense to put it there.
2024-03-01 08:47:04 +07:00
Marc Durdin
70a50f0f67 refactor(developer): move osk module from common-types to developer-utils
This module is used only by Keyman Developer compiler. It was originally
in common-types because we didn't have a shared module for Developer.

Moving it to @keymanapp/developer-utils in order to improve its
documentation.
2024-02-26 14:57:27 +07:00
Marc Durdin
661069c0c3 feat(developer): add api-extractor and api-documenter and config
Relates to #10207.

Adds @microsoft/api-extractor and @microsoft/api-documenter NPM
packages for validating and generating API documentation from Typescript
modules.

Adds basic configuration for each module that we will be publishing at
this time.

api-extractor's output will be emitted to /developer/docs/api/etc/, for
future release comparisons. A baseline output will be committed
separately.

The build outputs will be in /developer/build/docs and the intermediate
files will be in /developer/build/api.

Note that at this time, we will not enable the checks and validations.
That is a task for alpha rather than beta. The primary intent at this
time is to select a solid, well-supported toolchain for generating the
API documentation for kmc.
2024-02-26 11:37:32 +07:00
Marc Durdin
adce514a71 chore(developer): kmc ldml build - call c8 directly for tests 2024-01-26 11:34:35 +07:00
Marc Durdin
5111e5b32b
Merge pull request #10359 from keymanapp/chore/developer/10357-ngrok-v3
chore(developer): upgrade ngrok to v3
2024-01-24 19:29:02 +11:00
Marc Durdin
d2580c6a73
Merge pull request #10258 from keymanapp/feat/developer/10150-control-message-severity
feat(developer): add `-m` parameter to kmc to control message severity
2024-01-16 14:01:27 +11:00
Marc Durdin
df343ecb84 chore(developer): package-lock.json 2024-01-11 09:57:46 +07:00
dependabot[bot]
65aa7d3457
chore(deps-dev): bump follow-redirects from 1.14.9 to 1.15.4
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.9 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.9...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-09 10:48:12 +00:00
Joshua A. Horton
90ecdf38f8 fix(web): adds Symbol, Map polyfill for main Web 2023-12-19 14:17:46 +07:00
Eberhard Beilharz
3cde93d56a
Merge pull request #10250 from keymanapp/chore/web/attachmentTests
chore(web): Add unit tests for `pageContextAttachment`
2023-12-15 08:13:50 +01:00
Marc Durdin
bfc35e9272 feat(developer): common Messages exports from kmc modules
Relates to #10150. Makes the various Messages classes in kmc modules
accessible to other modules. Some file renames involved to reduce
confusion.

No functional changes.

Fixes kmc-analyze metadata.

See #10254 for a related future fix.
2023-12-14 09:40:18 +07:00
Eberhard Beilharz
c9fac1b944
chore(web): Add unit tests for pageContextAttachment 2023-12-13 19:04:59 +01:00
Marc Durdin
aa458152cf
Merge branch 'feature-gestures' into chore/merge-master-into-feature-gestures 2023-12-08 14:24:38 +11:00
Marc Durdin
662ed0e50c fix(common): publish @keymanapp/developer-utils as npm module
Fixes #10111.
2023-12-01 14:05:51 +07:00
Marc Durdin
33da132eab
Merge branch 'feature-gestures' into chore/merge-master-into-feature-gestures 2023-11-13 09:44:55 +11:00
Marc Durdin
716cb526b7 fix(developer): Sentry in Server should honour reporting settings
Fixes #9939.

Uses refactored KeymanSentry.ts in developer-utils and updates the
loader in Server to run from that.

The changes to tray.ts and friends are required to deal with a top-level
await issue with the shutdown call.

The top-level await issue is described in detail at
https://marc.durdin.net/2023/11/dynamic-import-on-node-js-with-circular-dependencies-leads-to-interesting-failure-modes/

tl;dr: shutdown needed to do a proper Sentry shutdown. The shutdown code
was in index.ts. This led to a circular dependency and caused a silent
and abrupt exit code 13 in Node.js. Moved shutdown code into shutdown.ts
to resolve this.
2023-11-06 08:18:24 +07:00
Marc Durdin
cff2e0e3ba feat(developer): extract font family from .ttf in kmc-keyboard-info
Instead of generating a name for the web fonts, we should be using the
font family from the .ttf, as we have it available. This allows us to
avoid downloading the font if the user already has it installed on their
system.

Uses ttfmeta npm package, which is a lightweight .ttf reader. Updates
the honking big unit test to do some basic tests on this functionality.
2023-10-26 14:15:54 +07:00
Joshua Horton
6d313f27b8
Merge pull request #9664 from keymanapp/refactor/web/common-layout-typing
refactor(web): unifies touch-layout typing, updating Web to the common/web/types version 🐵
2023-10-20 16:12:31 +07:00
Joshua A. Horton
23ac3cc673 chore(common): Merge branch 'feature-gestures' into chore/merge-master-into-feature-gestures 2023-10-12 08:14:30 +07:00
Joshua A. Horton
8479ebd1c4 chore(web): Merge branch 'fix/web/recognizer-polish-and-source-uniqueness' into refactor/web/common-layout-typing 2023-10-11 14:10:33 +07:00
Joshua A. Horton
d6072f6959 chore(web): Merge branch 'master' into chore/web/feature-gestures-update-a17s23-mid 2023-10-10 08:25:46 +07:00
Marc Durdin
52291b1ccb chore(developer): remove unused xml2js references 2023-10-09 06:34:32 +07:00
Marc Durdin
0f5e88192c chore(developer): Update kmc-package xml2js dependency
I missed adding this as a dependency for @keymanapp/kmc-package. because
node has a very lenient dependency search, it found xml2js from other
@keymanapp/common-types, so never caused errors locally.
2023-10-09 06:06:34 +07:00
Marc Durdin
6c944cff65 chore: Merge branch 'epic/package-metadata' into chore/merge-master-into-package-metadata 2023-10-06 11:52:13 +07:00
Marc Durdin
225877f57a feat(common): precompile json schemas to improve performance
Fixes #9640.

This ended up being somewhat more fragile than originally anticipated.
For the `ajv` cli call to get the right versions, we needed to install
ajv as a dev dependency in the top-level package.json as well as at the
common/web/types level.

Ajv does not do all that well with ESM yet, either, so we use esbuild to
transform the compiled validators before building in typescript.
2023-10-05 13:56:53 +07:00
Marc Durdin
1e5c59c33f
Merge branch 'chore/common/9677-version-to-esm' into chore/common/9679-keyman-version-esm-only 2023-10-04 19:07:28 +11:00
Marc Durdin
21f226c0b2
Merge branch 'chore/common/9675-hextobin-to-esm' into chore/common/9677-version-to-esm 2023-10-04 19:07:18 +11:00
Marc Durdin
75a0977cdb chore(developer): fix server tests 2023-10-04 14:17:59 +07:00
Marc Durdin
8c28b96c9f chore(common): convert resources/build/version to ES Modules
Fixes #9677.
2023-10-04 12:21:35 +07:00
Marc Durdin
f432cab851 chore(common): keyman-version now generates only es module 2023-10-04 12:06:46 +07:00
Marc Durdin
fbd9a4b5e8 chore(common): convert resources/build/version to ES Modules
Fixes #9677.
2023-10-04 11:50:53 +07:00
Joshua A. Horton
fdb3c3761b refactor(web): KMW use of common touch-layout typing defs 2023-10-03 14:15:36 +07:00
Marc Durdin
94be7bb60c chore(developer): validate emitted .keyboard_info and fix keys
Fixes #9620.

.keyboard_info keys emitted from kmc-keyboard-info had the wrong format
for the example.keys object, which I discovered when I applied the
validation to the kmc-keyboard-info output.
2023-09-25 15:53:20 +07:00
Marc Durdin
c4a84fc9e9
Merge pull request #9566 from keymanapp/chore/merge-master-into-feature-gestures
chore: merge master into feature-gestures 🐵
2023-09-15 17:06:20 +02:00
Marc Durdin
508588ef26 chore(developer): developer-utils as private package 2023-09-01 15:58:22 +07:00
Marc Durdin
7f76de4781 chore(developer): add developer-utils as workspace 2023-09-01 10:11:15 +07:00
Marc Durdin
56d64da9a7 chore(developer): npm install and fix import 2023-08-30 16:31:43 +10:00
Marc Durdin
72efe0cd5c feat(developer): markdown conversion for description in package editor 2023-08-17 10:17:52 +07:00
Marc Durdin
fa19eea873 chore(developer): improve kmc sentry reporting on fatal build errors
kmc already reported unhandled exceptions, but any handled fatal errors
were captured and only reported to the user. It is better to report
these to Sentry as these are still unexpected.

I have refactored all the fatal exception messages in various kmc
modules to use a common mechanism, keeping all the Sentry integration in
kmc, now passing exception data up in the `CompilerEvent.exceptionVar`
property.

* I took the opportunity to rename messages.ts to
  infrastructureMessages.ts

* @types/chai was missing which gave intellisense errors in vscode

* normal exit of kmc now provides an opportunity for error reports to
  Sentry to be finalized

* Added a unit test for fatal errors in kmc

* Added a manual test pathway with `SENTRY_CLIENT_TEST_BUILD_EXCEPTION`
  env var to trip the build fatal error mechanism and verify that it
  looks ok; the following shows test runs demonstrate how fatal build
  errors are reported:

```
mcdurdin@THARK MINGW64 /c/Projects/keyman/app/developer/src/kmc (chore/developer/report-fatal-compiler-errors-to-sentry)
$ SENTRY_CLIENT_TEST_BUILD_EXCEPTION=1 node . --error-reporting build
fatal KM05001: Unexpected exception: Error: Test exception from SENTRY_CLIENT_TEST_BUILD_EXCEPTION

Call stack:
Error: Test exception from SENTRY_CLIENT_TEST_BUILD_EXCEPTION
    at build (file:///C:/Projects/keyman/app/developer/src/kmc/build/src/commands/build.js:78:19)
    at Command.<anonymous> (file:///C:/Projects/keyman/app/developer/src/kmc/build/src/commands/build.js:66:24)
    at Command.listener [as _actionHandler] (C:\Projects\keyman\app\node_modules\commander\lib\command.js:482:17)
    at C:\Projects\keyman\app\node_modules\commander\lib\command.js:1283:65
    at Command._chainOrCall (C:\Projects\keyman\app\node_modules\commander\lib\command.js:1177:12)
    at Command._parseCommand (C:\Projects\keyman\app\node_modules\commander\lib\command.js:1283:27)
    at C:\Projects\keyman\app\node_modules\commander\lib\command.js:1081:27
    at Command._chainOrCall (C:\Projects\keyman\app\node_modules\commander\lib\command.js:1177:12)
    at Command._dispatchSubcommand (C:\Projects\keyman\app\node_modules\commander\lib\command.js:1077:23)
    at Command._parseCommand (C:\Projects\keyman\app\node_modules\commander\lib\command.js:1248:19)

    This error has been automatically reported to the Keyman team.
      Identifier:  6f0fca1a26694c22b03f02b2463d39c5
      Application: Keyman Developer
      Reported at: https://sentry.io/organizations/keyman/projects/keyman-developer/events/6f0fca1a26694c22b03f02b2463d39c5/

mcdurdin@THARK MINGW64 /c/Projects/keyman/app/developer/src/kmc (chore/developer/report-fatal-compiler-errors-to-sentry)
$ SENTRY_CLIENT_TEST_BUILD_EXCEPTION=1 node . --no-error-reporting build
fatal KM05001: Unexpected exception: Error: Test exception from SENTRY_CLIENT_TEST_BUILD_EXCEPTION

Call stack:
Error: Test exception from SENTRY_CLIENT_TEST_BUILD_EXCEPTION
    at build (file:///C:/Projects/keyman/app/developer/src/kmc/build/src/commands/build.js:78:19)
    at Command.<anonymous> (file:///C:/Projects/keyman/app/developer/src/kmc/build/src/commands/build.js:66:24)
    at Command.listener [as _actionHandler] (C:\Projects\keyman\app\node_modules\commander\lib\command.js:482:17)
    at C:\Projects\keyman\app\node_modules\commander\lib\command.js:1283:65
    at Command._chainOrCall (C:\Projects\keyman\app\node_modules\commander\lib\command.js:1177:12)
    at Command._parseCommand (C:\Projects\keyman\app\node_modules\commander\lib\command.js:1283:27)
    at C:\Projects\keyman\app\node_modules\commander\lib\command.js:1081:27
    at Command._chainOrCall (C:\Projects\keyman\app\node_modules\commander\lib\command.js:1177:12)
    at Command._dispatchSubcommand (C:\Projects\keyman\app\node_modules\commander\lib\command.js:1077:23)
    at Command._parseCommand (C:\Projects\keyman\app\node_modules\commander\lib\command.js:1248:19)
```
2023-08-09 09:34:44 +07:00
Marc Durdin
cdf026c2ba chore: Merge branch 'feature-kmc-kmw' into chore/merge-master-into-feature-kmc-kmw-a17s18 2023-08-04 12:54:10 +07:00
Joshua A. Horton
fa16bbf7aa chore: Merge branch 'master' into chore/feature-gestures-a17s18-master-merge 2023-08-04 11:04:38 +07:00
Marc Durdin
c9e1e82a76
Merge branch 'feature-kmc-kmw' into feat/developer/introduce-kmc-keyboard-info 2023-07-26 19:24:34 +10:00
Marc Durdin
810f0a04ee chore(developer): npm install 2023-07-26 14:57:08 +07:00
Marc Durdin
b369fbb89b feat(developer): implement kmc keyboard_info compiler
Fixes missing components of the kmc-keyboard-info compiler and
integration into kmc. Lots of cleanup making sure that the compiler
actually generates expected output against the keyboards repository.
2023-07-25 14:21:58 +07:00
Joshua A. Horton
41bad286a3 chore(web): Merge branch 'master' into chore/web/merge-feature-gestures-master-a17s17-end 2023-07-21 14:30:54 +07:00
Marc Durdin
1810434b34 chore: Merge branch 'feature-kmc-kmw' into chore/merge-master-into-kmc-kmw-a17s17 2023-07-21 10:09:33 +07:00
dependabot[bot]
8f72f61cbb
chore(deps-dev): bump word-wrap from 1.2.3 to 1.2.4
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-20 11:17:39 +00:00
Marc Durdin
31ee7bff63 feat(developer): use sentry inject for sourcemap resolution 2023-07-13 06:07:44 +07:00
Marc Durdin
b435471b24 feat(developer): add sentry reporting for kmc
Fixes #9113.

Adds sentry reporting, plus helper functions, for kmc. Includes the
now-standard `-sentry-client-test-exception` command line parameter,
with `kmcmplib` and `event` sub-options available.

Uploads kmc* sourcemaps to sentry on a release build.

On Windows, honours the registry setting for error reporting. Also
includes a command line option `--[no-]error-reporting` (must be used
prior to initial command, e.g. `kmc --no-error-reporting build ...`).
2023-07-11 15:45:41 +07:00
Marc Durdin
de1c171f46 chore(developer): cleanup compiler messages in kmc
Fixes #8795.
Relates to #9090.

Cleans up and makes consistent compiler messages in kmc, and related
unit tests.

Adds support for colorized messages.

After installing chalk for ansi coloring in kmc, @types/node needed to
be brought in sync with the Typescript version, per the suggestion of
checking against `npm dist-tags @types/node`,found in a discussion at
https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/64262#discussioncomment-4905069

Additional tidying up includes:
* Deprecating a set of functions in compiler-interfaces, bringing them
  together under a new CompilerError class.
  Separating CompilerErrorSeverity and CompilerErrorMask enums.
* Making CompilerError.formatEvent (formerly compilerEventFormat) print
  messages in the same format as NodeCompilerCallbacks (sans coloring).
* Adding a wrapper class for CompilerCallbacks that manages the filename
  reporting, used currently exclusively by kmc itself.
2023-07-10 15:13:48 +07:00