Commit graph

69 commits

Author SHA1 Message Date
Dr Mark C. Sinclair
9ee45b9306 chore(developer): Merge branch 'beta' into fix/developer/font-family-returns-null-if-ttfMeta-promise-errors 2024-03-13 10:04:33 +00:00
Dr Mark C. Sinclair
90c028e1b0 fix(developer): getFontFamily now returns null if ttfMeta.promise errors (plus test) 2024-03-12 18:47:31 +00:00
Dr Mark C. Sinclair
b5a21bd4ad chore(developer): Merge branch 'beta' into test/developer/kmc-keyboard-info-unit-test 2024-03-12 17:47:30 +00:00
Dr Mark C. Sinclair
75531d70e4 chore(developer): remove unnecessary fixture files from no-kmp 2024-03-07 16:14:45 +00:00
Dr Mark C. Sinclair
c340af85b9 chore(developer): remove unnecessary fixture files from no-license-in-kmp-sources 2024-03-07 16:08:10 +00:00
Dr Mark C. Sinclair
fa89f06187 chore(developer): add ERROR_NoLicenseFound test 2024-03-07 15:55:47 +00:00
Dr Mark C. Sinclair
911cae686e chore(developer): add ERROR_CannotBuildWithoutKmpFile test 2024-03-07 12:01:26 +00:00
Dr Mark C. Sinclair
be8ab1d4e4 chore(developer): refactor to place keyboard info message unit tests in correct test file 2024-03-07 11:33:05 +00:00
Dr Mark C. Sinclair
37b26baf22 chore(developer): correct test description for ERROR_FileDoesNotExist (.kmp fileSize) test 2024-03-07 11:21:04 +00:00
Dr Mark C. Sinclair
e91766477d chore(developer): Merge branch 'beta' into test/developer/kmc-keyboard-info-unit-test 2024-03-07 11:14:11 +00:00
Marc Durdin
62bd84e8e7
Merge pull request #10923 from keymanapp/docs/developer/kmc-keyboard-info-docs
docs(developer): kmc-keyboard-info api documentation
2024-03-07 18:13:18 +07:00
Dr Mark C. Sinclair
3fd789aae9
Merge pull request #10893 from keymanapp/fix/developer/kmc-info-compiler-no-kmp-error
fix(developer): kmc keyboard info compiler no kmp error
2024-03-07 10:12:10 +00:00
Dr Mark C. Sinclair
cb6cc461c8 chore(developer): add ERROR_LicenseIsNotValid test; ensure TextDecoder.decode restored in two tests 2024-03-04 12:46:54 +00:00
Dr Mark C. Sinclair
f9a2e92609 chore(developer): add ERROR_LicenseFileIsDamaged (null on decode) test 2024-03-04 12:17:05 +00:00
Dr Mark C. Sinclair
d790a2d5a5 chore(developer): add ERROR_LicenseFileIsDamaged (error on decode) test 2024-03-04 12:12:13 +00:00
Marc Durdin
b225c7a492 docs(developer): kmc-keyboard-info api documentation
Relates to #10207.
2024-03-04 19:01:08 +07:00
Dr Mark C. Sinclair
4cf4efc71b chore(developer): add missing 'ERROR_' to test descriptions for FileDoesNotExist 2024-03-04 11:23:24 +00:00
Dr Mark C. Sinclair
98764dc23a chore(developer): add ERROR_LicenseFileIsMissing test 2024-03-04 11:20:15 +00:00
Dr Mark C. Sinclair
41ec7cf167 chore(developer): add ERROR_FileDoesNotExist (font file not on disk) test 2024-03-04 10:38:55 +00:00
Dr Mark C. Sinclair
3addca4ccf chore(developer): fix stubbing (fillLanguages is private); delete stubFillLanguages 2024-03-04 09:57:19 +00:00
Dr Mark C. Sinclair
eccb4ae993
chore(developer): make stubbing of fillLanguages inline
Co-authored-by: Marc Durdin <marc@durdin.net>
2024-03-04 09:48:02 +00:00
Marc Durdin
90d39f9eaa chore(developer): tiny refactor of urls 2024-03-04 12:44:48 +07:00
Marc Durdin
e64103a02f chore(developer): consolidate external links in Developer messages
Establishes keyman-urls.ts as a single place for any links to external
websites.

