Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

epic(developer): refactor package-metadata for 17.0 🎺 #9485

Merged
merged 121 commits into from
Oct 11, 2023

Conversation

mcdurdin
Copy link
Member

@mcdurdin mcdurdin commented Aug 18, 2023

Collecting all the keyboard, lexical-model, and package metadata work into one epic, because it is turning into quite a big job.

The primary TODO list for this epic is at:


This epic covers multiple repositories:

https://github.com/search?q=org%3Akeymanapp+label%3Aepic-package-metadata+is%3Aopen&type=pullrequests

@keymanapp-test-bot skip

Removes the following fields:
* legacyId
* documentationFilename
* documentationFileSize
* links
* related[].note

None of these fields are needed any longer; see #9351 for steps to
remove data.

Eliminates difference between keyboard_info source and distribution,
renaming to keyboard_info.schema.json, and updating the required members
of the json accordingly.

Will have corresponding commits in keyman.com, api.keyman.com,
help.keyman.com, and keyboards repositories.
Adds info.description, options.fonts, keyboard.examples metadata to
.kps and kmp.json files, updates schemas, and Typescript compiler.
Adds relatedPackages support to:
* .kps schema
* .kps file format for Typescript
* kmp.json file format for Typescript
* kmc-package compiler
* Package Editor
While a package supports a .ttf or .otf font for the OSK and Display
fonts for use within the Keyman apps, on websites it also supports .woff
and .woff2. This change makes it possible to specify a set of fonts for
a package which will be provided through api.keyman.com to websites.

This means that .woff and .woff2 fonts may also be included in the
package and may not be used on target devices at this time, it further
opens the pathway to deploying .kmp packages to web in the future.

The deployment stage of keymanapp/keyboards will require a new phase to
copy web fonts from packages to s.keyman.com.
Adds license file to .kps, kmp.json, kmc-package, package editor, and
new project templates. The intent is for LICENSE.md to be the file used,
and for any keyboards on keymanapp/keyboards, it should always be a
standard MIT license.
* Removes font size
* Restricts font source to array
* Removes example
* Add examples
* Loosen structure of KeyboardExample
Relates to #9351.

Adds support for building a .keyboard_info file without having source
.keyboard_info file:

* Constructs a default source .keyboard_info in memory
* Hints if license is missing
* If LICENSE.md is present, verifies it matches the MIT license text
* Adds project option to turn on or off metadata generation. This will
  default to False for version 1.0 projects, and to True for version 2.0
  projects. This means that the keyboard repository will need a PR to
  enable metadata generation for existing projects in the repository,
  but this is important to avoid breaking builds for existing projects
  that are not in the repository.
* Turns on additional c8 coverage for kmc projects
Also fixes a file reference issue in kmpJson.options, where paths were
stripped too early in the process.

Removes a now-irrelevant unit test for keyboard_info.

TODO: markdown to html during the keyboard_info build.
Moves responsibility for loading .kps into kmc-keyboard-info, away from
the caller, and removes other fields with kmc-keyboard-info can
calculate by itself.

Have not moved project parsing into kmc-keyboard-info, because that's a
bigger job, as currently that is mostly happening within kmc itself. A
project for a future version I think.
Fixes #9478.

This adds a property WelcomeFile to .kps and kmp.json, which allows us
to move away from the hardcoded welcome.htm filename in the future, and
makes transform from Markdown (#9477) a simpler operation, and just
generally starts the cleanup of the messiness of hard-coded filenames.

The package compiler will fallback to injecting welcome.htm into this
property if (a) welcome.htm is present, and (b) the property does not
already have a value. This doesn't buy us much because we still need to
support welcome.htm for existing legacy packages, but does mean that
our .kmp package metadata will be more consistent for packages compiled
with 17.0+ compilers.
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.
Fixes #9266.

For historical reasons there are many non-minimal BCP 47 tags in package
metadata in the repository (over 2500). Furthermore, earlier versions of
kmcomp did not fail the build on package compilation warnings. This
means it is better to reduce WARN_LanguageTagIsNotMinimal to
HINT_LanguageTagIsNotMinimal, so that we can otherwise respect the
'treat warnings as errors' flag on the keyboard projects.

We may be able to upgrade this to a warning again one day in the future.
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.
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.
Part of #9266.

Also cleans up filenames for hint_language_tag_is_not_minimal, and fixes
a bug in transformKpsToKmpObject where a null object could be passed on
to another function in case of failure.
…ge-metadata

chore: merge master into package-metadata 🎺
…ile-property

feat(developer): introduce WelcomeFile property to packages 🎺
…ard_info-example-keys-as-string

refactor(developer): .keyboard_info examples should use keys as a string 🎺
…l-tags-as-hint

fix(developer): non-minimal BCP 47 tags in kps should be a hint 🎺
…s-firstCharLowerCase

chore(common): stop using xml2js.processors.firstCharLowerCase 🎺
…2js-dependency

chore(developer): Update kmc-package xml2js dependency 🎺
…shing-flag

chore(developer): add --for-publishing to kmc 🎺
@mcdurdin mcdurdin marked this pull request as ready for review October 11, 2023 00:24
@mcdurdin mcdurdin changed the title epic(developer): seed epic/package-metadata branch 🎺 epic(developer): refactor package-metadata for 17.0 🎺 Oct 11, 2023
Copy link
Contributor

@rc-swag rc-swag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RSLGTM

…ge-metadata

chore: merge master into package-metadata
@mcdurdin mcdurdin merged commit 9e73da4 into master Oct 11, 2023
2 checks passed
@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 17.0.187-alpha

@mcdurdin mcdurdin deleted the epic/package-metadata branch October 11, 2023 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants