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

feat(developer): source files from remote URLs #12336

Closed

Conversation

mcdurdin
Copy link
Member

@mcdurdin mcdurdin commented Sep 2, 2024

TEMP: this is very much not ready for production; opening as a draft for public comment.

I will split the 'file.description' removal into a separate PR later.

The concept here is that the 'Name' property for a file can now be a remote reference, rather than a local file. There are two supported formats in this commit:

  • GitHub: This is a cutdown version of a plain github.com URL, and must match this exact format:

    github:<owner>/<repo>/raw/<hash>/<filepath/filename>
    

    This format is mandated in order to ensure that we always have a hashed version of a file from the origin. This gives us reproducible builds, which avoids churn issues when font files change.

    Example: github:silnrsi/fonts/raw/b88c7af5d16681bd137156929ff8baec82526560/fonts/sil/alkalami/Alkalami-Regular.ttf gets https://github.com/silnrsi/fonts/raw/b88c7af5d16681bd137156929ff8baec82526560/fonts/sil/alkalami/Alkalami-Regular.ttf

    An alternative could be to just have https://github.com/silnrsi/fonts/raw/b88c7af5d16681bd137156929ff8baec82526560/fonts/sil/alkalami/Alkalami-Regular.ttf which could be matched with a regex in the same way as the github prefix, and would avoid the need to munge the input URL. Discuss!

  • fonts.languagetechnology.org: references just a font identifier. This is somewhat broken, because if the source file changes, we don't know about it and won't publish an updated version of the package. So this needs some more discussion (we could e.g. embed the version number in the request, e.g. flo:[email protected]). Discuss!

    flo:<family>
    

    e.g. flo:andika gets https://fonts.languagetechnology.org/fonts/sil/andika/Andika-Bold.ttf

Future sources could be considered, e.g. noto. We don't want to allow arbitrary URLs, both for stability and for security reasons.

This change is entirely compiler-side, so we don't need to make any changes to apps, and so packages will be backwardly compatible. A lot of work will need to be done with the Package Editor in TIKE to support this feature.

Fixes: #11236

@keymanapp-test-bot keymanapp-test-bot bot added the user-test-missing User tests have not yet been defined for the PR label Sep 2, 2024
@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Sep 2, 2024

User Test Results

Test specification and instructions

ERROR: user tests have not yet been defined

Test Artifacts

@mcdurdin
Copy link
Member Author

mcdurdin commented Sep 2, 2024

@mhosken @DavidLRowe @LornaSIL feedback appreciated -- both in terms of FLO integration and in terms of referencing external fonts. This will feed into eventual deprecation of the majority of the shared fonts folder, hopefully.

There will still always be maintenance in updating font versions in the repo, but there is potential for that to be more scriptable in future with this change.

@darcywong00 darcywong00 modified the milestones: A18S10, A18S11 Sep 14, 2024
@darcywong00 darcywong00 modified the milestones: A18S11, A18S12 Sep 28, 2024
@darcywong00 darcywong00 modified the milestones: A18S12, A18S13 Oct 11, 2024
Comment on lines 4 to 5
import followRedirects from 'follow-redirects';
const { https } = followRedirects;
Copy link
Member Author

Choose a reason for hiding this comment

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

network access needs to be in callbacks

@darcywong00 darcywong00 modified the milestones: A18S13, A18S14 Oct 26, 2024
@darcywong00 darcywong00 modified the milestones: A18S14, A18S15 Nov 9, 2024
TEMP: this is very much not ready for production; opening as a draft for
public comment.

I will split the 'file.description' removal into a separate PR later.

The concept here is that the 'Name' property for a file can now be a
remote reference, rather than a local file. There are two supported
formats in this commit:

* GitHub: This is a cutdown version of a plain github.com URL, and must
  match this exact format:

  ```
  github:<owner>/<repo>/raw/<hash>/<filepath/filename>
  ```

  This format is mandated in order to ensure that we always have a
  hashed version of a file from the origin. This gives us reproducible
  builds, which avoids churn issues when font files change.

  Example: `github:silnrsi/fonts/raw/b88c7af5d16681bd137156929ff8baec82526560/fonts/sil/alkalami/Alkalami-Regular.ttf`
  gets https://github.com/silnrsi/fonts/raw/b88c7af5d16681bd137156929ff8baec82526560/fonts/sil/alkalami/Alkalami-Regular.ttf

  An alternative could be to just have `https://github.com/silnrsi/fonts/raw/b88c7af5d16681bd137156929ff8baec82526560/fonts/sil/alkalami/Alkalami-Regular.ttf`
  which could be matched with a regex in the same way as the `github`
  prefix, and would avoid the need to munge the input URL. **Discuss!**

* fonts.languagetechnology.org: references just a font identifier. This
  is somewhat broken, because if the source file changes, we don't know
  about it and won't publish an updated version of the package. So this
  needs some more discussion (we could e.g. embed the version number in
  the request, e.g. `flo:[email protected]`). **Discuss!**

  ```
  flo:<family>
  ```

  e.g. `flo:andika` gets https://fonts.languagetechnology.org/fonts/sil/andika/Andika-Bold.ttf

Future sources could be considered, e.g. noto. We don't want to allow
arbitrary URLs, both for stability and for security reasons.

This change is entirely compiler-side, so we don't need to make any
changes to apps, and so packages will be backwardly compatible. A lot of
work will need to be done with the Package Editor in TIKE to support
this feature.

Fixes: #11236
@mcdurdin mcdurdin force-pushed the feat/developer/kmc-package-source-files-from-remotes branch from 1a0161c to 6119759 Compare November 11, 2024 05:58
@mcdurdin
Copy link
Member Author

Replaced by #12667.

@mcdurdin mcdurdin closed this Nov 13, 2024
@mcdurdin mcdurdin deleted the feat/developer/kmc-package-source-files-from-remotes branch November 13, 2024 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

feat(developer): manage shared fonts
2 participants