I searched all .ts files in Keyman Developer source and replaced
references to websites with function calls here. Note that the names of
individual functions within this class can be easily changed as needed,
as the hard part was the consolidation.
2024-03-04 12:38:07 +07:00
Dr Mark C. Sinclair
7fb173704f fix(developer): stub fillLanguages() allowing removal of fonts to reduce fixture size 2024-03-01 11:43:04 +00:00
Dr Mark C. Sinclair
c10c856c8f chore(developer): add ERROR_FileDoesNotExist (font file in package) test 2024-02-29 15:23:00 +00:00
Dr Mark C. Sinclair
4d1c89f547 chore(developer): add code coverage comment as existence of .js file previously checked 2024-02-29 14:14:40 +00:00
Dr Mark C. Sinclair
4f9625decc chore(developer): some improvements to ERROR_FileDoesNotExist (loadJsFile) test 2024-02-29 14:06:46 +00:00
Dr Mark C. Sinclair
337bd784c0 fix(developer): add ERROR_FileDoesNotExist (.kmp fileSize) test 2024-02-29 13:25:32 +00:00
Dr Mark C. Sinclair
c3210801e9 fix(developer): check .kmp file exists before determining size 2024-02-29 11:38:01 +00:00
Marc Durdin
5062bbad98 feat(developer): adds kmc message command
Realtes to #10207.

Adds a new `kmc message` command which prints detailed information about
any or all compiler messages, in JSON, text, or markdown formats.

Markdown format is emitted to file in a structured way to be deployed to
the help site automatically (coming in a subsequent commit).
2024-02-29 11:05:27 +07:00
Marc Durdin
4bb9b39ba2 refactor(developer): reorganize messages for adding details
Moved the ERROR_Message line above the Error_Message line for every
message in the compiler message files, as it makes the grouping clearer
once we start adding message details. For example, see the start of the
KmnCompilerMessages class.

Also wraps potentially-undefined parameters to the messages with a new
function `def`, shorthand for `CompilerMessageDef`, which converts the
parameter to '<param>' if it is undefined, which is helpful for
documentation.
2024-02-28 16:00:02 +07:00
Marc Durdin
c7afed7201 refactor(developer): split messages with callstacks into separate generator
Relates to #10207.

In order to include message detail in messages, it is helpful to split
out the exception messages which have a separate parameter, so that
parameter at the same position can be the message detail.

Introduces the CompilerMessageSpecWithException function which takes an
exceptionVar parameter to achieve this differentiation.
2024-02-28 11:34:49 +07:00
Dr Mark C. Sinclair
552ae9e663 chore(developer): add ERROR_FileDoesNotExist (loadJsFile) test 2024-02-26 12:41:35 +00:00
Marc Durdin
602b519057 docs(developer): npm package readme files 2024-02-26 14:00:51 +07:00
Marc Durdin
a8d0d8454c feat(developer): add api documentation to build
Relates to #10207.

Adds the `api` action to build.sh for each affected module. The `api`
action for each module will generate the api metadata files, and then
the markdown files are generated by /developer/build.sh api.

Note that developer-utils, kmc, and kmcmplib have no api documentation
at this time (and kmcmplib is not Typescript so would need separate
tooling anyway).
2024-02-26 11:45:36 +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
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
Marc Durdin
13533a726a feat(developer): KeyboardInfoCompiler now implements KeymanCompiler
Relates to #9473.

Refactors the public API of KeyboardInfoCompiler to meet KeymanCompiler,
including moving file write responsibilities into the class itself.

`sources` has become a property of `options`, which is perhaps a slight
violation of the intent of the `init()` function being a one-time call,
as it means we'll need to instantiate an new class for each file we
compile. Given the use-case for the keyboard_info compiler is almost
exclusively internal, I think this is acceptable. Tell me if you think
otherwise!
2023-12-09 07:15:06 +07:00
Marc Durdin
69a2448176 feat(developer): PackageCompiler and WindowPackageInstallerCompiler now implement KeymanCompiler
Relates to #9473.

Refactors the public API of PackageCompiler and
WindowsPackageInstallerCompiler to meet KeymanCompiler, including
asyncing a bunch of functions, and moving file write responsibilities
into the classes themselves.

The classes were updated together in a single commit because
WindowsPackageInstallerCompiler depends on PackageCompiler, and needed
refactoring for the updated API access there anyway.

Most of the test cases needed only minor patching, but introducing the
`async init()` function has caused them to all be async. The
test-messages module has a slight functional change with the compile
process running completely rather than stopping on first message, which
meant we needed to add extra dummy fixtures to avoid other errors that
arose later in the compile process. The keyman.exe fixture is a text
file, not a Windows executable.
2023-12-09 06:48:53 +07: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
c5c5b35415 chore(common): remove prepublish step from package.json
Given we've just run a build, this (a) seems unnecessary, and (b) seems
to go wrong in some circumstances anyway, e.g.
https://build.palaso.org/buildConfiguration/Keyman_Developer_Release/421326?buildTab=log&focusLine=19936&linesState=18839&logView=flowAware:

```
07:01:29   > @keymanapp/kmc@17.0.205-alpha prepublishOnly
07:01:29   > npm run build
07:01:29
07:01:31
07:01:31   > @keymanapp/kmc@17.0.205-alpha build
07:01:31   > tsc -b
07:01:31
07:01:35   ../../../common/web/types/build/src/kmx/kmx.d.ts(1,1): error TS1036: Statements are not allowed in ambient contexts.
07:01:35   ../../../common/web/types/build/src/kmx/kmx.d.ts(1,2): error TS1345: An expression of type 'void' cannot be tested for truthiness.
...
```
2023-11-04 07:34:18 +07:00
Marc Durdin
c01a37145a chore(developer): address review comments 2023-11-02 11:02:20 +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
Marc Durdin
cc11435bb2 fix(developer): avoid adding null font data to keyboard_info 2023-10-18 05:41:03 +07:00
Marc Durdin
35814bc29f chore(developer): add --for-publishing to kmc
The new --for-publishing flag allows us to enforce additional
requirements for keyboards and lexical models that are to be published
to the keymanapp repositories. This flag will always be switched on in
the repository builds. This flag overrides the 'skipMetadata' option
which is a project-level option.

There is a bit of a delicate balance of requirements here:

1. We want to be able to automatically verify keyboards and package
   licenses if they are in the repository.
2. We do not want to force license checks on privately built keyboards
   and models.
3. We want to provide pathways for users to check locally before
   submitting to the repository.
4. If possible, we want to be able to build the .keyboard_info and
   .model_info files locally, but this should be up to the user for
   local builds.

For now, the only additional check that this flag provides is to verify
that the license is MIT, which was an unchecked requirement for the
repositories in the past.

Future checks can be added for file layout, additional required
metadata files.

Anticipate adding this as a tool to Keyman Developer IDE -- a
'pre-publish' check -- in the future.
2023-10-09 07:45:34 +07:00
Marc Durdin
cc5b8da69b refactor(developer): .keyboard_info examples should use keys as a string
Fixes #9708.

Matches the kmp.json format of keys string in the .keyboard_info schema
and compiler, in order to reduce the number of formats we are working
with. This same format may be used elsewhere in Keyman schemas in the
future for sets of keys, for example, I hope we can use it in regression
tests.
2023-10-08 19:01:14 +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
d4e4992714 chore(common): cleanup final Typescript non-ESM metadata
Fixes #9262.
2023-10-04 12:55:51 +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